> On Dec 11, 2018, at 12:27 PM, Erik Joelsson <erik.joels...@oracle.com> 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 personally wouldn't mind ditching it.
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.) I haven't encountered any problems attributable to that configuration change. > /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