https://gcc.gnu.org/g:3de6d254a9674be48b6bb277777b48aaf819ca68

commit r16-4532-g3de6d254a9674be48b6bb277777b48aaf819ca68
Author: Olivier Hainque <[email protected]>
Date:   Sat Apr 20 12:37:51 2024 -0300

    Replace VSB_DIR by sysroot ref in VXWORKS_ADDITIONAL_CPP_SPEC
    
    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.

Diff:
---
 gcc/config/vxworks.h | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index 7268ace41ece..bfad0703a8e0 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -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 */

Reply via email to