<AWT Dev> RFR: JDK-8215296 do not disable c99 on Solaris
Magnus Ihse Bursie
magnus.ihse.bursie at oracle.com
Thu Dec 13 10:11:17 UTC 2018
On 2018-12-12 23:17, David Holmes wrote:
> Hi Magnus,
> What did -Xa do?
I believe Kim has answered this satisfactory.
> Do AWT folk need to check this.
I'm adding awt and 2d lists to this review.
> I find it hard to understand the connection between:
I'm not sure there is a connection..? It's two different libraries, that
were affected by the change to -std=c99. Two different fixes were required.
-xc99=no_lib is a subset of -xc99=none, the flag we removed, and it says
that the file should not be compiled with the full c99 standard. "Do not
enable the 1999 C standard library semantics of routines that appeared
in both the 1990 and 1999 C standard. " says the maual.  This
conflicted outright with -std=c99.
To be honest, I'm not completely sure about this. Without this define,
the build failed with the following error message:
Compiler or options invalid for pre-UNIX 03 X/Open applications and
pre-2001 POSIX applications
This was triggered by the following section in
* It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
* using c99. The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
* and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
* or a POSIX.1-2001 application with anything other than a c99 or later
* compiler. Therefore, we force an error in both cases.
#if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
and pre-2001 POSIX applications"
#elif !defined(_STDC_C99) && \
(defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
require the use of c99"
The solution, as also hinted to by searching for other resolutions to
this error online, was to provide the _XPG6 system define. But exactly
how we end up in feature_tests.h with __XOPEN_OR_POSIX set, without
_XPG6 set, and only when compiling this library and not others, I don't
know. I also don't understand what the XPG standard refers to, nor what
versions 2-5 means or what version 6 has that differs from them.
By setting this flag, I am telling solaris include headers that we want
to compile using the XPG standard version 6, instead of an older one. It
solves the problem. I am happy enough with this. Are you?
> On 13/12/2018 7:02 am, Magnus Ihse Bursie wrote:
>> On 2018-12-12 20:08, Magnus Ihse Bursie wrote:
>>> On 2018-12-12 19:12, Magnus Ihse Bursie wrote:
>>>> From the bug report:
>>>> "Currently we disable C99 in the Solaris build by setting
>>>> This differs from a lot of other build environments like gcc/Linux
>>>> or VS2013/2017 on Windows where C99 features work.
>>>> We should remove this difference on Solaris and remove or replace
>>>> the setting.
>>>> Kim Barrett mentioned :
>>>> "I merely mentioned the C++14 work as evidence that removing
>>>> -xc99=%none% didn’t appear harmful."
>>>> However it will take more time until the C++14 change is in."
>>>> I am currently running a test build on our CI build system to
>>>> confirm that this does not break the Solaris build (but I'd be
>>>> highly surprised if it did). I will not push this until the builds
>>>> are cleared.
>>> Of course it was not that simple... :-( Two AWT libraries (at least)
>>> failed to build. I'm currently investigating if there's a simple fix
>>> to that.
>> New attempt, that fixes the two AWT libraries:
>> Now this passes the CI build test.
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8215296
>>>> Patch inline:
>>>> diff --git a/make/autoconf/flags-cflags.m4
>>>> --- a/make/autoconf/flags-cflags.m4
>>>> +++ b/make/autoconf/flags-cflags.m4
>>>> @@ -559,7 +559,7 @@
>>>> TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
>>>> - TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -W0,-noglobal
>>>> $TOOLCHAIN_CFLAGS" # C only
>>>> + TOOLCHAIN_CFLAGS_JDK_CONLY="-std=c99 -xCC -W0,-noglobal
>>>> $TOOLCHAIN_CFLAGS" # C only
>>>> TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath
>>>> -xnolib" # CXX only
>>>> -features=no%split_init \
>>>> -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
More information about the awt-dev