================
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 --embed-dir=%S/inputs -Wno-c23-extensions -fsyntax-only 
-verify=cxx,common -x c++ %s
+// RUN: %clang_cc1 --embed-dir=%S/inputs -fsyntax-only -verify=c -std=c23 -x c 
%s
+// RUN: %clang_cc1 --embed-dir=%S/inputs -fsyntax-only -verify=c-compat,common 
-std=c23 -Wc++-compat -x c %s
+//
+// Test -Wembed-parameter-is-macro:
+// RUN: %clang_cc1 --embed-dir=%S/inputs -fsyntax-only -verify=c-compat,common 
-std=c23 -Wembed-parameter-is-macro -x c %s
+// RUN: %clang_cc1 --embed-dir=%S/inputs -fsyntax-only -verify=c -std=c23 
-Wc++-compat -Wno-embed-parameter-is-macro -x c %s
+
+// CWG3013: if one of the pp-tokens of a #embed directive (or a
+// has-embed-expression) is the identifier limit, prefix, suffix, or if_empty
+// and that identifier is defined as a macro, the program is ill-formed.
+// (C++ [cpp.pre]/p4, [cpp.cond]/p9)
+//
+// However, C doesn't have this restriction, so we should only issue a warning
+// for C if -Wc++-compat/-Wembed-parameter-is-macro is enabled.
+
+// c-no-diagnostics
+
+#define limit limit
+// common-note@-1 2 {{macro 'limit' defined here}}
+const int a[] = {
+#embed <media/art.txt> limit(2)
----------------
ianayl wrote:

Oh that's a lot smarter 😅 

https://github.com/llvm/llvm-project/pull/224769
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to