BSD variables not declared? (jdk8 & jdk 9 builds)
Kim Barrett
kim.barrett at oracle.com
Thu Apr 16 04:26:13 UTC 2015
> This might be of interest:
> https://gcc.gnu.org/gcc-4.4/porting_to.html
> Preprocessor conditionals always evaluated
Also see this:
http://lists.boost.org/Archives/boost/2011/08/184657.php
—————
This has come up before. The problem is with code like this:
#if !defined(SOMETHING)
#elif SOMETHING() == 1
#endif
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)
#else
# if SOMETHING() == 1
# endif
#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