This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

new __strtol warning


After 2a1cfd94, there is this new warning (on x86_64-linux-gnu, gcc-4.8.2):

../stdlib/strtol.c:107:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

Please keep an eye out for new warnings when you make a change.  
Perhaps we should start adding -Werror=foo for certain warnings, and
-Werror=strict-prototypes is a fairly obvious safe candidate.

There are three ways you can fix this warning, two of them trivial.

1. Declare __strtol in include/stdlib.h.  In the general case, this is the
   Right Thing To Do.  That ensures that there is a prior declaration
   before the definition.  But if there were any actual uses, they would
   have had warnings about the undeclared function.  Moreover, since strtol
   is a C89 function, there is no reason ever to use (or have) __strtol.

2. Change the definition to be a prototype.  This is a transformation we
   have been generically doing, so it doesn't hurt.  I'm not sure what our
   current scheme is for ensuring there is a prior declaration for every
   non-static function when the definition uses a prototype so that
   -Wstrict-prototypes doesn't catch it.  Nothing we have more automated
   than human eyeballs will catch useless extra symbol names this way.

3. Rework your change so that it does not use the name __strtol at all,
   while still using __strtoull et al.  This is the ideal solution for this
   case, because strtol is a C89 function and so __strtol will never be
   used anywhere.  It's always nice to clean the symbol table of useless
   symbols and have the DWARF data use the canonical name for a function.


Thanks,
Roland


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