[clang-format] Rename ExportBlockIndentation -> IndentExportBlock (#123493)
[llvm-project.git] / clang / test / Preprocessor / embed_parameter_suffix.c
blob7d76826828245f13fee3b3aadd7b9d5948a6b3c1
1 // RUN: %clang_cc1 -std=c23 %s --embed-dir=%S/Inputs -fsyntax-only -verify
3 const char data[] = {
4 #embed <single_byte.txt> suffix(, '\xA')
5 };
6 const char empty_data[] = {
7 #embed <media/empty> suffix(, '\xA')
9 };
10 static_assert(sizeof(data) == 2);
11 static_assert('b' == data[0]);
12 static_assert('\xA' == data[1]);
13 static_assert(sizeof(empty_data) == 1);
14 static_assert(1 == empty_data[0]);
16 struct S {
17 int x, y, z;
20 const struct S s = {
21 #embed <single_byte.txt> suffix( , .y = 100, .z = 10 )
24 static_assert(s.x == 'b');
25 static_assert(s.y == 100);
26 static_assert(s.z == 10);
28 // Ensure that an empty file does not produce any suffix tokens. If it did,
29 // there would be random tokens here that the parser would trip on.
30 #embed <media/empty> suffix(0)
32 // Ensure we diagnose duplicate parameters even if they're the same value.
33 const unsigned char a[] = {
34 #embed <jk.txt> suffix(,1) prefix() suffix(,1)
35 // expected-error@-1 {{cannot specify parameter 'suffix' twice in the same '#embed' directive}}
37 #embed <jk.txt> suffix(,1) if_empty() suffix(,2)
38 // expected-error@-1 {{cannot specify parameter 'suffix' twice in the same '#embed' directive}}