This is the mail archive of the libc-alpha@sourceware.cygnus.com 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]

-Wredundant-decls and <math.h>



Hi,

Egbert reported to me a problem with our headers.  It nails down to
the following:

The inclusion of <math.h>, e.g with this simple program:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <math.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generates a bunch of errors when compiled with -Wredundand-decls:
gcc  -Wredundant-decls   -O1       -c error2.c
In file included from /usr/include/math.h:348,
                 from error2.c:1:
/usr/include/bits/mathinline.h:328: warning: redundant redeclaration of `__expm1l' in same scope
/usr/include/bits/mathcalls.h:122: warning: previous declaration of `__expm1l'
/usr/include/bits/mathinline.h:348: warning: redundant redeclaration of `exp' in same scope
/usr/include/bits/mathcalls.h:96: warning: previous declaration of `exp'
/usr/include/bits/mathinline.h:348: warning: redundant redeclaration of `expf' in same scope
/usr/include/bits/mathcalls.h:96: warning: previous declaration of `expf'
/usr/include/bits/mathinline.h:348: warning: redundant redeclaration of `expl' in same scope
/usr/include/bits/mathcalls.h:96: warning: previous declaration of `expl'
/usr/include/bits/mathinline.h:349: warning: redundant redeclaration of `__expl' in same scope
/usr/include/bits/mathcalls.h:96: warning: previous declaration of `__expl'
/usr/include/bits/mathinline.h:352: warning: redundant redeclaration of `tan' in same scope
/usr/include/bits/mathcalls.h:67: warning: previous declaration of `tan'
/usr/include/bits/mathinline.h:352: warning: redundant redeclaration of `tanf' in same scope
/usr/include/bits/mathcalls.h:67: warning: previous declaration of `tanf'
/usr/include/bits/mathinline.h:352: warning: redundant redeclaration of `tanl' in same scope
/usr/include/bits/mathcalls.h:67: warning: previous declaration of `tanl'
/usr/include/bits/mathinline.h:367: warning: redundant redeclaration of `atan2' in same scope
/usr/include/bits/mathcalls.h:60: warning: previous declaration of `atan2'
/usr/include/bits/mathinline.h:367: warning: redundant redeclaration of `atan2f' in same scope
[...]

The problem is the additional prototype in bits/mathinline.h.  The
various __MATH macros in math.h provide already most prototypes.

How should we handle this?

Currently we use in sysdeps/i386/fpu/bits/mathinline.h:
#define __inline_mathcode_(float_type, func, arg, code) \
  __MATH_INLINE float_type func (float_type);				      \
  __MATH_INLINE float_type func (float_type arg)			      \
  {									      \
    code;								      \
  }

For some functions the prototype is needed to avoid warnings for
missing prototypes - but for others we have duplicates :-(.

Shall we add another set of macros which doesn't use an extra
prototype?

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

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