xref: /llvm-project/clang/test/Sema/builtin-allow-runtime-check.c (revision 1f35e7227178843679d1d364bc5fc0bcfee2eb95)
1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-linux-gnu -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-linux-gnu -verify %s
3 
4 extern const char *str;
5 
main(void)6 int main(void) {
7   int r = 0;
8 
9   r |= __builtin_allow_runtime_check(); // expected-error {{too few arguments to function call}}
10 
11   r |= __builtin_allow_runtime_check(str); // expected-error {{expression is not a string literal}}
12 
13   r |= __builtin_allow_runtime_check(5); // expected-error {{incompatible integer to pointer conversion}} expected-error {{expression is not a string literal}}
14 
15   r |= __builtin_allow_runtime_check("a", "b");  // expected-error {{too many arguments to function call}}
16 
17   r |= __builtin_allow_runtime_check("");
18 
19   r |= __builtin_allow_runtime_check("check");
20 
21   str = __builtin_allow_runtime_check("check2");  // expected-error {{incompatible integer to pointer conversion}}
22 
23   return r;
24 }
25