Stop deriving C++ flags from CFLAGS.
Commit 2e387d0e "Disable aggressive loop optimizations in GCC 4.8+" created a precedent of using autoconf to manipulate CXXFLAGS. We've then been getting more flags by stealing them wholesale (modulo checking for compiler support) from CFLAGS since commit 9e2dab0a "Derive CXXFLAGS from CFLAGS.". This was neat in that it was low-maintenance, and it has practically served us well for the past 3 years. However, our current simplistic CXXFLAGS manipulation leaves a lot to be desired: 1. It's implicit, giving us very little control over what flags to *not* include in CXXFLAGS. To wit, -Wmissing-prototypes is inapplicable to C++ but still included in CXXFLAGS. 2. Negative flags are not well supported. Some compilers -- notably GCC -- do not reject a negative warning flag (e.g. -Wno-fff). Compiler detection for such flags needs to be done in the positive form before adding the negative flag. 3. It neglects CXXFLAGS the user specifies (either in the environment or as an argument to configure) This patch replaces the implicit derivation with explicit setting of CXXFLAGS. I've tested that this maintains behavior parity (modulo losing -Wmissing-prototypes, which is intentional). I've preserved the Greenplum idiosyncrasy of defaulting O3. [resolves #9979] Note that sooner or later we're gonna merge with upstream Postgres 11 where C++ support is added to configure. The macro name PGAC_PROG_CXX_CXXFLAGS_OPT is deliberately (or it might have been a happenstance) chosen to be *different* from the upstream macro name so as to make "git blame" more useful and make it easier to wholesale take the upstream changes when the merge happens.
Showing
想要评论请 注册 或 登录