Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c_std=gnuXX,cXX needs future-feature warning #13713

Open
bgilbert opened this issue Sep 25, 2024 · 0 comments
Open

c_std=gnuXX,cXX needs future-feature warning #13713

bgilbert opened this issue Sep 25, 2024 · 0 comments
Assignees

Comments

@bgilbert
Copy link
Contributor

Describe the bug
Meson ≥ 1.3.0 warns if c_std=gnu99 (or any other gnuXX) is used with MSVC:

DEPRECATION: None of the values ['gnu99'] are supported by the c compiler.
However, the deprecated gnu99 std currently falls back to c99.
This will be an error in the future.
If the project supports both GNU and MSVC compilers, a value such as
"c_std=gnu11,c11" specifies that GNU is preferred but it can safely fallback to plain c11.

The phrase This will be an error in the future, and the corresponding hard failure with --fatal-meson-warnings, strongly encourages projects to move to c_std=gnu99,c99. However, the latter is a hard failure on Meson < 1.3.0:

meson.build:1:0: ERROR: Value "gnu99,c99" (of type "string") for combo option "C language standard to use" is not one of the choices. Possible choices are (as string): "none", "c89", "c99", "c11", "c17", "c18", "c2x", "gnu89", "gnu99", "gnu11", "gnu17", "gnu18", "gnu2x".

The workaround is to specify

default_options: [meson.version().version_compare('>=1.3.0') ? 'c_std=gnu99,c99' : 'c_std=gnu99']

in the project() call, but that's not at all obvious. Projects that don't CI with older Meson versions won't notice that they need this until a user tries to build with MSVC and an older Meson.

To Reproduce

project('c', 'c', default_options: 'c_std=gnu99,c99', meson_version: '>=1')

Expected behavior
Meson prints a warning that c_std=gnu99,c99 is not available before Meson 1.3.0.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    native
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Fedora 40
  • what Python version are you using e.g. 3.8.0
    3.12.5
  • what meson --version
    1.5.0
  • what ninja --version if it's a Ninja build
    n/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants