Maintain separate flags for C++ compiler invocations
Previously we would pass flags intended for the C compiler to the C++
compiler (see Trac #16738). This would cause, for instance, -std=gnu99 to
be passed to the C++ compiler, causing spurious test failures. Fix this
by maintaining a separate set of flags for C++ compilation invocations.