This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix build warnings for functions without return value


On Wed, Jul 28, 2010 at 04:19:22PM -0700, Daniel Colascione wrote:
>> From: cygwin-patches-owner
>>
>>I don't see why this is needed.  Cygwin uses -Werror by default so, if
>>gcc 4.3.4 emitted warnings we wouldn't be able to build a release or
>>make a snapshot.
>
>It's because Cygwin uses -Werror that I had to patch the source.  I'm
>compiling with '-Os -march=native',

That's prolly something you should have mentioned initially.  It would
have shortened this conversation.

If this really is a problem then it seems like the right way to fix it
is with __attribute__ ((noreturn)).  I'll check in a fix to do that.

>which must tickle a different part of the optimizer and thereby produce
>this warning.  (One of the nice things about clang is reportedly that
>it produces the same warnings no matter what the optimizer does.)

Sorry but this seems like a non-sequitur.  clang doesn't seem pertinent
to this discussion.

>Besides, the current code is technically undefined and the patch
>removes that undefined behavior --- which could start producing
>warnings for the current build at any time.

I don't believe that the behavior of a while (1) or for (;;) is
undefined.  I suspect that when compiling with -O2 the compiler is
actually smart enough to figure out that the function doesn't return and
to avoid a warning.  So, I'd say it's equally possible that the -Os
behavior could be fixed.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]