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

fixinc regression for <math.h> with C++ on Solaris 9


[ C++ gurus, below there is a four-liner which I believe to be
  valid C++, but a double check would be appreciated. ]

Hi Bruce,

the following difference between the fixincluded math.h on
sparc-sun-solaris2.9 seems to be responsible for a regression:

  /sw/gcc-3.2.3/lib/gcc-lib/sparc-sun-solaris2.9/3.2.3/include/math.h
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/include/math.h
  @@ -7,12 +7,6 @@
       This had to be done to correct non-standard usages in the
       original, manufacturer supplied header file.  */

  -#ifndef FIXINC_WRAP_MATH_H_MATH_EXCEPTION
  -#define FIXINC_WRAP_MATH_H_MATH_EXCEPTION 1
  -
  -#ifdef __cplusplus
  -#define exception __math_exception
  -#endif
   /*
    * Copyright 00/09/07 Sun Microsystems, Inc.  All Rights Reserved.
    */
  @@ -255,8 +249,3 @@ extern float modff __P((float, float *))
   #endif

   #endif /* _MATH_H */
  -#ifdef __cplusplus
  -#undef exception
  -#endif
  -
  -#endif  /* FIXINC_WRAP_MATH_H_MATH_EXCEPTION */

For the following C++ program

  #include <stdexcept>
  using namespace std;
  #include <cmath>

  int main() { return 0; }

we now get

  In file included from /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/../../../../include/c++/3.5.0/cmath:52,
     from x.cc:3:
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/include/math.h:202:
     error: use of `exception' is ambiguous
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/include/math.h:99:
    error:   first declared as `struct exception' here
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/../../../../include/c++/3.5.0/exception:53:
    error:   also declared as `class std::exception' here
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/include/math.h:202:
    error: conflicting declaration 'struct exception'
  /sw/gcc-current/lib/gcc/sparc-sun-solaris2.9/3.5.0/include/math.h:99:
    error: 'struct exception' has a previous declaration as `struct exception'

Gerald
-- 
Gerald Pfeifer (Jerry)   gerald@pfeifer.com   http://www.pfeifer.com/gerald/


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