Hi all,

I have a new set of patches attached to this email. I've made a few changes since last time, and a full build works (finally, again).

-The ioctl patch removes superfluous parens (thanks Paolo)
-The mkdir patch has a more precise (or uglier, depending on your point of view :P) regex, and uses the variadic macro fix (thanks again Paolo) -It adds another fixincludes patch for vxworks *NOT GCC* regs.h as it doesn't include vxTypesOld.h, which it needs -The patch that adds the AC_ARG_ENABLE option to explicitly enable/disable libstdc++-v3 now has the argument changed from --disable-libstdc++-v3 to --disable-libstdcxx, as I was having weird issues and changing it seemed to work. If someone who has more experience with this than me (so anyone) knows that this should not make a difference than feel free to reject this change and I'll fall back to the old version. -The patch to allow machine_name to be skipped and enable fixincludes for vxworks is now *much* simpler (thanks Bruce) -There's a new patch to add NOMINMAX to libstdc++-v3/config/os/vxworks/os_defines.h to keep vxworks headers from defining min and max as macros.

Note that the open() patch is NOT changed as the suggested change does not work when also compiling libstdc++-v3. Passing the third argument explicitly won't break anything - it will just be ignored - and is the only resolution that has worked so far.

They're also not in the same order as I was rebasing quite a bit to try and keep history in sync.

Also, I'm hoping since this is the third (or fourth for some of these patches) time submitting them, hopefully they can eventually make their way in :D. Could someone please volunteer to commit once it is all approved?

Thank you all for the work you do on GCC, and the help you've given me to get my patches up to the standard!

Robert Mason
>From f1132398e72e73c549cb7f608a3a43c0f4801bc3 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 13:18:10 -0400
Subject: [PATCH 01/12] Added assert fixinclude hack for VxWorks.

VxWorks's assert.h relies on adjacent string tokens being joined,
and uses macros for some of the strings (e.g. __FILE__).  However,
it does not put a space after the end quote and before the macro,
so instead of replacing the macro, gcc >= 4.7.x thinks it's a
user-defined literal token, and since the lookup obviously fails,
compilation of libstdc++ dies.

This patch just replaces the assert.h header with another one that
will work.  It preserves the same format, just changes the spacing.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00385.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (AAB_vxworks_assert): Added fix.
        fixincl.x: Regenerate
---
 fixincludes/inclhack.def |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 82792af..a9d582d 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -354,6 +354,46 @@ 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_;
+};
+
 
 /*
  * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
-- 
1.7.10.4

>From 1220d34b665432ba238e1b58119576f66c015772 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 14:16:26 -0400
Subject: [PATCH 02/12] Add hack for ioctl() on VxWorks.

ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.  This way, the most common use case
of ioctl (with a const char * for the third argument) will compile
in C++, where pointers must be explicitly casted to int.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00389.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (vxworks_ioctl_macro): Added fix
        fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a9d582d..474c05e 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4411,6 +4411,22 @@ 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 ) ;";
+};
+
 
 /*
  *  Fix VxWorks <time.h> to not require including <vxTypes.h>.
-- 
1.7.10.4

>From 41d93e2d026b84cf08744cc1d5251abb09fb2ec5 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Sat, 23 Jun 2012 17:38:41 -0400
Subject: [PATCH 03/12] Added vxworks_mkdir_macro fix

This adds a macro to POSIX-ify VxWorks' mkdir() function by
including a macro that wraps the function and takes an (ignored,
but still evaluated) mode argument.

When combined with another patch this patch resolves 53462

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01548.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01591.html

Changes:

[fixincludes]
        inclhack.def (vxworks_mkdir_macro): add hack
        fixincl.x: Regenerate
---
 fixincludes/inclhack.def |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 474c05e..41379ee 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4427,6 +4427,25 @@ fix = {
        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>.
-- 
1.7.10.4

>From d3c58125e841cc63cfefb8914817ce07bda33719 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 14:07:32 -0400
Subject: [PATCH 04/12] Add fix to prevent inclusion of regs.h on VxWorks.

VxWorks has it's own regs.h that conflicts with GCC's regs.h, so
just make any replace any references to regs.h in VxWorks with
references to arch/../regs.h, which includes the VxWorks header,
not GCC's header.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00388.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (vxworks_regs): Added fix
        fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 41379ee..a8a938b 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4479,6 +4479,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>.
-- 
1.7.10.4

>From 0a080c7019d05088bd59d3ef1fd959375d720a5d Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 13:26:57 -0400
Subject: [PATCH 05/12] Add stdint.h wrapper for VxWorks.

Vxworks stdint.h doesn't have all the typedefs needed for standards
compliance, so add a hack that adds all of the needed typedefs to be
fully compliant to the standard.  Fixes broken libstdc++.

There was additional discussion of adding the necessary macros to get
gcc to have built-in recognition of the types, but I could not get that
to work.  That is also non-essential to this patch, which is primarily
to fix a bug caused by relying on types in stdint.h that vxworks does
not define.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00386.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (AAB_vxworks_stdint): Added fix
        fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a8a938b..6cdda19 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -396,6 +396,50 @@ fix = {
 
 
 /*
+ * 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>
+
+       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;
+       #endif
+       _EndOfHeader_;
+};
+
+
+/*
  * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
  * which only is provided by AIX xlc C99.
  */
