EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS)
From: Till Straumann <[email protected]>
To: TECHTALK tech-talk <[email protected]>, Eric Norum <[email protected]>
Date: Tue, 18 Sep 2007 13:00:24 -0700
libCom/osi/os/RTEMS/epicsMath.h

declares 'isnan' and 'isinf' as external functions but C99 demands
that they are macros and newlib-1.15 defines them as such.

Including RTEMS' epicsMath.h from a C++ or C99 source file
causes a compilation error.

The attached kludge fixes this.

In fact, using 'isnan/isinf' from code that claims to be ANSI compliant
(EPICS base is usually compiled (gcc) with -ansi) is wrong. ANSI-C code
should not assume these functions to be present.

-- Till
*** src/libCom/osi/os/RTEMS/epicsMath.h.orig	2007-09-18 12:38:39.000000000 -0700
--- src/libCom/osi/os/RTEMS/epicsMath.h	2007-09-18 12:46:28.000000000 -0700
***************
*** 16,24 ****
  extern "C" {
  #endif
  
  int isnan(double);
- int finite(double);
  int isinf(double);
  
  #ifdef __cplusplus
  }
--- 16,29 ----
  extern "C" {
  #endif
  
+ /* T.S.; C99 demands that these are macros and newlib-1.15 defines
+  * them as such!
+  */
+ #if defined(STRICT_ANSI) && !defined(__cplusplus)
  int isnan(double);
  int isinf(double);
+ #endif
+ int finite(double);
  
  #ifdef __cplusplus
  }

Replies:
Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Eric Norum

Navigate by Date:
Prev: RE: Deadlock on epicsEvent Jeff Hill
Next: Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Beginer problem Paul Joireman
Next: Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·