[OpenJDK 2D-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
-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. [1] This 
conflicted outright with -std=c99.
>
> and
>
> -D_XPG6
>
> ??
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 
/usr/include/sys/feature_tests.h:
/*
  * 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"
#endif

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?

/Magnus

>
> Thanks,
> David
>
> 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 
>>>> -xc99=%none%.
>>>> 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:
>> WebRev: 
>> http://cr.openjdk.java.net/~ihse/JDK-8215296-build-solstudio-with-c99/webrev.01 
>>
>>
>> Now this passes the CI build test.
>>
>> /Magnus
>>>
>>> /Magnus
>>>>
>>>> /Magnus
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8215296
>>>> Patch inline:
>>>> diff --git a/make/autoconf/flags-cflags.m4 
>>>> b/make/autoconf/flags-cflags.m4
>>>> --- a/make/autoconf/flags-cflags.m4
>>>> +++ b/make/autoconf/flags-cflags.m4
>>>> @@ -559,7 +559,7 @@
>>>>      TOOLCHAIN_CFLAGS="-errshort=tags"
>>>>
>>>>      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
>>>>      TOOLCHAIN_CFLAGS_JVM="-template=no%extdef 
>>>> -features=no%split_init \
>>>>          -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
>>>
>>



More information about the 2d-dev mailing list