From: ehofman <ehofman>
Date: Fri, 25 Jul 2008 10:39:20 +0000 (+0000)
Subject: Attached patches remove BORLANDC, and hence SG_MATH_EXCEPTION_CLASH and SG_INCOM
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cd72eb20c6b31e253e93e55c13ca4966eb1556fc;p=simgear.git

Attached patches remove BORLANDC, and hence SG_MATH_EXCEPTION_CLASH and SG_INCOM
PLETE_FUNCTIONAL from SimGear and FlightGear.

As a result, SG_HAVE_STD_INCLUDES is now *always* set, so I will get the boring
fixes for that done, but separately. I'm still auditing the other things in comp
ilers.h - there's a lot that can die now BORLAND is gone.
---

diff --git a/simgear/compiler.h b/simgear/compiler.h
index 733e54cf..5e64764b 100644
--- a/simgear/compiler.h
+++ b/simgear/compiler.h
@@ -63,8 +63,6 @@
  *
  *  (15) Defines SG_HAVE_STREAMBUF if <streambuf> of <streambuf.h> are present.
  *
- *  (16) Define SG_MATH_EXCEPTION_CLASH if math.h defines an exception class
- *       that clashes with the one defined in <stdexcept>.
  */
 
 #ifndef _SG_COMPILER_H
@@ -79,48 +77,7 @@
 #define SG_DO_STRINGIZE(X) #X
 
 #ifdef __GNUC__
-#  if __GNUC__ == 2 
-#    if __GNUC_MINOR__ < 8
-
-       // g++-2.7.x
-#      define STL_ALGORITHM  <algorithm>
-#      define STL_FUNCTIONAL <functional>
-#      define STL_IOMANIP    <iomanip.h>
-#      define STL_IOSTREAM   <iostream.h>
-#      define STL_ITERATOR   <iterator.h>
-#      define STL_FSTREAM    <fstream.h>
-#      define STL_STDEXCEPT  <stdexcept>
-#      define STL_STRING     <string>
-#      define STL_STRSTREAM  <strstream.h>
-
-#      define SG_NEED_AUTO_PTR
-#      define SG_NO_DEFAULT_TEMPLATE_ARGS
-#      define SG_INCOMPLETE_FUNCTIONAL
-#      define SG_NO_ARROW_OPERATOR
-
-#    elif __GNUC_MINOR__ >= 8
-
-       // g++-2.8.x and egcs-1.x
-#      define SG_EXPLICIT_FUNCTION_TMPL_ARGS
-#      define SG_NEED_AUTO_PTR
-#      define SG_MEMBER_TEMPLATES
-#      define SG_NAMESPACES
-#      define SG_HAVE_STD
-#      define SG_HAVE_STREAMBUF
-#      define SG_CLASS_PARTIAL_SPECIALIZATION
-
-#      define STL_ALGORITHM  <algorithm>
-#      define STL_FUNCTIONAL <functional>
-#      define STL_IOMANIP    <iomanip>
-#      define STL_IOSTREAM   <iostream>
-#      define STL_ITERATOR   <iterator>
-#      define STL_FSTREAM    <fstream>
-#      define STL_STDEXCEPT  <stdexcept>
-#      define STL_STRING     <string>
-#      define STL_STRSTREAM  <strstream>
-
-#    endif
-#  elif __GNUC__ >= 3
+#  if __GNUC__ >= 3
        // g++-3.0.x
 #      define SG_EXPLICIT_FUNCTION_TMPL_ARGS
 #      define SG_NEED_AUTO_PTR
@@ -141,7 +98,7 @@
 #      define STL_STRING     <string>
 #      define STL_STRSTREAM  <strstream>
 #  else
-#    error Time to upgrade. GNU compilers < 2.7 not supported
+#    error Time to upgrade. GNU compilers < 3.0 not supported
 #  endif
 
 #  define SG_COMPILER_STR "GNU C++ version " SG_STRINGIZE(__GNUC__) "." SG_STRINGIZE(__GNUC_MINOR__)
@@ -210,40 +167,6 @@
 
 #endif // _MSC_VER
 
