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

__STRICT_ANSI__ problems in math.h


Currently math.h checks to make sure that __STRICT_ANSI__ is not defined before prototyping functions like fmax. This is presumably to ensure that non-C89 functions are not defined if -ansi is passed to gcc. However, __STRICT_ANSI__ is still defined when passing -std=c99 to gcc. This causes C99 functions like fmax to not have any prototypes. It seems that checking for __STRICT_ANSI__ is not enough. Perhaps a solution is to check for __STRICT_ANSI__ and a __STDC_VERSION__ >= 199901L? This isn't a problem for me with GCC 3.4.4 on Cygwin because GCC has a builtin fmax, but with GCC 3.3.3 Cygwin, the compiled code fails to work correctly because of the lack of prototypes. Below is an example of what I am talking about. I'm guessing that there are more instances of this type of C89 checking, but I didn't have to worry about them for the scope of my problem.

-Jevin Sweval

original math.h
================================================
#endif /* ! defined (_REENT_ONLY) */

#if !defined(__STRICT_ANSI__) || defined(__cplusplus)

/* ISO C99 types and macros. */

#ifndef FLT_EVAL_METHOD
================================================

correct(?) checking:
================================================
#endif /* ! defined (_REENT_ONLY) */

#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L

/* ISO C99 types and macros. */

#ifndef FLT_EVAL_METHOD
================================================

****************************************************************************************

Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 

****************************************************************************************


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