Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with -Wunreachable-code



On Jul 22, 2006, at 12:01 PM, Sean McBride wrote:

Eric Albert (email@hidden) on 2006-07-21 23:54 said:

I have been going through that doc as well, and -Wunreachable-code
also
gives a warning everytime assert() from assert.h is used.

Yep. Kind of annoying, huh? But the assert() warning has been fixed for a future release, so hopefully you'll be able to use - Wunreachable-code more often eventually.

Great! Is it something that I can fix myself in the meantime by altering my assert.h header?

Change this line:
#define __assert(e, file, line) \
((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort(), 0)
to
#define __assert(e, file, line) \
((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort())


Change this line:
#define __assert(e, file, line) \
    (__eprintf ("%s:%u: failed assertion `%s'\n", file, line, e), 0)
to
#define __assert(e, file, line) \
    __eprintf ("%s:%u: failed assertion `%s'\n", file, line, e)

I hope <rdar://4115550> is fixed also, all someone needs to do is add 6
characters to assert.h to fix it. :)

It's been fixed.

Apple's headers are full of warnings in general BTW.

If you find warnings in Apple's headers when compiling C99 code, please file bugs. We're always interested in hearing about those cases. -pedantic is an exception to that, by the way; I'm disappointed that the static code analysis article recommended it.

Well, I'm hesitant to do that. A year ago I spent an afternoon filing
radars for warnings and errors in Apple's headers and the vast majority
are not fixed. For <rdar://4056291> I even supplied a patch! Perhaps
since the bugs are CodeWarrior-related, they are ignored?

For fairly obvious reasons, CodeWarrior-specific changes are not a terribly high priority for us any more....


-Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >problem with -Wunreachable-code (From: "James W. Walker" <email@hidden>)
 >Re: problem with -Wunreachable-code (From: "Sean McBride" <email@hidden>)
 >Re: problem with -Wunreachable-code (From: Eric Albert <email@hidden>)
 >Re: problem with -Wunreachable-code (From: "Sean McBride" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.