-- 
1.7.10.4

>From 02c6bea13dcc3877d31e871a49affe278eb0656c Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 14:02:08 -0400
Subject: [PATCH 06/12] Add unistd.h wrapper for VxWorks.

On VxWorks, unistd.h doesn't define everything it should, like
read/write, etc.  This wrapper adds the things it should define
so everything can be compliant and compile correctly without
manual modification.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00387.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (AAB_vxworks_unistd): Added fix
        fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 6cdda19..a07a317 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -438,6 +438,32 @@ fix = {
        _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,
-- 
1.7.10.4

>From d75e997a41f3cfeec2f48bac19c4cddd9466b980 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 14:21:37 -0400
Subject: [PATCH 07/12] Add fix to make write() const correct on VxWorks

VxWorks' write() takes its second argument as non-const, so the
compiler complains if one tries to pass a const pointer to it.
This simply changes the prototype to say it is const so everything
works.  I believe that the prototype is non-const for backwards
compatibility with old verisons of vxworks, but these versions are
not supported by modern GCC, so causing potential bugs on those
platforms is a non-issue.  Modern vxworks will not modify the string
passed to it, so just changing the prototype will work silently.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00390.html
Approved by Nathan Sidwell: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00549.html
Approved by Bruce Korb: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00552.html

Changes:

[fixincludes]
        inclhack.def (vxworks_write_const):  Added fix
        fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a07a317..8039407 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4590,6 +4590,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
-- 
1.7.10.4

>From 44d6cf3c8925fe25385ebad6208dbdbda647279e Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Tue, 22 May 2012 16:32:02 -0400
Subject: [PATCH 08/12] Added --enable-libstdcxx option.

This patch allows the user to force enable/disable building of
libstdc++-v3 with a --enable-libstdcxx option to be congruent
with the other runtime library options.

The side effect of this, and the main motivation for this patch, is
to allow the user to force compilation of libstdc++-v3 for targets
that do not currently enable building libstdc++-v3 by default.  The
configure-time override is useful when trying to override the stock
runtime library on embedded systems that have their own C++ library.

Please note that although this is a patch that pertains to libstdc++-v3,
it is a patch over top-level configure, NOT libstdc++-v3/configure.

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01525.html
Approved by Paolo Bonzini: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00585.html

Changes:
        configure.ac: add --enable-libstdcxx option
        configure: regenerate
---
 configure.ac |   38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 27692b4..f8d9c50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -426,6 +426,15 @@ AC_ARG_ENABLE(libssp,
 ENABLE_LIBSSP=$enableval,
 ENABLE_LIBSSP=yes)
 
+AC_ARG_ENABLE(libstdcxx,
+AS_HELP_STRING([--disable-libstdcxx],
+  [do not build libstdc++-v3 directory]),
+ENABLE_LIBSTDCXX=$enableval,
+ENABLE_LIBSTDCXX=default)
+if test "${ENABLE_LIBSTDCXX}" = "no" ; then
+  noconfigdirs="$noconfigdirs libstdc++-v3"
+fi
+
 # Save it here so that, even in case of --enable-libgcj, if the Java
 # front-end isn't enabled, we still get libgcj disabled.
 libgcj_saved=$libgcj
@@ -545,19 +554,22 @@ case "${target}" in
 esac
 
 # Disable libstdc++-v3 for some systems.
-case "${target}" in
-  *-*-vxworks*)
-    # VxWorks uses the Dinkumware C++ library.
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-  arm*-wince-pe*)
-    # the C++ libraries don't build on top of CE's C libraries
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-  avr-*-*)
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-esac
+# Allow user to override this if they pass --enable-libstdc++-v3
+if test "${ENABLE_LIBSTDCXX}" = "default" ; then
+  case "${target}" in
+    *-*-vxworks*)
+      # VxWorks uses the Dinkumware C++ library.
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+    arm*-wince-pe*)
+      # the C++ libraries don't build on top of CE's C libraries
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+    avr-*-*)
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+  esac
+fi
 
 # Disable Fortran for some systems.
 case "${target}" in
