This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: non-static definition after static declaration



  In message <199911291426.JAA22798@caip.rutgers.edu>you write:
 > 
  > Well on the flip side, we'd have to install extra (and IMHO mostly
  > unnecessary) hair to silence these new -Wtraditional warnings for the
  > language subdirs.
True.  But we're talking about stuff we're doing elsewhere already.  ie,
we already have to avoid traditional stuff elsewhere in the compiler, avoiding
the few issues in the language front-ends won't be all that difficult.

  > This warnings gives us four things:
  >  >  integer constant is unsigned in ANSI C, signed with -traditional
  >  >  `long' switch expression not converted to `int' in ANSI C
  >  >  non-static declaration for `???' follows static
  >  >  macro arg `???' would be stringified with -traditional.
  > 
  > (IMHO, the first two are less useful than the latter two.)
  > 
  > The first one is especially pervasive and requires uglifying the code
  > by adding many casts.  So I propose the following:
Examples please?  If we're using constants that change their meaning
depending on ansi vs non-ansi behavior we should avoid that.  It's simply
a dumb habit to get into, even for the language front-ends.  Similarly for
the 3rd & 4th warning.  The second warning is important too -- I've recently
been bitten by that problem and it was a *major* headache to track down.

Again, better to get everyone into the habit of not writing ANSI specific
code in GCC than to try and always sweep up after the fact.


  > You allow me to make the -Wtraditional warning more granular so we can
  > only ask for the latter two parts of it.  I would add new flags for
  > each of the four warning types, and we would only issue the latter
  > two.  E.g.:
I'd prefer not to do that.  If we really find that the changes we have to
make to the sources are significant enough, then we can revisit the
decision to have warning flags specific to certain directories.

jeff



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