From: Olivier Hainque Date: Tue, 13 Oct 2020 09:53:30 +0000 (+0000) Subject: Allow self configured definition of _WRS_VXWORKS_MAJOR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=57dd4e7bb754db3f2ccdffd031d8f252d0a6d3bb;p=gcc.git Allow self configured definition of _WRS_VXWORKS_MAJOR This conditions the use of system headers to fetch a _WRS_VXWORKS_MAJOR macro on the non definition of that macro. This allows builds where a specific value is predefined, e.g. with a self spec, useful in environments where the system headers don't actually define that macro (e.g. vxworks 5 or 653). In addition, _WRS_VXWORKS_MINOR is only provided by the system headers when really meaningful, e.g. from 6.4 to 6.9. We just pick a conservative default to 0 for all the cases where it is not exposed by the system headers or otherwise. 2020-10-15 Olivier Hainque gcc/ * config/vxworks/_vxworks-versions.h: Only include version.h if _WRS_VXWORKS_MAJOR is not defined. Provide a default _WRS_VXWORKS_MINOR (0). --- diff --git a/gcc/config/vxworks/_vxworks-versions.h b/gcc/config/vxworks/_vxworks-versions.h index 0aaf5472e87..15e8bfeb4a6 100644 --- a/gcc/config/vxworks/_vxworks-versions.h +++ b/gcc/config/vxworks/_vxworks-versions.h @@ -22,17 +22,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifndef _VXWORKS_VERSIONS_H #define _VXWORKS_VERSIONS_H 1 -/* All we need is access to the bare _WRS_VXWORKS_MAJOR/MINOR macros - exposed by version.h. Cheat a bit to make sure we don't drag additional - header files, which can easily cause #include ordering nightmares. */ +/* All we need is access to the bare _WRS_VXWORKS_MAJOR/MINOR macros, + exposed by version.h or already provided somehow (e.g. with a self + spec for some reason). When resorting to system headers, cheat a + bit to make sure we don't drag additional header files, which can + easily cause #include ordering nightmares. */ +#if !defined(_WRS_VXWORKS_MAJOR) #pragma push_macro("_WRS_KERNEL") #undef _WRS_KERNEL #include #pragma pop_macro("_WRS_KERNEL") +#endif + +/* A lot depends on the MAJOR so we really need to make sure we have + that. MINOR is less critical and many environments don't actually + define it unless it is really meaningful (e.g. 6.4 through 6.9). */ #if !defined(_WRS_VXWORKS_MAJOR) -#error "VxWorks version macros needed but not defined" +#error "_WRS_VXWORKS_MAJOR undefined" +#endif + +#if !defined(_WRS_VXWORKS_MINOR) +#define _WRS_VXWORKS_MINOR 0 #endif #define _VXWORKS_MAJOR_GT(MAJOR) (_WRS_VXWORKS_MAJOR > (MAJOR))