From 6bd573f97acb49990d79677b297f0e923e845e2f Mon Sep 17 00:00:00 2001
From: Kevin Bracey <kbracey@gitlab.riscosopen.org>
Date: Fri, 12 Apr 2002 15:19:40 +0000
Subject: [PATCH] Lots of #ifndef __cplusplus added to <math.h>.

Version 5.40. Tagged as 'RISC_OSLib-5_40'
---
 VersionASM  | 14 +++++++-------
 VersionNum  | 22 +++++++++++-----------
 clib/h/math | 38 ++++++++++++++++++++++++++++----------
 3 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/VersionASM b/VersionASM
index a88ff8c..e655f00 100644
--- a/VersionASM
+++ b/VersionASM
@@ -12,14 +12,14 @@
                         GBLS    Module_HelpVersion
                         GBLS    Module_ComponentName
                         GBLS    Module_ComponentPath
-Module_MajorVersion     SETS    "5.39"
-Module_Version          SETA    539
+Module_MajorVersion     SETS    "5.40"
+Module_Version          SETA    540
 Module_MinorVersion     SETS    ""
-Module_Date             SETS    "11 Apr 2002"
-Module_ApplicationDate2 SETS    "11-Apr-02"
-Module_ApplicationDate4 SETS    "11-Apr-2002"
+Module_Date             SETS    "12 Apr 2002"
+Module_ApplicationDate2 SETS    "12-Apr-02"
+Module_ApplicationDate4 SETS    "12-Apr-2002"
 Module_ComponentName    SETS    "RISC_OSLib"
 Module_ComponentPath    SETS    "RiscOS/Sources/Lib/RISC_OSLib"
-Module_FullVersion      SETS    "5.39"
-Module_HelpVersion      SETS    "5.39 (11 Apr 2002)"
+Module_FullVersion      SETS    "5.40"
+Module_HelpVersion      SETS    "5.40 (12 Apr 2002)"
                         END
diff --git a/VersionNum b/VersionNum
index 8ddaebf..d4bb380 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,24 +1,24 @@
-/* (5.39)
+/* (5.40)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  * Last processed by srccommit version: 1.62.
  *
  */
-#define Module_MajorVersion_CMHG        5.39
+#define Module_MajorVersion_CMHG        5.40
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                11 Apr 2002
+#define Module_Date_CMHG                12 Apr 2002
 
-#define Module_MajorVersion             "5.39"
-#define Module_Version                  539
+#define Module_MajorVersion             "5.40"
+#define Module_Version                  540
 #define Module_MinorVersion             ""
-#define Module_Date                     "11 Apr 2002"
+#define Module_Date                     "12 Apr 2002"
 
-#define Module_ApplicationDate2         "11-Apr-02"
-#define Module_ApplicationDate4         "11-Apr-2002"
+#define Module_ApplicationDate2         "12-Apr-02"
+#define Module_ApplicationDate4         "12-Apr-2002"
 
 #define Module_ComponentName            "RISC_OSLib"
 #define Module_ComponentPath            "RiscOS/Sources/Lib/RISC_OSLib"
 
-#define Module_FullVersion              "5.39"
-#define Module_HelpVersion              "5.39 (11 Apr 2002)"
-#define Module_LibraryVersionInfo       "5:39"
+#define Module_FullVersion              "5.40"
+#define Module_HelpVersion              "5.40 (12 Apr 2002)"
+#define Module_LibraryVersionInfo       "5:40"
diff --git a/clib/h/math b/clib/h/math
index 79011b6..e01bb28 100644
--- a/clib/h/math
+++ b/clib/h/math
@@ -37,6 +37,7 @@ extern const double HUGE_VAL;
 #endif
 #endif
 
+#ifndef __cplusplus
 #ifndef HUGE_VALF
 #  define HUGE_VALF INFINITY
 #endif
@@ -52,6 +53,7 @@ extern const double HUGE_VAL;
 #define FP_INFINITY  3
 #define FP_NAN       4
    /* the mutually exclusive kinds of floating-point values for fpclassify() */
+#endif
 
 #define MATH_ERRNO 1
 #define MATH_ERREXCEPT 2
