]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add VxWorks fixincludes hack, C99 FP classification
authorOlivier Hainque <hainque@adacore.com>
Mon, 10 Jan 2022 11:26:30 +0000 (11:26 +0000)
committerOlivier Hainque <hainque@adacore.com>
Sun, 16 Jan 2022 09:22:14 +0000 (09:22 +0000)
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.

fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/math.h

index 87175fe0205be250821ebd4c02d44804f8b89669..a83fa2f58194f3b3d21f0bce816d797a6078ceee 100644 (file)
@@ -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,
index 4643678026dfaf0394aaeca19dc32d36813dc6cb..275647885612216feef6e1f94e7696ecda012187 100644 (file)
@@ -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
index 58f695f9adfb3d3b873127cc60736a0a27d06750..7525fd82ecf055f0ae4f81738cf7699e075a394a 100644 (file)
@@ -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