-- 
1.7.10.4

>From 59c98ade3b1441dc03510f16f4aa80868623abdd Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Fri, 24 Aug 2012 15:32:10 -0400
Subject: [PATCH 09/12] Add ability to skip the machine_name fixincludes fix.

This patch adds the ability to skip the machine_name fixincludes
fix in fixinc.in by wiping the macro list.

It also removes vxworks from the list of no-op fix platforms in
order to allow necessary include fixes to allow a successful
build of the latest GCC.
---
 fixincludes/fixinc.in   |   16 ++++++++++++++++
 fixincludes/mkfixinc.sh |    1 -
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index e73aed9..f7b8d8f 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -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
diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
index 89e8ab7..6653fed 100755
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -15,7 +15,6 @@ case $machine in
     i?86-*-mingw32* | \
     x86_64-*-mingw32* | \
     i?86-*-interix* | \
-    *-*-vxworks* | \
     powerpc-*-eabisim* | \
     powerpc-*-eabi*    | \
     powerpc-*-rtems*   | \
-- 
1.7.10.4

>From 82a7ada4b7ce35c45fc535b70427f742f353a21c Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Wed, 22 Aug 2012 17:29:39 -0400
Subject: [PATCH 10/12] Make open() call more compatible in gcc/gcov-io.c

In gcc/gcov-io.c, the call to open() only has two arguments. This
is fine, as long as the system open() is standards compliant.
However, on at least one system (vxworks real time processes),
open() is a non-variadic function, so the call fails.  This adds
a third argument passed unconditionally to open for compatibility
with non-variadic open().  On systems with variadic open(), the
extra argument should just be ignored anyway.

When combined with one other patch this patch resolves 53264

Proposed by Robert Mason: 
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01508.html
Approved by None (Obvious)

Changes:

[gcc]
        gcov-io.c (gcov_open): Pass mode to open() unconditionally
---
 gcc/gcov-io.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c
index 37c1c3e..28ed52f 100644
--- a/gcc/gcov-io.c
+++ b/gcc/gcov-io.c
@@ -92,7 +92,8 @@ gcov_open (const char *name, int mode)
     {
       /* Read-only mode - acquire a read-lock.  */
       s_flock.l_type = F_RDLCK;
-      fd = open (name, O_RDONLY);
+      /* pass mode (ignored) for compatibility */
+      fd = open (name, O_RDONLY, S_IRUSR | S_IWUSR);
     }
   else
     {
-- 
1.7.10.4

>From 8e625b322e3503eb7336fc5f20139f41e249ad41 Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Thu, 30 Aug 2012 14:30:31 -0400
Subject: [PATCH 11/12] Added some needed includes for vxworks

Added AAB_vxworks_regs_vxtypes fix.
---
 fixincludes/inclhack.def |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 8039407..cf3c212 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -394,6 +394,23 @@ fix = {
        _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
@@ -408,7 +425,9 @@ fix = {
        #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;
 
-- 
1.7.10.4

>From f7c90f2bad10898b8988c6caffef8c5b30b56e3c Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Sat, 1 Sep 2012 23:45:51 -0400
Subject: [PATCH 12/12] Added NOMINMAX to vxworks os_defines.h

VxWorks defines min and max as macros, but allows this behavior
to be disabled by defining NOMINMAX.  This adds that definition
to libstdc++-v3's vxworks os_defines.h so that whenever C++
code is being compiled these macros are not defined and the
standard versions of min and max will be used instead.
---
 libstdc++-v3/config/os/vxworks/os_defines.h |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/config/os/vxworks/os_defines.h 
b/libstdc++-v3/config/os/vxworks/os_defines.h
index c66063e..93ad1d4 100644
--- a/libstdc++-v3/config/os/vxworks/os_defines.h
+++ b/libstdc++-v3/config/os/vxworks/os_defines.h
@@ -33,4 +33,10 @@
 // System-specific #define, typedefs, corrections, etc, go here.  This
 // file will come before all others.
 
+//Keep vxWorks from defining min()/max() as macros
+#ifdef NOMINMAX
+#undef NOMINMAX
+#endif
+#define NOMINMAX 1
+
 #endif
-- 
1.7.10.4

Reply via email to