@@ -65,6 +67,10 @@ extern const double HUGE_VAL;
 extern "C" {
 #endif
 
+#ifndef __cplusplus
+/* None of this actually works, as the C++ system won't obey the
+   force_fpargs_in_regs pragma */
+
 #pragma no_side_effects
 #pragma force_fpargs_in_regs
 extern int __fpclassifyf(float);
@@ -101,6 +107,8 @@ extern int __signbitd(double);
 #define signbit(r)    __classmacro(signbit,(r))
    /* Returns: a nonzero value if and only if its argument is negative */
 
+#endif
+
 extern double acos(double /*x*/);
    /* computes the principal value of the arc cosine of x */
    /* a domain error occurs for arguments not in the range -1 to 1 */
@@ -120,9 +128,11 @@ extern double atan2(double /*x*/, double /*y*/);
    /* Returns: the arc tangent of y/x, in the range -Pi to Pi. */
 
 extern double __d_atan(double);
-extern __caller_narrow float __r_atan(float);
 #define atan(x) __d_atan(x)
+#ifndef __cplusplus
+extern __caller_narrow float __r_atan(float);
 #define atanf(x) __r_atan(x)
+#endif
 
 extern double cos(double /*x*/);
    /* computes the cosine of x (measured in radians). A large magnitude */
@@ -133,14 +143,16 @@ extern double sin(double /*x*/);
    /* argument may yield a result with little or no significance */
    /* Returns: the sine value. */
 
+extern double __d_cos(double);
 extern double __d_sin(double);
+#define cos(x) __d_cos(x)
+#define sin(x) __d_sin(x)
+#ifndef __cplusplus
 extern __caller_narrow float __r_sin(float);
-extern double __d_cos(double);
 extern __caller_narrow float __r_cos(float);
-#define sin(x) __d_sin(x)
 #define sinf(x) __r_sin(x)
-#define cos(x) __d_cos(x)
 #define cosf(x) __r_cos(x)
+#endif
 
 extern double tan(double /*x*/);
    /* computes the tangent of x (measured in radians). A large magnitude */
@@ -274,24 +286,27 @@ extern double __d_trunc(double);
 extern double __d_rint(double);
 extern long int __d_lrint(double);
 extern float __r_abs(float);
+#define fabs(x) __d_abs(x)
+#define floor(x) __d_floor(x)
+#define ceil(x) __d_ceil(x)
+#define trunc(x) __d_trunc(x)
+#define rint(x) __d_rint(x)
+#define lrint(x) __d_lrint(x)
+#ifndef __cplusplus
 extern __caller_narrow float __r_floor(float);
 extern __caller_narrow float __r_ceil(float);
 extern __caller_narrow float __r_trunc(float);
 extern __caller_narrow float __r_rint(float);
 extern __caller_narrow long int __r_lrint(float);
-#define fabs(x) __d_abs(x)
 #define fabsf(x) __r_abs(x)
-#define floor(x) __d_floor(x)
 #define floorf(x) __r_floor(x)
-#define ceil(x) __d_ceil(x)
 #define ceilf(x) __r_ceil(x)
-#define trunc(x) __d_trunc(x)
 #define truncf(x) __r_trunc(x)
-#define rint(x) __d_rint(x)
 #define rintf(x) __r_rint(x)
-#define lrint(x) __d_lrint(x)
 #define lrintf(x) __r_lrint(x)
+#endif
 
+#ifndef __cplusplus
 #pragma force_fpargs_in_regs
 extern double copysign(double /*x*/, double /*y*/);
 extern float copysignf(float /*x*/, float /*y*/);
@@ -299,6 +314,7 @@ extern float copysignf(float /*x*/, float /*y*/);
    /* produce a value with the magnitude of x and the sign of y. They */
    /* produce a NaN (with the sign of y) if x is a NaN. */
    /* Returns: a value with the magnitude of x and the sign of y. */
+#endif
 extern double nan(const char * /*tagp*/);
 extern float nanf(const char * /*tagp*/);
    /* Returns: a quiet NaN, with content indicated through tagp. */
@@ -320,6 +336,7 @@ extern double fmin(double /*x*/, double /*y*/);
 extern float fminf(float /*x*/, float /*y*/);
    /* Returns: the minimum numeric value of their arguments. */
 
+#ifndef __cplusplus
 #define isgreater(x,y)      ((x) __greater (y))
 #define isgreaterequal(x,y) ((x) __greaterequal (y))
 #define isless(x,y)         ((x) __less (y))
@@ -330,6 +347,7 @@ extern float fminf(float /*x*/, float /*y*/);
    /* relational operators, and other comparison macros that facilitate */
    /* writing efficient code that accounts for NaNs without suffering the */
    /* "invalid" floating-point exception. */
+#endif
 
 #ifdef __cplusplus
 }
-- 
GitLab