public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
Subject: [PATCH v1] meson: error about unsupported user-supplied c_args before C11 check
Date: Wed, 18 Mar 2026 05:53:12 +0000

When using clang, meson injects -Werror=unknown-warning-option into cc.compiles()
calls. A user-supplied c_args flag unsupported by clang therefore causes the C11
check to fail with the misleading error "C compiler does not support C11".

This commit adds a cc.has_multi_arguments() check before the C11 test to catch
unsupported c_args early.
---
 meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meson.build b/meson.build
index 46bd6b1468a..aadaf706e2e 100644
--- a/meson.build
+++ b/meson.build
@@ -620,6 +620,15 @@ dir_doc_extension = dir_doc / 'extension'
 # used, they need to be added to test_c_args as well.
 ###############################################################
 
+# Validate user-supplied c_args early: when using clang, meson injects
+# -Werror=unknown-warning-option into cc.compiles(), so an unsupported
+# flag would cause the C11 check below to fail with a misleading error.
+if not cc.has_multi_arguments(get_option('c_args'))
+  error('One or more c_args are not supported by @0@ @1@'.format(
+    cc.get_id(),
+    cc.version()))
+endif
+
 # Do we need an option to enable C11?
 c11_test = '''
 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
-- 
2.34.1


--tHmfn+rjbozXnl3O--





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1] meson: error about unsupported user-supplied c_args before C11 check
  In-Reply-To: <no-message-id-723981@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox