Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346557

Summary: false positive for 'no return in function returning non void' when using pthread_exit()
Product: [Tools] CDT Reporter: Matt Hargett <matt>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, eclipse.sprigogin, yevshif
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 316076    
Bug Blocks:    

Description Matt Hargett CLA 2011-05-19 18:34:40 EDT
Build Identifier: 201105160958

CDT correctly infers non-returning when using exit(), but not pthread_exit() for the following code:

static void *
timer_pthread(void *arg)
{
	Timer_Thread_Args *args = (reinterpret_cast<Timer_Thread_Args*>(arg));

	if( args->my_flags == KNL::Timer::PERIODIC )
	{
		for(;;)
		{
			KNL::Sleep(args->my_expiry_in_nanoseconds);
			if( KNL::is_valid_pid(args->my_caller) )
			{
				KNL::Signal(args->my_caller, TIMER_THREAD_TIMER_SIGNAL, true);
			}
		}
	}
	else
	{
		KNL::Sleep(args->my_expiry_in_nanoseconds);
		if( KNL::is_valid_pid(args->my_caller) )
		{
			KNL::Signal(args->my_caller, TIMER_THREAD_TIMER_SIGNAL, true);
		}
	}

	delete args;
	pthread_exit(NULL);
}

Reproducible: Always
Comment 1 Sergey Prigogin CLA 2011-05-19 18:48:56 EDT
We can special-case pthread_exit, but a real solution to this problem is to fix bug 316076.
Comment 2 Sergey Prigogin CLA 2012-04-16 23:03:58 EDT
This bug should be fixed together with bug 316076. Please reopen if it's still not working.