public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6609] Add VxWorks fixincludes hack, C99 FP classification
@ 2022-01-16  9:22 Olivier Hainque
  0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2022-01-16  9:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:00cc412660fe4d64c0b04da9ae20b1ad6ef92bb0

commit r12-6609-g00cc412660fe4d64c0b04da9ae20b1ad6ef92bb0
Author: Olivier Hainque <hainque@adacore.com>
Date:   Mon Jan 10 11:26:30 2022 +0000

    Add VxWorks fixincludes hack, C99 FP classification
    
    Arrange to provide missing defs for C99 FP classification functions
    and constants queried by libstdc++ configure checks (C99 support for C++98)
    
    2021-01-10  Olivier Hainque  <hainque@adacore.com>
    
            * inclhack.def (vxworks_math_h_fp_c99): New hack.
            * tests/base/math.h: Update.
            * fixincl.x: Regenerate.

Diff:
---
 fixincludes/fixincl.x         | 82 ++++++++++++++++++++++++++++++++++++++++---
 fixincludes/inclhack.def      | 50 ++++++++++++++++++++++++++
 fixincludes/tests/base/math.h | 34 ++++++++++++++++++
 3 files changed, 161 insertions(+), 5 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 87175fe0205..a83fa2f5819 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  6, 2022 at 11:59:22 AM by AutoGen 5.18.16
+ * It has been AutoGen-ed  January 15, 2022 at 10:53:02 PM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan  6 11:59:22 UTC 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:53:02 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 263 fixup descriptions.
+ * This file contains 264 fixup descriptions.
  *
  * See README for more information.
  *
