mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.49k stars 1.59k forks source link

Meson cannot fall GNU cpp_std flags back to the standard MSVC ones #11641

Open amyspark opened 1 year ago

amyspark commented 1 year ago

Describe the bug

When the compiler is MSVC, Meson can automatically "downgrade" or fall the GNU c_std flags to the standard ones.

https://github.com/mesonbuild/meson/blob/f6d13c69e521c6d94eb695c05d4f8f4091bd0172/mesonbuild/compilers/c.py#L464-L494

However, in the C++ equivalent, this fallback code is simply missing.

https://github.com/mesonbuild/meson/blob/f6d13c69e521c6d94eb695c05d4f8f4091bd0172/mesonbuild/compilers/cpp.py#L727-L737

This causes the equivalent project to instead fail configuration instantly.

To Reproduce

meson.build:

project('test', 'c', 'cpp', default_options: ['c_std=gnu89', 'cpp_std=gnu++11'])

Expected behavior

Configuration should succeed, by downgrading gnu89 to nothing (👍 ) and gnu++11 to nothing (since the default is C++14).

system parameters

xclaesse commented 1 year ago

I made a fix for that a while ago https://github.com/mesonbuild/meson/pull/10332

amyspark commented 1 year ago

@xclaesse I think a better way (for this bug only) would be to implement the dictionary of flags for cpp, so that the meaning of cpp_std doesn't change.