]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vxworks fixups
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Oct 2012 21:42:48 +0000 (21:42 +0000)
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Oct 2012 21:42:48 +0000 (21:42 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192898 138bc75d-0d04-0410-961f-82ee72b054a4

fixincludes/ChangeLog
fixincludes/fixinc.in
fixincludes/inclhack.def
fixincludes/mkfixinc.sh
fixincludes/tests/base/math.h
fixincludes/tests/base/sys/stat.h
fixincludes/tests/base/testing.h

index dea4a96927e67e284f4ce7e719b9c505058ae035..b41671093b883bd91e509eb0d302642d57b4fea3 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-29  Robert Mason  <rbmj@verizon.net>
+
+       * fixinc.in: Omit machine name checks for vxworks
+       * fixincludes/inclhack.def (AAB_vxworks_assert) new replacement fix
+       (AAB_vxworks_regs_vxtypes): another
+       (AAB_vxworks_stdint): yet another
+       (AAB_vxworks_unistd): and another
+       (vxworks_ioctl_macro): reformatting fix
+       (vxworks_mkdir_macro): again
+       (vxworks_regs): and again
+       (vxworks_write_const): and again
+       * tests/base/ioLib.h: new test result
+       * tests/base/math.h: likewise
+       * tests/base/sys/stat.h: likewise
+       * tests/base/testing.h: and again
+
 2012-09-29  David Edelsohn  <dje.gcc@gmail.com>
 
        * inclhack.def (AAB_aix_fcntl): New fix.
index e73aed99a1ba9bb52653e1a61e55b7413e4c4b63..f7b8d8f1ee3bf820e242926e3e2dd3d08336f655 100755 (executable)
@@ -126,6 +126,22 @@ else
   LINKS=false
 fi
 
+# # # # # # # # # # # # # # # # # # # # #
+#
+#  Check to see if the machine_name fix needs to be disabled.
+#
+#  On some platforms, machine_name doesn't work properly and
+#  breaks some of the header files.  Since everything works
+#  properly without it, just wipe the macro list to
+#  disable the fix.
+
+case "${target_canonical}" in
+    *-*-vxworks*)
+       test -f ${MACRO_LIST} &&  echo > ${MACRO_LIST}
+        ;;
+esac
+
+
 # # # # # # # # # # # # # # # # # # # # #
 #
 #  In the file macro_list are listed all the predefined
index a615194c743f685abb95e586f00b792fd8d71a02..cc7d790b886d1fddcf2e604c5dff89fccbd0d0f5 100644 (file)
@@ -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
index 89e8ab7d5f2b96a4a62d5eb2cbf5a7bf01525330..6653fedb6eb0a96663a8e3c0859c55be4690545c 100755 (executable)
@@ -15,7 +15,6 @@ case $machine in
     i?86-*-mingw32* | \
     x86_64-*-mingw32* | \
     i?86-*-interix* | \
-    *-*-vxworks* | \
     powerpc-*-eabisim* | \
     powerpc-*-eabi*    | \
     powerpc-*-rtems*   | \
index a97e88b32c8a83107b2181a35af3d10756899a92..766017280b585d915fd41e95e7a8b76bd2e79498 100644 (file)
 #endif
 
 
-#if defined( AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_2_CHECK )
-#include <architecture/ppc/math.h>
-#endif  /* AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_2_CHECK */
-
-
 #if defined( BROKEN_CABS_CHECK )
 #ifdef __STDC__
 
 #endif  /* BROKEN_CABS_CHECK */
 
 
+#if defined( DARWIN_9_LONG_DOUBLE_FUNCS_2_CHECK )
+#include <architecture/ppc/math.h>
+#endif  /* DARWIN_9_LONG_DOUBLE_FUNCS_2_CHECK */
+
+
 #if defined( HPPA_HPUX_FP_MACROS_CHECK )
 #endif /* _INCLUDE_HPUX_SOURCE */
 
index 240c308fdbcea3de79a87c8bcade6bfe05bc5d5e..9c81cff94bd6d9c3521770d48c267110c0e7b86c 100644 (file)
@@ -28,6 +28,13 @@ 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_NEEDS_VXWORKS_CHECK )
 #include </dev/null> /* ULONG */
 # define       __INCstath <sys/stat.h>
index f1ffeffa41a47733188766c8d6f64d799973b0d7..cf95321fb86d3564e1c7ca6d6aacc96cb6eff58a 100644 (file)
@@ -114,3 +114,9 @@ extern size_t
 #endif
 
 #endif  /* VMS_USE_PRAGMA_EXTERN_MODEL_CHECK */
+
+
+#if defined( VXWORKS_REGS_CHECK )
+#include <arch/../regs.h>
+
+#endif  /* VXWORKS_REGS_CHECK */