@@ -10212,6 +10212,72 @@ static const char* apzVxworks_Ioctl_MacroPatch[] = {
     "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Vxworks_Math_H_Fp_C99 fix
+ */
+tSCC zVxworks_Math_H_Fp_C99Name[] =
+     "vxworks_math_h_fp_c99";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zVxworks_Math_H_Fp_C99List[] =
+  "math.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzVxworks_Math_H_Fp_C99Machs[] = {
+        "*-*-vxworks*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zVxworks_Math_H_Fp_C99Select0[] =
+       "#define HUGE_VAL[ \t]*_ARCH.*";
+
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zVxworks_Math_H_Fp_C99Bypass0[] =
+       "#define[ \t]+FP_INFINITE";
+
+#define    VXWORKS_MATH_H_FP_C99_TEST_CT  2
+static tTestDesc aVxworks_Math_H_Fp_C99Tests[] = {
+  { TT_NEGREP,   zVxworks_Math_H_Fp_C99Bypass0, (regex_t*)NULL },
+  { TT_EGREP,    zVxworks_Math_H_Fp_C99Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Vxworks_Math_H_Fp_C99
+ */
+static const char* apzVxworks_Math_H_Fp_C99Patch[] = {
+    "format",
+    "\n\
+%0\n\n\
+#if _C99\n\n\
+#define FP_INFINITE  1\n\
+#define FP_NAN       2\n\
+#define FP_NORMAL    (-1)\n\
+#define FP_SUBNORMAL (-2)\n\
+#define FP_ZERO      0\n\n\
+#define fpclassify(x) \\\n\
+  __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \\\n\
+\t\t       FP_SUBNORMAL, FP_ZERO, (x))\n\n\
+#define signbit(x) __builtin_signbit(x)\n\
+#define isfinite(x) __builtin_isfinite(x)\n\
+#define isnormal(x) __builtin_isnormal(x)\n\
+#define isnan(x) __builtin_isnan(x)\n\
+#define isinf(x) __builtin_isinf(x)\n\n\
+#define isgreater(x, y) __builtin_isgreater((x),(y))\n\
+#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y))\n\
+#define isless(x, y) __builtin_isless((x),(y))\n\
+#define islessequal(x, y) __builtin_islessequal((x),(y))\n\
+#define islessgreater(x, y) __builtin_islessgreater((x),(y))\n\
+#define isunordered(x, y) __builtin_isunordered((x),(y))\n\n\
+#endif /* _C99 */\n",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Vxworks_Posix_Mkdir fix
@@ -10690,9 +10756,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          301
+#define REGEX_COUNT          303
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            263
+#define FIX_COUNT            264
 
 /*
  *  Enumerate the fixes
@@ -10949,6 +11015,7 @@ typedef enum {
     VOID_NULL_FIXIDX,
     VXWORKS_GCC_PROBLEM_FIXIDX,
     VXWORKS_IOCTL_MACRO_FIXIDX,
+    VXWORKS_MATH_H_FP_C99_FIXIDX,
     VXWORKS_POSIX_MKDIR_FIXIDX,
     VXWORKS_NEEDS_VXTYPES_FIXIDX,
     VXWORKS_NEEDS_VXWORKS_FIXIDX,
@@ -12219,6 +12286,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      VXWORKS_IOCTL_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aVxworks_Ioctl_MacroTests,   apzVxworks_Ioctl_MacroPatch, 0 },
 
+  {  zVxworks_Math_H_Fp_C99Name,    zVxworks_Math_H_Fp_C99List,
+     apzVxworks_Math_H_Fp_C99Machs,
+     VXWORKS_MATH_H_FP_C99_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aVxworks_Math_H_Fp_C99Tests,   apzVxworks_Math_H_Fp_C99Patch, 0 },
+
   {  zVxworks_Posix_MkdirName,    zVxworks_Posix_MkdirList,
      apzVxworks_Posix_MkdirMachs,
      VXWORKS_POSIX_MKDIR_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 4643678026d..27564788561 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -5157,6 +5157,56 @@ fix = {
         
     test_text   = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
 };
+ 
+/*
+ * Provide C99 FP classification support in VxWorks math.h if
+ * not already there. Note the strict expectation on #define without
+ * whitespaces in the bypass expression, which "works" for
+ * the system headers we have met and doesn't match test texts for
+ * other hacks, found in the test baseline.
+ */
+fix = {
+    hackname  = vxworks_math_h_fp_c99;
+    mach      = "*-*-vxworks*";
+    files     = math.h;
+    bypass    = "#define[ \t]+FP_INFINITE";
+    select    = "#define HUGE_VAL[ \t]*_ARCH.*";
+    c_fix     = format;
+    c_fix_arg = << _EOArg_
+
+%0
+
+#if _C99
+
+#define FP_INFINITE  1
+#define FP_NAN       2
+#define FP_NORMAL    (-1)
+#define FP_SUBNORMAL (-2)
+#define FP_ZERO      0
+
+#define fpclassify(x) \
+  __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \
+		       FP_SUBNORMAL, FP_ZERO, (x))
+
+#define signbit(x) __builtin_signbit(x)
+#define isfinite(x) __builtin_isfinite(x)
+#define isnormal(x) __builtin_isnormal(x)
+#define isnan(x) __builtin_isnan(x)
+#define isinf(x) __builtin_isinf(x)
+
+#define isgreater(x, y) __builtin_isgreater((x),(y))
+#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y))
+#define isless(x, y) __builtin_isless((x),(y))
+#define islessequal(x, y) __builtin_islessequal((x),(y))
+#define islessgreater(x, y) __builtin_islessgreater((x),(y))
+#define isunordered(x, y) __builtin_isunordered((x),(y))
+
+#endif /* _C99 */
+
+_EOArg_;
+
+    test_text  = "#define HUGE_VAL _ARCH_HUGH_VAL";
+};
 
 /*
  *  mkdir's posix interface expects two arguments.  While the RTP VxWorks
diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h
index 58f695f9adf..7525fd82ecf 100644
--- a/fixincludes/tests/base/math.h
+++ b/fixincludes/tests/base/math.h
@@ -104,6 +104,40 @@ extern int class();
 int foo;
 #endif
 #endif  /* STRICT_ANSI_NOT_CTD_CHECK */
+
+
+#if defined( VXWORKS_MATH_H_FP_C99_CHECK )
+
+#define HUGE_VAL _ARCH_HUGH_VAL
+
+#if _C99
+
+#define FP_INFINITE  1
+#define FP_NAN       2
+#define FP_NORMAL    (-1)
+#define FP_SUBNORMAL (-2)
+#define FP_ZERO      0
+
+#define fpclassify(x) \
+  __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \
+		       FP_SUBNORMAL, FP_ZERO, (x))
+
+#define signbit(x) __builtin_signbit(x)
+#define isfinite(x) __builtin_isfinite(x)
+#define isnormal(x) __builtin_isnormal(x)
+#define isnan(x) __builtin_isnan(x)
+#define isinf(x) __builtin_isinf(x)
+
+#define isgreater(x, y) __builtin_isgreater((x),(y))
+#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y))
+#define isless(x, y) __builtin_isless((x),(y))
+#define islessequal(x, y) __builtin_islessequal((x),(y))
+#define islessgreater(x, y) __builtin_islessgreater((x),(y))
+#define isunordered(x, y) __builtin_isunordered((x),(y))
+
+#endif /* _C99 */
+
+#endif  /* VXWORKS_MATH_H_FP_C99_CHECK */
 #ifdef __cplusplus
 #undef exception
 #endif


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

only message in thread, other threads:[~2022-01-16  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16  9:22 [gcc r12-6609] Add VxWorks fixincludes hack, C99 FP classification Olivier Hainque

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