public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] hpux: New include hack to fix declarations of _DINFINITY, _SINFINITY and _SQNAN
@ 2022-02-27 19:57 John David Anglin
  0 siblings, 0 replies; only message in thread
From: John David Anglin @ 2022-02-27 19:57 UTC (permalink / raw)
  To: GCC Patches; +Cc: Bruce Korb

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

The declarations of _DINFINITY, _SINFINITY and _SQNAN need to be constant
expressions.

Committed to trunk.

Dave
---

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 --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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

only message in thread, other threads:[~2022-02-27 19:57 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:57 [COMMITTED] hpux: New include hack to 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).