-#ifdef __BORLANDC__
-# if defined(HAVE_SGI_STL_PORT)
-
-// Use quotes around long file names to get around Borland's include hackery
-
-#  define STL_ALGORITHM  "algorithm"
-#  define STL_FUNCTIONAL "functional"
-
-#  define SG_MATH_EXCEPTION_CLASH
-
-# else
-
-#  define STL_ALGORITHM  <algorithm>
-#  define STL_FUNCTIONAL <functional>
-#  define STL_IOMANIP    <iomanip>
-#  define STL_STDEXCEPT  <stdexcept>
-#  define STL_STRSTREAM  <strstream>
-
-#  define SG_INCOMPLETE_FUNCTIONAL
-
-# endif // HAVE_SGI_STL_PORT
-
-#  define STL_IOSTREAM   <iostream>
-#  define STL_ITERATOR   <iterator>
-#  define STL_FSTREAM    <fstream>
-#  define STL_STRING     <string>
-#  define SG_NO_DEFAULT_TEMPLATE_ARGS
-#  define SG_NAMESPACES
-// #  define SG_HAVE_STD
-
-#  define SG_COMPILER_STR "Borland C++ version " SG_STRINGIZE(__BORLANDC__)
-
-#endif // __BORLANDC__
-
 //
 // Native SGI compilers
 //
@@ -343,6 +266,7 @@
 #  define SG_GLEXT_H <OpenGL/glext.h>
 #  define SG_GLUT_H <GLUT/glut.h>
 
+
 inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
 #else
 #  define SG_GL_H <GL/gl.h>
@@ -410,28 +334,5 @@ inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
 #  define STD
 # endif
 
