• 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: problem with -Wunreachable-code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with -Wunreachable-code


  • Subject: Re: problem with -Wunreachable-code
  • From: Eric Albert <email@hidden>
  • Date: Sat, 22 Jul 2006 13:05:54 -0700

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: problem with -Wunreachable-code
      • From: David Dunham <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>)

  • Prev by Date: Re: problem with -Wunreachable-code
  • Next by Date: Re: Building a library using as universal for 10.3.9 ppc from
  • Previous by thread: Re: problem with -Wunreachable-code
  • Next by thread: Re: problem with -Wunreachable-code
  • Index(es):
    • Date
    • Thread