From 82a8c72187f844713618526ed3890d7b313b2065 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 28 Apr 2022 16:08:24 -0400 Subject: c_std, cpp_std: Change to a list of desired versions in preference order Projects that prefer GNU C but can fallback to ISO C can now set for example `default_options: 'c_std=gnu11,c11'` and it will use gnu11 when available, fallback to c11 otherwise. It is an error only if none of the values are supported by the current compiler. This allows to deprecate gnuXX values from MSVC compiler, that means that `default_options: 'c_std=gnu11'` will now print warning with MSVC but still fallback to 'c11' value. No warning is printed if at least one of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`. In the future that deprecation warning will become an hard error because `c_std=gnu11` should mean GNU is required, for projects that cannot be built with MSVC for example. --- docs/markdown/snippets/cstd.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/markdown/snippets/cstd.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/cstd.md b/docs/markdown/snippets/cstd.md new file mode 100644 index 0000000..cc1f083 --- /dev/null +++ b/docs/markdown/snippets/cstd.md @@ -0,0 +1,18 @@ +## `c_std` and `cpp_std` options now accepts a list of values + +Projects that prefer GNU C, but can fallback to ISO C, can now set, for +example, `default_options: 'c_std=gnu11,c11'`, and it will use `gnu11` when +available, but fallback to `c11` otherwise. It is an error only if none of the +values are supported by the current compiler. + +Likewise, a project that can take benefit of `c++17` but can still build with +`c++11` can set `default_options: 'cpp_std=c++17,c++11'`. + +This allows us to deprecate `gnuXX` values from the MSVC compiler. That means +that `default_options: 'c_std=gnu11'` will now print a warning with MSVC +but fallback to `c11`. No warning is printed if at least one +of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`. + +In the future that deprecation warning will become an hard error because +`c_std=gnu11` should mean GNU is required, for projects that cannot be +built with MSVC for example. -- cgit v1.1