public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7397] Fix declarations of _DINFINITY, _SINFINITY and _SQNAN
@ 2022-02-27 19:48 John David Anglin
  0 siblings, 0 replies; only message in thread
From: John David Anglin @ 2022-02-27 19:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d1574a9b820f17adb9004255e2018967e9be063b

commit r12-7397-gd1574a9b820f17adb9004255e2018967e9be063b
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Sun Feb 27 19:47:25 2022 +0000

    Fix declarations of _DINFINITY, _SINFINITY and _SQNAN
    
    The declarations of _DINFINITY, _SINFINITY and _SQNAN need to be constant
    expressions.
    
    2022-02-27  John David Anglin  <danglin@gcc.gnu.org>
    
    fixincludes/ChangeLog:
            * inclhack.def (hpux_math_constexpr): New hack.
            * fixincl.x: Regenerate.
            * tests/base/math.h: Update.

Diff:
---
 fixincludes/fixincl.x         | 44 +++++++++++++++++++++++++++++++++++++++----
 fixincludes/inclhack.def      | 18 ++++++++++++++++++
 fixincludes/tests/base/math.h |  7 +++++++
 3 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index b5cea5a43af..bad490453b7 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  January 15, 2022 at 10:54:24 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  February 27, 2022 at 07:47:03 PM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:54:24 UTC 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Feb 27 19:47:03 UTC 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 266 fixup descriptions.
+ * This file contains 267 fixup descriptions.
  *
  * See README for more information.
  *
@@ -4516,6 +4516,36 @@ static const char* apzHpux11_Cpp_Pow_InlinePatch[] = {
     "",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Hpux_Math_Constexpr fix
+ */
+tSCC zHpux_Math_ConstexprName[] =
+     "hpux_math_constexpr";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zHpux_Math_ConstexprList[] =
+  "math.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Math_ConstexprMachs[] = {
+        "*-hp-hpux11*",
+        (const char*)NULL };
+#define HPUX_MATH_CONSTEXPR_TEST_CT  0
+#define aHpux_Math_ConstexprTests   (tTestDesc*)NULL
+
+/*
+ *  Fix Command Arguments for Hpux_Math_Constexpr
+ */
+static const char* apzHpux_Math_ConstexprPatch[] = { sed_cmd_z,
+    "-e", "s@^[ \t]*extern[ \t]*const[ \t]*double[ \t]*_DINFINITY;[ \t]*$@#  define _DINFINITY (__builtin_inf ())@",
+    "-e", "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SINFINITY;[ \t]*$@#    define _SINFINITY (__builtin_inff ())@",
+    "-e", "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SQNAN;[ \t]*$@#    define _SQNAN (__builtin_nanf (\\\"\\\"))@",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Hpux10_Ctype_Declarations1 fix
@@ -10844,7 +10874,7 @@ static const char* apzX11_SprintfPatch[] = {
  */
 #define REGEX_COUNT          305
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            266
+#define FIX_COUNT            267
 
 /*
  *  Enumerate the fixes
@@ -10957,6 +10987,7 @@ typedef enum {
     HPPA_HPUX_FP_MACROS_FIXIDX,
     HPUX10_CPP_POW_INLINE_FIXIDX,
     HPUX11_CPP_POW_INLINE_FIXIDX,
+    HPUX_MATH_CONSTEXPR_FIXIDX,
     HPUX10_CTYPE_DECLARATIONS1_FIXIDX,
     HPUX10_CTYPE_DECLARATIONS2_FIXIDX,
     HPUX10_STDIO_DECLARATIONS_FIXIDX,
@@ -11654,6 +11685,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      HPUX11_CPP_POW_INLINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aHpux11_Cpp_Pow_InlineTests,   apzHpux11_Cpp_Pow_InlinePatch, 0 },
 
+  {  zHpux_Math_ConstexprName,    zHpux_Math_ConstexprList,
+     apzHpux_Math_ConstexprMachs,
+     HPUX_MATH_CONSTEXPR_TEST_CT, FD_MACH_ONLY,
+     aHpux_Math_ConstexprTests,   apzHpux_Math_ConstexprPatch, 0 },
+
   {  zHpux10_Ctype_Declarations1Name,    zHpux10_Ctype_Declarations1List,
      apzHpux10_Ctype_Declarations1Machs,
      HPUX10_CTYPE_DECLARATIONS1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 8400d0c696b..7605ac89aa2 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -2282,6 +2282,24 @@ fix = {
             "   }\n";
 };
 
+/*
+ * This hack fixes the declarations of _DINFINITY, _SINFINITY and _SQNAN.
+ */
+fix = {
+    hackname  = hpux_math_constexpr;
+    mach      = "*-hp-hpux11*";
+    files     = math.h;
+    sed       = "s@^[ \t]*extern[ \t]*const[ \t]*double[ \t]*_DINFINITY;"
+	"[ \t]*$@#  define _DINFINITY (__builtin_inf ())@";
+    sed       = "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SINFINITY;"
+	"[ \t]*$@#    define _SINFINITY (__builtin_inff ())@";
+    sed       = "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SQNAN;"
+	"[ \t]*$@#    define _SQNAN (__builtin_nanf (\\\"\\\"))@";
+    test_text = "  extern const double _DINFINITY;\n"
+		"  extern const float _SINFINITY;\n"
+		"  extern const float _SQNAN;";
+};
+
 /*
  *  Fix hpux 10.X missing ctype declarations 1
  */
diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h
index 7525fd82ecf..29b67579748 100644
--- a/fixincludes/tests/base/math.h
+++ b/fixincludes/tests/base/math.h
@@ -57,6 +57,13 @@
 #endif  /* HPUX11_CPP_POW_INLINE_CHECK */
 
 
+#if defined( HPUX_MATH_CONSTEXPR_CHECK )
+#  define _DINFINITY (__builtin_inf ())
+#    define _SINFINITY (__builtin_inff ())
+#    define _SQNAN (__builtin_nanf (""))
+#endif  /* HPUX_MATH_CONSTEXPR_CHECK */
+
+
 #if defined( HPUX11_FABSF_CHECK )
 #ifdef _PA_RISC
 #ifndef __cplusplus


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-27 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-27 19:48 [gcc r12-7397] Fix declarations of _DINFINITY, _SINFINITY and _SQNAN John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).