-// Additional <functional> implementation from SGI STL 3.11
-// Adapter function objects: pointers to member functions
-#ifdef SG_INCOMPLETE_FUNCTIONAL
-
-template <class _Ret, class _Tp>
-class const_mem_fun_ref_t
-#ifndef __BORLANDC__
-    : public unary_function<_Tp,_Ret>
-#endif // __BORLANDC__
-{
-public:
-  explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
-  _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
-private:
-  _Ret (_Tp::*_M_f)() const;
-};
-
-template <class _Ret, class _Tp>
-inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
-  { return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
-
-#endif // SG_INCOMPLETE_FUNCTIONAL
-
 #endif // _SG_COMPILER_H
 
diff --git a/simgear/constants.h b/simgear/constants.h
index b6fd7a90..77f83011 100644
--- a/simgear/constants.h
+++ b/simgear/constants.h
@@ -34,9 +34,6 @@
 #ifdef SG_HAVE_STD_INCLUDES
 #  include <cmath>
 #else
-#  ifdef SG_MATH_EXCEPTION_CLASH
-#    define exception C_exception
-#  endif
 #  include <math.h>
 #endif
 
diff --git a/simgear/ephemeris/celestialBody.cxx b/simgear/ephemeris/celestialBody.cxx
index 8a1539cc..4e887392 100644
--- a/simgear/ephemeris/celestialBody.cxx
+++ b/simgear/ephemeris/celestialBody.cxx
@@ -24,9 +24,6 @@
 
 #include <simgear/debug/logstream.hxx>
 
-#ifdef SG_MATH_EXCEPTION_CLASH
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "celestialBody.hxx"
diff --git a/simgear/ephemeris/jupiter.cxx b/simgear/ephemeris/jupiter.cxx
index 1c16e119..1d9ca6bd 100644
--- a/simgear/ephemeris/jupiter.cxx
+++ b/simgear/ephemeris/jupiter.cxx
@@ -22,10 +22,6 @@
  * $Id$
  **************************************************************************/
 
-
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "jupiter.hxx"
diff --git a/simgear/ephemeris/mars.cxx b/simgear/ephemeris/mars.cxx
index 57b4165d..78c26f35 100644
--- a/simgear/ephemeris/mars.cxx
+++ b/simgear/ephemeris/mars.cxx
@@ -22,9 +22,6 @@
  * $Id$
  **************************************************************************/
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "mars.hxx"
diff --git a/simgear/ephemeris/mercury.cxx b/simgear/ephemeris/mercury.cxx
index 6651ed67..da450782 100644
--- a/simgear/ephemeris/mercury.cxx
+++ b/simgear/ephemeris/mercury.cxx
@@ -22,9 +22,6 @@
  * $Id$
  **************************************************************************/
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "mercury.hxx"
diff --git a/simgear/ephemeris/moonpos.cxx b/simgear/ephemeris/moonpos.cxx
index 4f8ca09f..7908fa89 100644
--- a/simgear/ephemeris/moonpos.cxx
+++ b/simgear/ephemeris/moonpos.cxx
@@ -27,9 +27,6 @@
 
 #include <simgear/debug/logstream.hxx>
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 // #include <FDM/flight.hxx>
diff --git a/simgear/ephemeris/saturn.cxx b/simgear/ephemeris/saturn.cxx
index eed07711..0038a290 100644
--- a/simgear/ephemeris/saturn.cxx
+++ b/simgear/ephemeris/saturn.cxx
@@ -22,9 +22,6 @@
  * $Id$
  **************************************************************************/
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "saturn.hxx"
diff --git a/simgear/ephemeris/star.cxx b/simgear/ephemeris/star.cxx
index 0bf3451d..dee21439 100644
--- a/simgear/ephemeris/star.cxx
+++ b/simgear/ephemeris/star.cxx
@@ -22,10 +22,6 @@
  * $Id$
  **************************************************************************/
 
-
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include <simgear/debug/logstream.hxx>
diff --git a/simgear/ephemeris/uranus.cxx b/simgear/ephemeris/uranus.cxx
index a3e9162c..f3d55601 100644
--- a/simgear/ephemeris/uranus.cxx
+++ b/simgear/ephemeris/uranus.cxx
@@ -22,9 +22,6 @@
  * $Id$
  **************************************************************************/
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "uranus.hxx"
diff --git a/simgear/ephemeris/venus.cxx b/simgear/ephemeris/venus.cxx
index 0e37bbf2..b889107e 100644
--- a/simgear/ephemeris/venus.cxx
+++ b/simgear/ephemeris/venus.cxx
@@ -22,9 +22,6 @@
  * $Id$
  **************************************************************************/
 
-#ifdef __BORLANDC__
-#  define exception c_exception
-#endif
 #include <math.h>
 
 #include "venus.hxx"
diff --git a/simgear/math/point3d.hxx b/simgear/math/point3d.hxx
index 48f6e9ad..089da93a 100644
--- a/simgear/math/point3d.hxx
+++ b/simgear/math/point3d.hxx
@@ -37,10 +37,6 @@
 
 #include <simgear/compiler.h>
 
-#ifdef SG_MATH_EXCEPTION_CLASH
-# define exception c_exception
-#endif
-
 #include <ostream>
 #include <istream>
 #include <cassert>
diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx
index aa680d01..fc59471f 100644
--- a/simgear/misc/sgstream.hxx
+++ b/simgear/misc/sgstream.hxx
@@ -33,13 +33,7 @@
 
 #include <simgear/compiler.h>
 
-#if defined( SG_HAVE_STD_INCLUDES )
 #  include <istream>
-#elif defined ( __BORLANDC__ )
-#  include <iostream>
-#else
-#  include <istream.h>
-#endif
 
 #include STL_STRING
 
diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx
index 2d488f34..8edb5206 100644
--- a/simgear/scene/material/mat.cxx
+++ b/simgear/scene/material/mat.cxx
@@ -33,10 +33,6 @@ SG_USING_STD(map);
 
 #include <plib/ul.h>
 
-#ifdef SG_MATH_EXCEPTION_CLASH
-#  include <math.h>
-#endif
-
 #include <osg/CullFace>
 #include <osg/Material>
 #include <osg/ShadeModel>
diff --git a/simgear/scene/material/matlib.cxx b/simgear/scene/material/matlib.cxx
index b02aac76..6ef1be04 100644
--- a/simgear/scene/material/matlib.cxx
+++ b/simgear/scene/material/matlib.cxx
@@ -25,10 +25,6 @@
 #  include <simgear_config.h>
 #endif
 
-#ifdef SG_MATH_EXCEPTION_CLASH
-#  include <math.h>
-#endif
-
 #ifdef HAVE_WINDOWS_H
 #  include <windows.h>
 #endif
diff --git a/simgear/scene/material/matmodel.cxx b/simgear/scene/material/matmodel.cxx
index b2a4152d..1b3204da 100644
--- a/simgear/scene/material/matmodel.cxx
+++ b/simgear/scene/material/matmodel.cxx
@@ -36,10 +36,6 @@ SG_USING_STD(map);
 #include <osg/StateSet>
 #include <osg/Transform>
 
-#ifdef SG_MATH_EXCEPTION_CLASH
-#  include <math.h>
-#endif
-
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>