aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjrl64 <32905389+jrl64@users.noreply.github.com>2019-04-10 15:14:51 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-10 23:14:51 +0300
commita2d222c383f569241006f826690f599c4f187849 (patch)
tree4acb984888651b3cdf728a70ee57820a9640e21d
parent04710b087a3033aa692e1fc3bdbb2dbe2a8ec70e (diff)
downloadmeson-a2d222c383f569241006f826690f599c4f187849.zip
meson-a2d222c383f569241006f826690f599c4f187849.tar.gz
meson-a2d222c383f569241006f826690f599c4f187849.tar.bz2
Update Built-in Option c_std for C17. Closes #4842.
-rw-r--r--docs/markdown/Builtin-options.md2
-rw-r--r--docs/markdown/Configuring-a-build-directory.md2
-rw-r--r--docs/markdown/snippets/add_c17_and_c18_standards.md9
-rw-r--r--mesonbuild/compilers/c.py21
4 files changed, 28 insertions, 6 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index a9f95e4..957ce4e 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -128,7 +128,7 @@ compiler being used:
| ------ | ------------- | --------------- | ----------- |
| c_args | | free-form comma-separated list | C compile arguments to use |
| c_link_args | | free-form comma-separated list | C link arguments to use |
-| c_std | none | none, c89, c99, c11, gnu89, gnu99, gnu11 | C language standard to use |
+| c_std | none | none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18 | C language standard to use |
| c_winlibs | see below | free-form comma-separated list | Standard Windows libs to link against |
| cpp_args | | free-form comma-separated list | C++ compile arguments to use |
| cpp_link_args| | free-form comma-separated list | C++ link arguments to use |
diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md
index ddda6fe..73585e2 100644
--- a/docs/markdown/Configuring-a-build-directory.md
+++ b/docs/markdown/Configuring-a-build-directory.md
@@ -60,7 +60,7 @@ sample output for a simple project.
------ ------------- --------------- -----------
c_args [] Extra arguments passed to the C compiler
c_link_args [] Extra arguments passed to the C linker
- c_std c99 [none, c89, c99, c11, gnu89, gnu99, gnu11] C language standard to use
+ c_std c99 [none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18] C language standard to use
cpp_args [] Extra arguments passed to the C++ compiler
cpp_debugstl false [true, false] STL debug mode
cpp_link_args [] Extra arguments passed to the C++ linker
diff --git a/docs/markdown/snippets/add_c17_and_c18_standards.md b/docs/markdown/snippets/add_c17_and_c18_standards.md
new file mode 100644
index 0000000..6461e65
--- /dev/null
+++ b/docs/markdown/snippets/add_c17_and_c18_standards.md
@@ -0,0 +1,9 @@
+---
+short-description: Add c17 and c18 values for c_std option
+...
+
+## Added c17 and c18 as c_std values for recent GCC and Clang Versions
+
+For gcc version 8.0 and later, the values c17, c18, gnu17, and gnu18 were added to the accepted values for built-in compiler option c_std.
+
+For Clang version 10.0 and later on Apple OSX (Darwin), and for version 7.0 and later on other platforms, the values c17 and gnu17 were added as c_std values.
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 0a6e3b3..12f7838 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1220,9 +1220,17 @@ class ClangCCompiler(ClangCompiler, CCompiler):
def get_options(self):
opts = CCompiler.get_options(self)
+ c_stds = ['c89', 'c99', 'c11']
+ g_stds = ['gnu89', 'gnu99', 'gnu11']
+ if self.compiler_type is CompilerType.CLANG_OSX:
+ v = '>=10.0.0'
+ else:
+ v = '>=7.0.0'
+ if version_compare(self.version, v):
+ c_stds += ['c17']
+ g_stds += ['gnu17']
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
- ['none', 'c89', 'c99', 'c11',
- 'gnu89', 'gnu99', 'gnu11'],
+ ['none'] + c_stds + g_stds,
'none')})
return opts
@@ -1284,9 +1292,14 @@ class GnuCCompiler(GnuCompiler, CCompiler):
def get_options(self):
opts = CCompiler.get_options(self)
+ c_stds = ['c89', 'c99', 'c11']
+ g_stds = ['gnu89', 'gnu99', 'gnu11']
+ v = '>=8.0.0'
+ if version_compare(self.version, v):
+ c_stds += ['c17', 'c18']
+ g_stds += ['gnu17', 'gnu18']
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
- ['none', 'c89', 'c99', 'c11',
- 'gnu89', 'gnu99', 'gnu11'],
+ ['none'] + c_stds + g_stds,
'none')})
if self.compiler_type.is_windows_compiler:
opts.update({