aboutsummaryrefslogtreecommitdiff
path: root/fixincludes/inclhack.def
diff options
context:
space:
mode:
Diffstat (limited to 'fixincludes/inclhack.def')
-rw-r--r--fixincludes/inclhack.def266
1 files changed, 266 insertions, 0 deletions
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a615194..cc7d790 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -393,6 +393,206 @@ fix = {
_EndOfHeader_;
};
+/*
+ * Fix assert.h on VxWorks:
+ */
+fix = {
+ hackname = AAB_vxworks_assert;
+ files = assert.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _ASSERT_H
+ #define _ASSERT_H
+
+ #ifdef assert
+ #undef assert
+ #endif
+
+ #if defined(__STDC__) || defined(__cplusplus)
+ extern void __assert (const char*);
+ #else
+ extern void __assert ();
+ #endif
+
+ #ifdef NDEBUG
+ #define assert(ign) ((void)0)
+ #else
+
+ #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
+ #define ASSERT_STRINGIFY_HELPER(str) #str
+
+ #define assert(test) ((void) \
+ ((test) ? ((void)0) : \
+ __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
+ __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
+
+ #endif
+
+ #endif
+ _EndOfHeader_;
+};
+
+/*
+ * Add needed include to regs.h (NOT the gcc header) on VxWorks
+ */
+
+fix = {
+ hackname = AAB_vxworks_regs_vxtypes;
+ files = regs.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _REGS_H
+ #define _REGS_H
+ #include <types/vxTypesOld.h>
+ #include_next <arch/../regs.h>
+ #endif
+ _EndOfHeader_;
+};
+
+/*
+ * Make VxWorks stdint.h a bit more compliant - add typedefs
+ */
+fix = {
+ hackname = AAB_vxworks_stdint;
+ files = stdint.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _STDINT_H
+ #define _STDINT_H
+ /* get int*_t, uint*_t */
+ #include <types/vxTypes.h>
+
+ /* get legacy vxworks types for compatibility */
+ #include <types/vxTypesOld.h>
+
+ typedef long intptr_t;
+ typedef unsigned long uintptr_t;
+
+ typedef int64_t intmax_t;
+ typedef uint64_t uintmax_t;
+
+ typedef int8_t int_least8_t;
+ typedef int16_t int_least16_t;
+ typedef int32_t int_least32_t;
+ typedef int64_t int_least64_t;
+
+ typedef uint8_t uint_least8_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint32_t uint_least32_t;
+ typedef uint64_t uint_least64_t;
+
+ typedef int8_t int_fast8_t;
+ typedef int int_fast16_t;
+ typedef int32_t int_fast32_t;
+ typedef int64_t int_fast64_t;
+
+ typedef uint8_t uint_fast8_t;
+ typedef unsigned int uint_fast16_t;
+ typedef uint32_t uint_fast32_t;
+ typedef uint64_t uint_fast64_t;
+
+ /* Ranges */
+ #define UINT8_MAX (~(uint8_t)0)
+ #define UINT8_MIN 0
+ #define UINT16_MAX (~(uint16_t)0)
+ #define UINT16_MIN 0
+ #define UINT32_MAX (~(uint32_t)0)
+ #define UINT32_MIN 0
+ #define UINT64_MAX (~(uint64_t)0)
+ #define UINT64_MIN 0
+
+ #define UINTPTR_MAX (~(uintptr_t)0)
+ #define UINTPTR_MIN 0
+
+ /* Need to do int_fast16_t as well, as type
+ size may be architecture dependent */
+ #define UINT_FAST16_MAX (~(uint_fast16_t)0)
+ #define UINT_FAST16_MAX 0
+
+ #define INT8_MAX (UINT8_MAX>>1)
+ #define INT8_MIN (INT8_MAX+1)
+ #define INT16_MAX (UINT16_MAX>>1)
+ #define INT16_MIN (INT16_MAX+1)
+ #define INT32_MAX (UINT32_MAX>>1)
+ #define INT32_MIN (INT32_MAX+1)
+ #define INT64_MAX (UINT64_MAX>>1)
+ #define INT64_MIN (INT64_MAX+1)
+
+ #define INTPTR_MAX (UINTPTR_MAX>>1)
+ #define INTPTR_MIN (INTPTR_MAX+1)
+
+ #define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
+ #define INT_FAST16_MIN (INT_FAST16_MAX+1)
+
+ /* now define equiv. constants */
+ #define UINT_FAST8_MAX UINT8_MAX
+ #define UINT_FAST8_MIN UINT_FAST8_MIN
+ #define INT_FAST8_MAX INT8_MAX
+ #define INT_FAST8_MIN INT8_MIN
+ #define UINT_FAST32_MAX UINT32_MAX
+ #define UINT_FAST32_MIN UINT32_MIN
+ #define INT_FAST32_MAX INT32_MAX
+ #define INT_FAST32_MIN INT32_MIN
+ #define UINT_FAST64_MAX UINT64_MAX
+ #define UINT_FAST64_MIN UINT64_MIN
+ #define INT_FAST64_MAX INT64_MAX
+ #define INT_FAST64_MIN INT64_MIN
+
+ #define UINT_LEAST8_MAX UINT8_MAX
+ #define UINT_LEAST8_MIN UINT8_MIN
+ #define INT_LEAST8_MAX INT8_MAX
+ #define INT_LEAST8_MIN INT8_MIN
+ #define UINT_LEAST16_MAX UINT16_MAX
+ #define UINT_LEAST16_MIN UINT16_MIN
+ #define INT_LEAST16_MAX INT16_MAX
+ #define INT_LEAST16_MIN INT16_MIN
+ #define UINT_LEAST32_MAX UINT32_MAX
+ #define UINT_LEAST32_MIN UINT32_MIN
+ #define INT_LEAST32_MAX INT32_MAX
+ #define INT_LEAST32_MIN INT32_MIN
+ #define UINT_LEAST64_MAX UINT64_MAX
+ #define UINT_LEAST64_MIN UINT64_MIN
+ #define INT_LEAST64_MAX INT64_MAX
+ #define INT_LEAST64_MIN INT64_MIN
+
+ #define UINTMAX_MAX UINT64_MAX
+ #define UINTMAX_MIN UINT64_MIN
+ #define INTMAX_MAX INT64_MAX
+ #define INTMAX_MIN INT64_MIN
+
+ #endif
+ _EndOfHeader_;
+};
+
+/*
+ * This hack makes makes unistd.h more POSIX-compliant on VxWorks
+ */
+fix = {
+ hackname = AAB_vxworks_unistd;
+ files = unistd.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _UNISTD_H
+ #define _UNISTD_H
+ #include_next <unistd.h>
+ #include <ioLib.h>
+ #ifndef STDIN_FILENO
+ #define STDIN_FILENO 0
+ #endif
+ #ifndef STDOUT_FILENO
+ #define STDOUT_FILENO 1
+ #endif
+ #ifndef STDERR_FILENO
+ #define STDERR_FILENO 2
+ #endif
+ #endif /* _UNISTD_H */
+ _EndOfHeader_;
+};
+
/*
* complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
@@ -4410,6 +4610,41 @@ fix = {
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
};
+/*
+ * Wrap VxWorks ioctl to keep everything pretty
+ */
+fix = {
+ hackname = vxworks_ioctl_macro;
+ files = ioLib.h;
+ mach = "*-*-vxworks*";
+
+ c_fix = format;
+ c_fix_arg = "%0\n"
+ "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
+ c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
+
+ test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
+};
+
+/*
+ * Wrap VxWorks mkdir to be posix compliant
+ */
+fix = {
+ hackname = vxworks_mkdir_macro;
+ 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[\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) ;";
+};
+
/*
* Fix VxWorks <time.h> to not require including <vxTypes.h>.
@@ -4443,6 +4678,20 @@ fix = {
"# define\t__INCstath <sys/stat.h>";
};
+/*
+ * Make it so VxWorks does not include gcc/regs.h accidentally
+ */
+fix = {
+ hackname = vxworks_regs;
+ mach = "*-*-vxworks*";
+
+ select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
+ c_fix = format;
+ c_fix_arg = "#include <arch/../regs.h>";
+
+ test_text = "#include <regs.h>\n";
+};
+
/*
* Another bad dependency in VxWorks 5.2 <time.h>.
@@ -4470,6 +4719,23 @@ fix = {
"#define VOIDFUNCPTR (void(*)())";
};
+/*
+ * This hack makes write const-correct on VxWorks
+ */
+fix = {
+ hackname = vxworks_write_const;
+ files = ioLib.h;
+ mach = "*-*-vxworks*";
+
+ c_fix = format;
+ c_fix_arg = "extern int write (int, const char*, size_t);";
+ c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
+ "[\t ]*int[\t ]*,"
+ "[\t ]*char[\t ]*\\*[\t ]*,"
+ "[\t ]*size_t[\t ]*\\)[\t ]*;";
+
+ test_text = "extern int write ( int , char * , size_t ) ;";
+};
/*
* There are several name conflicts with C++ reserved words in X11 header