This is the mail archive of the 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]

C99 macros in math.h

While trying to recompile a recent release of libxml2, I've found a problem
with math.h and libm. As far as I can see, it's like this in cygwin 1.3.11
and also in recent snapshots.

The problem is that since 2002-06-06, newlib/libc/include/math.h has defined
some ISO C99 macros for classifying floating point values, and these macros
refer to functions that were added at the same time to newlib/libm/common/,
for example in the file s_fpclassify.c. See newlib/ChangeLog.

Now, while newlib/libc/include/math.h shows up in cygwin as
/usr/include/math.h, the functions defined by
newlib/libm/common/s_fpclassify.c show up nowhere I or the linker can
find them. So when some code in libxml2-2.4.22/trionan.c looks like this:

#if defined(fpclassify) && defined(signbit)
   * C99 defines fpclassify() and signbit() as a macros
  *is_negative = signbit(number);
  switch (fpclassify(number)) {

the result is undefined references at link time.

My workaround was to remove the ISO C99 macros from /usr/include/math.h, but
this is probably not the correct solution (nudge nudge, wink wink, say no
more, say no more)?

kind regards
Peter Ring

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