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: Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS)
From: Eric Norum <[email protected]>
To: Till Straumann <[email protected]>
Cc: TECHTALK tech-talk <[email protected]>
Date: Tue, 18 Sep 2007 15:13:19 -0500
Which version of the source is this patch against? The current CVS version of src/libCom/osi/os/RTEMS/epicsMath.h is now nothing but:

/ ************************************************************************ *\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*********************************************************************** **/
#ifndef epicsMathh
#define epicsMathh


#include <math.h>
#include <ieeefp.h>

#endif /* epicsMathh */



On Sep 18, 2007, at 3:00 PM, Till Straumann wrote:

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
  }

-- Eric Norum <[email protected]> Advanced Photon Source Argonne National Laboratory (630) 252-4793



Replies:
Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann
References:
ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann

Navigate by Date:
Prev: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann
Next: Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann
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: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann
Next: Re: ANSI source including epicsMath.h won't compile with newlib 1.15 (RTEMS) Till Straumann
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 ·