]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Replace VSB_DIR by sysroot ref in VXWORKS_ADDITIONAL_CPP_SPEC
authorOlivier Hainque <hainque@adacore.com>
Sat, 20 Apr 2024 15:37:51 +0000 (12:37 -0300)
committerOlivier Hainque <hainque@adacore.com>
Tue, 21 Oct 2025 08:07:59 +0000 (08:07 +0000)
VXWORKS_ADDITIONAL_CPP_SPEC has an artificial guard on
-fself-test to prevent all-gcc build failures from self-tests
in environments where VSB_DIR is not defined.

The libraries are not built during such
checks; having a VxWorks installation at hand is not necessary, and
requiring VSB_DIR to be defined is inappropriate.

This patch replaces the use of %getenv(VSB_DIR) by $sysroot references
which allows removing the artifical guard of -fself-tests.

gcc/
* config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC):
Remove guard on -fself-tests and replace %:getenv(VSB_DIR) by
sysroot references.

gcc/config/vxworks.h

index 7268ace41ece42e4d5744ad765b4ca30a5a424fd..bfad0703a8e0f7d1e1b585650d0db58b08a572ea 100644 (file)
@@ -75,22 +75,27 @@ extern void vxworks_driver_init (unsigned int *, struct cl_decoded_option **);
 
 #if TARGET_VXWORKS7
 
-/* We arrange not rely on fixed includes for vx7 and the headers spread over
-   common kernel/rtp directories in addition to specific ones for each mode.
-   Setup sysroot_headers_suffix_spec to deal with kernel/rtp distinction.  */
+/* We arrange not to rely on fixed includes for vx7 and the headers spread
+   over common kernel/rtp directories in addition to specific ones for each
+   mode.  Setup sysroot_headers_suffix_spec to deal with the kernel/rtp
+   distinction.  */
 
 #undef SYSROOT_HEADERS_SUFFIX_SPEC
 #define SYSROOT_HEADERS_SUFFIX_SPEC "%{mrtp:/usr/h;:/krnl/h}"
 
+/* Now expand everything using sysroot(+suffix) relative references.  The
+   absence of %getenv(VSB_DIR) allows all-gcc builds with possible self-tests
+   to succeed without having to define the variable at all.  */
+
 #undef VXWORKS_ADDITIONAL_CPP_SPEC
-#define VXWORKS_ADDITIONAL_CPP_SPEC                     \
"%{!nostdinc:%{!fself-test=*:                          \
-    %{isystem*}                                         \
-    -idirafter %:getenv(VSB_DIR /h)  \
-    -idirafter %:getenv(VSB_DIR /share/h)  \
-    -idirafter =/system \
-    -idirafter =/public \
-  }}"
+#define VXWORKS_ADDITIONAL_CPP_SPEC    \
 "%{!nostdinc:                                \
+     %{isystem*}                       \
+     -idirafter =/../../h              \
+     -idirafter =/../../share/h                \
+     -idirafter =/system               \
+     -idirafter =/public               \
+   }"
 
 #else /* TARGET_VXWORKS7 */