]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fixincludes: vxworks: regs.h: Fix includes in regs.h wrapper
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Tue, 16 Oct 2018 09:40:27 +0000 (11:40 +0200)
committerRasmus Villemoes <villemoes@gcc.gnu.org>
Tue, 16 Oct 2018 09:40:27 +0000 (09:40 +0000)
A quick experiment reveals that this hack is needed for C code - simply
removing this hack entirely breaks the build of libstdc++, since
regs.h (more accurately, the cpu-specific header it pulls in) defines
structs in terms of types from vxTypesOld. Those definitions are
properly guarded by #ifndef _ASMLANGUAGE, but the cpu-files do not take
care to include vxTypesOld.h for the types they depend on.

But when using regs.h from some assembly file, the assembler chokes on
the typedefs in vxTypesOld.h. We can fix that by guarding the include of
vxTypesOld by !_ASMLANGUAGE. This should not affect existing C code.

Now, the OS' regs.h contains preprocessor conditionals such as

#if     CPU_FAMILY==I960
...
#endif  /* CPU_FAMILY==I960 */
#if     CPU_FAMILY==MC680X0
...
#endif  /* CPU_FAMILY==MC680X0 */

Without definitions of CPU_FAMILY, I960 etc., these would all be true,
which will not end well. Code using the fix-included regs.h
automatically get vxCpu.h via a chain of includes from vxTypesOld.h, but
we can make regs.h a little more self-contained for both C and asm users
by doing an explicit include of vxCpu.h.

From-SVN: r265187

fixincludes/ChangeLog
fixincludes/fixincl.x
fixincludes/inclhack.def

index 4f5f1fefb6748f64e0a17bc979c7c6dbade44a80..e7223659ab693c934095c5570ca685a845fafa05 100644 (file)
@@ -1,3 +1,10 @@
+2018-10-16  Rasmus Villemoes  <rv@rasmusvillemoes.dk>
+
+       * inclhack.def (AAB_vxworks_regs_vxtypes): Add unconditional
+       include of vxCpu.h, guard include of vxTypesOld.h by
+       !_ASMLANGUAGE.
+       * fixincl.x: Regenerate.
+
 2018-09-03  Rasmus Villemoes  <rv@rasmusvillemoes.dk>
 
        * inclhack.def (vxworks_ioctl_macro): Remove parentheses from
index 733242115349212b1b6adaa0f96ded9e23a886df..ad5824da01517a7f560e112a446a0526fa8e74bf 100644 (file)
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  September  3, 2018 at 03:24:05 PM by AutoGen 5.18.7
+ * It has been AutoGen-ed  October 16, 2018 at 11:38:39 AM by AutoGen 5.18.7
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Sep  3 15:24:05 CEST 2018
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Oct 16 11:38:39 CEST 2018
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -579,7 +579,17 @@ tSCC* apzAab_Vxworks_Regs_VxtypesMachs[] = {
 static const char* apzAab_Vxworks_Regs_VxtypesPatch[] = {
 "#ifndef _REGS_H\n\
 #define _REGS_H\n\
+/* regs.h depends on CPU_FAMILY being properly defined, which\n\
+   is done by vxCpu.h.  */\n\
+#include <types/vxCpu.h>\n\
+/* regs.h includes a CPU_FAMILY-specific header that requires\n\
+   vxTypesOld.h to already have been included.  Those headers\n\
+   contain proper _ASMLANGUAGE guards around their typedefs,\n\
+   but vxTypesOld.h itself does not. So we avoid including\n\
+   vxTypesOld.h from assembly.  */\n\
+#ifndef _ASMLANGUAGE\n\
 #include <types/vxTypesOld.h>\n\
+#endif\n\
 #include_next <arch/../regs.h>\n\
 #endif",
     (char*)NULL };
index f9ba9774f32cd9501d5db60d4cf1d0d7b538584e..8fd9f7ef295e2bb5f0c5872b529fc813ea8bee9f 100644 (file)
@@ -426,7 +426,17 @@ fix = {
     replace     = <<- _EndOfHeader_
        #ifndef _REGS_H
        #define _REGS_H
+       /* regs.h depends on CPU_FAMILY being properly defined, which
+          is done by vxCpu.h.  */
+       #include <types/vxCpu.h>
+       /* regs.h includes a CPU_FAMILY-specific header that requires
+          vxTypesOld.h to already have been included.  Those headers
+          contain proper _ASMLANGUAGE guards around their typedefs,
+          but vxTypesOld.h itself does not. So we avoid including
+          vxTypesOld.h from assembly.  */
+       #ifndef _ASMLANGUAGE
        #include <types/vxTypesOld.h>
+       #endif
        #include_next <arch/../regs.h>
        #endif
        _EndOfHeader_;