This is the mail archive of the cygwin@sources.redhat.com 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]

RE: unwanted compiler warnings with -pedantic



 > Just as an exercise, try to come up with some way, in gcc, 
> to represent
> > a 64 bit integer which does not use 'long long'.  That will 
> get rid of
> > one of the warnings.
> 
> Liberal use of __extension__ has calmed the compiler so that even its
> strictest mode doesn't complain (on Linux and for C++, haven't tried
> anywhere else yet).  Something like `__extension__ typedef long long
> foobar;'.  IIRC glibc headers use that a lot.
> 
> Whether or not it will be the right thing to use 
> __extension__ all over
> the place for system-interface stuff is altogether a different
> question...  I guess if someone cares enough about those warnings they
> could submit the patches to apply __extension__.
 If I understand the gcc info page, I don't think such patches
will be warmly received.  An excerpt from "info gcc" is below.
 Note that the stdlib.h errors that the original poster was objecting
to are wrapped in a
#ifndef __STRICT_ANSI__
...
#endif

 The proper way to ensure portable code is to use -ansi.


`-pedantic'
     Issue all the warnings demanded by strict ANSI C and ISO C++;
     reject all programs that use forbidden extensions.
...
     `-pedantic' does not cause warning messages for use of the
     alternate keywords whose names begin and end with `__'.  Pedantic
     warnings are also disabled in the expression that follows
     `__extension__'.  However, only system header files should use
     these escape routes; application programs should avoid them.
     *Note Alternate Keywords::.

     This option is not intended to be useful; it exists only to satisfy
     pedants who would otherwise claim that GCC fails to support the
     ANSI standard.

     Some users try to use `-pedantic' to check programs for strict ANSI
     C conformance.  They soon find that it does not do quite what they
     want: it finds some non-ANSI practices, but not all--only those
     for which ANSI C *requires* a diagnostic.

     A feature to report any failure to conform to ANSI C might be
     useful in some instances, but would require considerable
     additional work and would be quite different from `-pedantic'.  We
     don't have plans to support such a feature in the near future.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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