Commit 1d5d667b by Robert Mason Committed by Bruce Korb

vxworks fixups

From-SVN: r192898
parent c5cd5a7e
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.
......
......@@ -128,6 +128,22 @@ 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
# macros that are not in the C89 reserved namespace (the reserved
# namespace is all identifiers beginnning with two underscores or one
......
......@@ -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
......
......@@ -15,7 +15,6 @@ case $machine in
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
i?86-*-interix* | \
*-*-vxworks* | \
powerpc-*-eabisim* | \
powerpc-*-eabi* | \
powerpc-*-rtems* | \
......
......@@ -15,11 +15,6 @@
#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__
......@@ -30,6 +25,11 @@
#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 */
......
......@@ -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>
......
......@@ -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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment