• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Clang analysis: Debug variables "never read."
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clang analysis: Debug variables "never read."


  • Subject: Re: Clang analysis: Debug variables "never read."
  • From: Philip Aker <email@hidden>
  • Date: Sun, 4 Oct 2009 03:03:33 -0700

On 2009-10-02, at 09:57:48, Fritz Anderson wrote:

I have a lot of code that assigns diagnostic information (error codes, strings) to local variables for the sole purpose of making that information visible in the debugger.

- (void) wrapSomethingComplicated
{
	MyObject *	localStuff;
	//	Lots of prep work going into localStuff
	///	...
	int	errorCode = [self doSomethingComplicated: localStuff];
	[localStuff tearDown];
}

When I select Build > Build and Analyze in Xcode 3.2, the analyzer issues lots of issues of the form "Value stored to 'errorCode' is never read." This is correct, as far as it goes, but the non-use is intentional.

I saw the answers for this particular problem but maybe that's not the whole story for "never read". Not near the actual source file right now but it looks something like:


int foo( void ) {

	int never_red;
	bool y = false;
	bool x = bar();

	if( x ) {
		never_red = 1;
		y = true;
	}
	if( y ) {
		return f( never_red );
	}

	return 0;
}

So, it looks like it's not recognizing that never_red was given a value in the if block statement.


Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Clang analysis: Debug variables "never read." (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: ostringstream problem with Xcode 3.2
  • Next by Date: Re: Doxygen generated DocSets and Quick Help
  • Previous by thread: Re: Clang analysis: Debug variables "never read."
  • Next by thread: Any way to get 16-bit string literals?
  • Index(es):
    • Date
    • Thread