* [patch] vxworks: allow self configured definition of _WRS_VXWORKS_MAJOR
@ 2020-10-15 9:33 Olivier Hainque
0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2020-10-15 9:33 UTC (permalink / raw)
To: GCC Patches; +Cc: Rasmus Villemoes
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
Hello,
While performing experimental builds for testing
purposes, I had occasional uses of the possibility to
enforce a _WRS_VXWORKS_MAJOR in an environment where
it was not available from the system headers, by way
of a self-spec at configuration time.
This patch adjusts _vxworks-versions.h to help support
that.
The experiments also exposed that _WRS_VXWORKS_MINOR
is only provided when really meaningful, e.g. from
6.4 to 6.9, and that it is possibly omitted even in
very recent VxWorks 7 configurations. We just then pick
a conervative default to 0 in such cases.
Tested with a few regular build & test sequences
for VxWworks 6.9 and 7.2 in addition to the experimental
ones.
Olivier
2020-10-15 Olivier Hainque <hainque@adacore.com>
gcc/
* config/vxworks/_vxworks-versions.h: Only include
version.h if _WRS_VXWORKS_MAJOR is not defined.
Provide a default _WRS_VXWORKS_MINOR (0).
[-- Attachment #2: vxworks_major_minor.txt --]
[-- Type: text/plain, Size: 1485 bytes --]
--- 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 <version.h>
#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))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-15 9:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 9:33 [patch] vxworks: allow self configured definition of _WRS_VXWORKS_MAJOR Olivier Hainque
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).