disabled c99 in Solaris builds (original) (raw)

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Dec 12 13:21:35 UTC 2018


On 2018-12-12 09:24, Baesken, Matthias wrote:

FWIW, in my in-development patch set for JEP 347 (https://bugs.openjdk.java.net/browse/JDK-8208089)

the -xc99=%none% option has been removed and -std=c99 added (for C code). (C++14 includes C99 by reference, so I made that change for consistency in case there were any ABI differences.) Hello Kim , do you have an estimation when your patch will be in ? Or would you suggest to do a separate change and bring in into jdk/jdk (and jdk12) already? I'd recommend a separate change to remove the -xc99=%none%. That's trivial and can be done immediately, to the benefit of everyone. Getting C++14 working is not happening quickly.

/Magnus

Best regards, Matthias

-----Original Message----- From: David Holmes <david.holmes at oracle.com> Sent: Dienstag, 11. Dezember 2018 23:16 To: Erik Joelsson <erik.joelsson at oracle.com>; Baesken, Matthias <matthias.baesken at sap.com>; 'build-dev at openjdk.java.net' <build-_ _dev at openjdk.java.net> Subject: Re: disabled c99 in Solaris builds On 12/12/2018 3:27 am, Erik Joelsson wrote: Hello,

I do not know why this flag was introduced, but it has been there for a long time. In JDK7 it's listed in jdk/make/common/Defs-solaris.gmk: # -xc99=%none Do NOT allow for c99 extensions to be used. # e.g. declarations must precede statements and was there since the first mercurial change. I can reasonably imagine that this was added to prevent introducing shared code, developed on Solaris, that would not compile on Windows. But those days are long gone. I was bitten by this just this week when an enum declaration compiled fine everywhere but Solaris! I personally wouldn't mind ditching it. +1 David /Erik On 2018-12-11 08:17, Baesken, Matthias wrote: Hello , it seems that currently the Solaris Oracle Studio Build environment is the only one that explicitly forbids C99 C code by setting -xc99=%none . The current Linux/Mac/AIX/Windows build envs had no issues with the coding.

For example I was running into an error with the C variable declaration order issue (small example below) today in my coding. Is this still a wanted behavior ? What was the reason behind setting -xc99=%none , and is the reason still valid ? I remember we had issues with C99 compatibility back then when VS2010 was used on Windows, but I think these days we use VS2013+, is this correct ? The example program mixes declarations and "other statements" , which needs C99, I compile with Oracle Studio 12u4 . /compiler/SS12u4-Oct2017/SUNWspro/bin/cc vardecl.c -o vardecl No settings -> works nicely

- with C99 disabled as OpenJDK does : ---------------------------------------------------------- /compiler/SS12u4-Oct2017/SUNWspro/bin/cc -xc99=%none vardecl.c -o vardecl "vardecl.c", line 8: warning: declaration can not follow a statement - with C99 disabled + errwarn as OpenJDK does : ------------------------------------------------------------------------ /compiler/SS12u4-Oct2017/SUNWspro/bin/cc -xc99=%none - errwarn=%all vardecl.c -o vardecl "vardecl.c", line 8: declaration can not follow a statement cc: acomp failed for vardecl.c example program : --------------------------------------- bash-3.2$ more vardecl.c #include <stdio.h> int main(void) { int a = 0; printf("a: %d \n", a); int b = 1; printf("b: %d \n", b); return 0; } Best regards, Matthias



More information about the build-dev mailing list