aboutsummaryrefslogtreecommitdiff
path: root/fixincludes/inclhack.def
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2020-01-14 10:46:42 +0000
committerOlivier Hainque <hainque@adacore.com>2022-01-16 09:22:14 +0000
commit9d7e19255c06e05ad791e9bf5aefc4783a12c4f9 (patch)
tree91fcd21a49ed8f11db1fae5e2502a95df489ed83 /fixincludes/inclhack.def
parent943fad67028c7164ddf9f818877394f74c06f254 (diff)
downloadgcc-9d7e19255c06e05ad791e9bf5aefc4783a12c4f9.zip
gcc-9d7e19255c06e05ad791e9bf5aefc4783a12c4f9.tar.gz
gcc-9d7e19255c06e05ad791e9bf5aefc4783a12c4f9.tar.bz2
Add VxWorks fixincludes hack, open posix API for C++
When system headers expose a strict "open" prototype with 3 args, arrange to expose a C++ overload with only two. 2021-01-10 Olivier Hainque <hainque@adacore.com> * inclhack.def (vxworks_math_h_fp_c99): New hack. * tests/base/fcntl.h: Update. * fixincl.x: Regenerate.
Diffstat (limited to 'fixincludes/inclhack.def')
-rw-r--r--fixincludes/inclhack.def41
1 files changed, 41 insertions, 0 deletions
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 = {