aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fixincludes/fixincl.x63
-rw-r--r--fixincludes/inclhack.def41
-rw-r--r--fixincludes/tests/base/fcntl.h33
3 files changed, 132 insertions, 5 deletions
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 4389ac8..b5cea5a 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:53:57 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed January 15, 2022 at 10:54:24 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:53:57 UTC 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:54:24 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 265 fixup descriptions.
+ * This file contains 266 fixup descriptions.
*
* See README for more information.
*
@@ -10471,6 +10471,53 @@ static const char* apzVxworks_RegsPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Vxworks_Posix_Open fix
+ */
+tSCC zVxworks_Posix_OpenName[] =
+ "vxworks_posix_open";
+
+/*
+ * File name selection pattern
+ */
+tSCC zVxworks_Posix_OpenList[] =
+ "fcntl.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzVxworks_Posix_OpenMachs[] = {
+ "*-*-vxworks*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zVxworks_Posix_OpenSelect0[] =
+ "extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);";
+
+#define VXWORKS_POSIX_OPEN_TEST_CT 1
+static tTestDesc aVxworks_Posix_OpenTests[] = {
+ { TT_EGREP, zVxworks_Posix_OpenSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Vxworks_Posix_Open
+ */
+static const char* apzVxworks_Posix_OpenPatch[] = {
+ "format",
+ "%0\n\n\
+#if defined(__cplusplus)\n\
+extern \"C++\" {\n\
+ inline int open (const char *, int) __attribute__((__always_inline__));\n\n\
+ inline int\n\
+ open (const char *name, int flags)\n\
+ {\n\
+ return open (name, flags, 0);\n\
+ }\n\
+}\n\
+#endif\n",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Vxworks_Time fix
*/
tSCC zVxworks_TimeName[] =
@@ -10795,9 +10842,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 304
+#define REGEX_COUNT 305
#define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT 265
+#define FIX_COUNT 266
/*
* Enumerate the fixes
@@ -11060,6 +11107,7 @@ typedef enum {
VXWORKS_NEEDS_VXWORKS_FIXIDX,
VXWORKS_NEXT_YVALS_FIXIDX,
VXWORKS_REGS_FIXIDX,
+ VXWORKS_POSIX_OPEN_FIXIDX,
VXWORKS_TIME_FIXIDX,
VXWORKS_WRITE_CONST_FIXIDX,
VXWORKS_IOLIB_INCLUDE_UNISTD_FIXIDX,
@@ -12356,6 +12404,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
VXWORKS_REGS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aVxworks_RegsTests, apzVxworks_RegsPatch, 0 },
+ { zVxworks_Posix_OpenName, zVxworks_Posix_OpenList,
+ apzVxworks_Posix_OpenMachs,
+ VXWORKS_POSIX_OPEN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aVxworks_Posix_OpenTests, apzVxworks_Posix_OpenPatch, 0 },
+
{ zVxworks_TimeName, zVxworks_TimeList,
apzVxworks_TimeMachs,
VXWORKS_TIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 60d7fd6..8400d0c 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -5297,6 +5297,47 @@ fix = {
};
/*
+ * Likewise, open's posix interface allows two or three arguments and
+ * some VxWorks headers expose only a strict 3 arguments version. Merely
+ * changing the prototype into a varargs one is risky as the implementation
+ * would receive garbage in the third arg for calls providing only two,
+ * which libstdc++ does. We simply provide an always inline overload for C++
+ * instead.
+ *
+ * Both fcntl.h and ioLib.h might "feature" such a prototype for _WRS_KERNEL.
+ * The latter #includes the former though (since 1992 according to the embedded
+ * log), so just leave ioLib.h alone.
+ */
+fix = {
+ hackname = vxworks_posix_open;
+ mach = "*-*-vxworks*";
+ files = fcntl.h;
+
+ select = "extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);";
+ c_fix = format;
+ c_fix_arg = << _EOArg_
+%0
+
+#if defined(__cplusplus)
+extern "C++" {
+ inline int open (const char *, int) __attribute__((__always_inline__));
+
+ inline int
+ open (const char *name, int flags)
+ {
+ return open (name, flags, 0);
+ }
+}
+#endif
+
+_EOArg_;
+
+ test_text =
+ "extern int open (const char *, int, int);\n"
+ "extern int open (const char *name, int flags, int mode );\n";
+};
+
+/*
* Another bad dependency in VxWorks 5.2 <time.h>.
*/
fix = {
diff --git a/fixincludes/tests/base/fcntl.h b/fixincludes/tests/base/fcntl.h
index 3a40c01..fe0e56a 100644
--- a/fixincludes/tests/base/fcntl.h
+++ b/fixincludes/tests/base/fcntl.h
@@ -18,6 +18,39 @@ extern "C" {
#if defined( AAB_AIX_FCNTL_CHECK )
#endif /* AAB_AIX_FCNTL_CHECK */
+
+
+#if defined( VXWORKS_POSIX_OPEN_CHECK )
+extern int open (const char *, int, int);
+
+#if defined(__cplusplus)
+extern "C++" {
+ inline int open (const char *, int) __attribute__((__always_inline__));
+
+ inline int
+ open (const char *name, int flags)
+ {
+ return open (name, flags, 0);
+ }
+}
+#endif
+
+extern int open (const char *name, int flags, int mode );
+
+#if defined(__cplusplus)
+extern "C++" {
+ inline int open (const char *, int) __attribute__((__always_inline__));
+
+ inline int
+ open (const char *name, int flags)
+ {
+ return open (name, flags, 0);
+ }
+}
+#endif
+
+
+#endif /* VXWORKS_POSIX_OPEN_CHECK */
#ifdef __cplusplus
}
#endif