]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Adjust VxWorks fixincludes hack for mkdir to work for C++
authorOlivier Hainque <hainque@adacore.com>
Tue, 14 Jan 2020 10:25:35 +0000 (10:25 +0000)
committerOlivier Hainque <hainque@adacore.com>
Tue, 4 Jan 2022 10:27:11 +0000 (10:27 +0000)
For VxWorks, replace an attempt at providing a posix API for
mkdir via macro by a varargs prototype, which works better for
C++ references like std::mkdir(arg1, arg2).

2021-12-16  Olivier Hainque  <hainque@adacore.com>

fixincludes/
* inclhack.def (vxworks_posix_mkdir): Refine to expose a
varargs interface.
* tests/base/sys/stat.h: Update expected results.
* fixincl.x: Regenerate.

fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/sys/stat.h

index cb83f012a2f41a08c61fb053de4d355a2c3d2db9..16b15c045d0da8ea447d19a5989ec687942cdb0f 100644 (file)
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  January  1, 2022 at 11:58:02 AM by AutoGen 5.18.16
+ * It has been AutoGen-ed  January  4, 2022 at 10:24:34 AM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan  1 11:58:02 CET 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Jan  4 10:24:34 UTC 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -10214,32 +10214,31 @@ static const char* apzVxworks_Ioctl_MacroPatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
- *  Description of Vxworks_Mkdir_Macro fix
+ *  Description of Vxworks_Posix_Mkdir fix
  */
-tSCC zVxworks_Mkdir_MacroName[] =
-     "vxworks_mkdir_macro";
+tSCC zVxworks_Posix_MkdirName[] =
+     "vxworks_posix_mkdir";
 
 /*
  *  File name selection pattern
  */
-tSCC zVxworks_Mkdir_MacroList[] =
+tSCC zVxworks_Posix_MkdirList[] =
   "sys/stat.h\0";
 /*
  *  Machine/OS name selection pattern
  */
-tSCC* apzVxworks_Mkdir_MacroMachs[] = {
+tSCC* apzVxworks_Posix_MkdirMachs[] = {
         "*-*-vxworks*",
         (const char*)NULL };
-#define VXWORKS_MKDIR_MACRO_TEST_CT  0
-#define aVxworks_Mkdir_MacroTests   (tTestDesc*)NULL
+#define VXWORKS_POSIX_MKDIR_TEST_CT  0
+#define aVxworks_Posix_MkdirTests   (tTestDesc*)NULL
 
 /*
- *  Fix Command Arguments for Vxworks_Mkdir_Macro
+ *  Fix Command Arguments for Vxworks_Posix_Mkdir
  */
-static const char* apzVxworks_Mkdir_MacroPatch[] = {
+static const char* apzVxworks_Posix_MkdirPatch[] = {
     "format",
-    "%0\n\
-#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n",
+    "extern STATUS mkdir(const char *dir, ...);",
     "extern[\t ]+STATUS[\t ]+mkdir[\t ]*\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*(|[_[:alpha:]][_[:alnum:]]*)\\)[\t ]*;",
     (char*)NULL };
 
@@ -10908,7 +10907,7 @@ typedef enum {
     VOID_NULL_FIXIDX,
     VXWORKS_GCC_PROBLEM_FIXIDX,
     VXWORKS_IOCTL_MACRO_FIXIDX,
-    VXWORKS_MKDIR_MACRO_FIXIDX,
+    VXWORKS_POSIX_MKDIR_FIXIDX,
     VXWORKS_NEEDS_VXTYPES_FIXIDX,
     VXWORKS_NEEDS_VXWORKS_FIXIDX,
     VXWORKS_REGS_FIXIDX,
@@ -12177,10 +12176,10 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      VXWORKS_IOCTL_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aVxworks_Ioctl_MacroTests,   apzVxworks_Ioctl_MacroPatch, 0 },
 
-  {  zVxworks_Mkdir_MacroName,    zVxworks_Mkdir_MacroList,
-     apzVxworks_Mkdir_MacroMachs,
-     VXWORKS_MKDIR_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
-     aVxworks_Mkdir_MacroTests,   apzVxworks_Mkdir_MacroPatch, 0 },
+  {  zVxworks_Posix_MkdirName,    zVxworks_Posix_MkdirList,
+     apzVxworks_Posix_MkdirMachs,
+     VXWORKS_POSIX_MKDIR_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aVxworks_Posix_MkdirTests,   apzVxworks_Posix_MkdirPatch, 0 },
 
   {  zVxworks_Needs_VxtypesName,    zVxworks_Needs_VxtypesList,
      apzVxworks_Needs_VxtypesMachs,
index e2987c9c2ff2c163045d2411106631ce90c39f52..8f056adef68216f890d5e82253afe1581d02c17f 100644 (file)
@@ -5159,21 +5159,23 @@ fix = {
 };
 
 /*
- *  Wrap VxWorks mkdir to be posix compliant
+ *  mkdir's posix interface expects two arguments.  While the RTP VxWorks
+ *  API is fine, the kernel version handles only one.  We used to expose
+ *  a macro and this didn't play nice with uses such as posix:mkdir(x, y)
+ *  in libstdc++, so we expose a vararg prototype instead.
  */
 fix = {
-    hackname    = vxworks_mkdir_macro;
+    hackname    = vxworks_posix_mkdir;
     files       = sys/stat.h;
     mach        = "*-*-vxworks*";
 
     c_fix       = format;
-    c_fix_arg   = "%0\n"
-                "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
+    c_fix_arg   = "extern STATUS mkdir(const char *dir, ...);";
     c_fix_arg   = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
                 "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
                 "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
                 "\\)[\t ]*;";
-        
+
     test_text   = "extern STATUS mkdir (const char * _qwerty) ;";
 };
 
index 9c81cff94bd6d9c3521770d48c267110c0e7b86c..cf86e5d169e660ba4e9d69a497d344d65d15a466 100644 (file)
@@ -28,11 +28,9 @@ extern int fchmod(int, mode_t);
 #endif  /* RS6000_FCHMOD_CHECK */
 
 
-#if defined( VXWORKS_MKDIR_MACRO_CHECK )
-extern STATUS mkdir (const char * _qwerty) ;
-#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))
-
-#endif  /* VXWORKS_MKDIR_MACRO_CHECK */
+#if defined( VXWORKS_POSIX_MKDIR_CHECK )
+extern STATUS mkdir(const char *dir, ...);
+#endif  /* VXWORKS_POSIX_MKDIR_CHECK */
 
 
 #if defined( VXWORKS_NEEDS_VXWORKS_CHECK )