-
Enhancement
-
Resolution: Not an Issue
-
P5
-
7
-
x86
-
linux
A DESCRIPTION OF THE REQUEST :
The hotspot build system from OpenJDK beta 12 uses the value of CFLAGS variable in environment to compile C++ source code; the rules.make files uses the same CFLAGS variable for both C and C++ compiling.
The other .make files present in the hotspot/build/linux/makefiles also don't try to separate CFLAGS and CXXFLAGS, or to properly use the CPPFLAGS variable for defines. When the CFLAGS contain options that the compiler (gcc) can't handle in C++ mode, this becomes nosiy:
[exec] cc1plus: warning: command line option "-Wno-pointer-sign" is valid for C/ObjC but not for C++
[exec] cc1plus: warning: command line option "-Wno-format-zero-length" is valid for C/ObjC but not for C++
JUSTIFICATION :
When building a software from source, it's easy to expect that the CFLAGS and CXXFLAGS variables are either totally ignored or picked up correctly; mixing them might result in unexpected behaviour on the final binary. This is particularly important for distributions building packages.
Most of the parameters passed in CFLAGS could be moved in a CPPFLAGS value (but vm.make resets it) and the remaining ones can either be repeated with CXXFLAGS as target, or set on a common variable that is added just at the end in rules.make.
Some flags, like -fno-rtti -fno-exceptions -fcheck-new might be passed only to CXXFLAGS as they makes little sense for C source files building.
CUSTOMER SUBMITTED WORKAROUND :
A tentative patch is present at http://dev.gentooexperimental.org/~flameeyes/openjdk-cxxflags.patch, but it's not working as intended as CPPFLAGS gets rewritten somewhere, most likely in vm.make.
The hotspot build system from OpenJDK beta 12 uses the value of CFLAGS variable in environment to compile C++ source code; the rules.make files uses the same CFLAGS variable for both C and C++ compiling.
The other .make files present in the hotspot/build/linux/makefiles also don't try to separate CFLAGS and CXXFLAGS, or to properly use the CPPFLAGS variable for defines. When the CFLAGS contain options that the compiler (gcc) can't handle in C++ mode, this becomes nosiy:
[exec] cc1plus: warning: command line option "-Wno-pointer-sign" is valid for C/ObjC but not for C++
[exec] cc1plus: warning: command line option "-Wno-format-zero-length" is valid for C/ObjC but not for C++
JUSTIFICATION :
When building a software from source, it's easy to expect that the CFLAGS and CXXFLAGS variables are either totally ignored or picked up correctly; mixing them might result in unexpected behaviour on the final binary. This is particularly important for distributions building packages.
Most of the parameters passed in CFLAGS could be moved in a CPPFLAGS value (but vm.make resets it) and the remaining ones can either be repeated with CXXFLAGS as target, or set on a common variable that is added just at the end in rules.make.
Some flags, like -fno-rtti -fno-exceptions -fcheck-new might be passed only to CXXFLAGS as they makes little sense for C source files building.
CUSTOMER SUBMITTED WORKAROUND :
A tentative patch is present at http://dev.gentooexperimental.org/~flameeyes/openjdk-cxxflags.patch, but it's not working as intended as CPPFLAGS gets rewritten somewhere, most likely in vm.make.