BSD variables not declared? (jdk8 & jdk 9 builds)

Kim Barrett kim.barrett at
Thu Apr 16 04:26:13 UTC 2015

> This might be of interest:
> Preprocessor conditionals always evaluated

Also see this:

This has come up before. The problem is with code like this: 

#if !defined(SOMETHING) 
#elif SOMETHING() == 1 

In recent versions of gcc it fails when SOMETHING isn't defined 
because the 'SOMETHING() == 1' clause is always evaluated - even 
though the if statement has already been resolved. This is apparently 
compliant with the standard. 

The solution is to write: 

#if !defined(SOMETHING) 
# if SOMETHING() == 1 
# endif 


That same technique could be applied by us, as an alternative to the proposed changes.
But it’s pretty annoying ugly, with sometimes long string of trailing #endif lines.

More information about the build-dev mailing list