| 1 |
// RUN: %clang_cc1 -DSILENCE -fsyntax-only -verify -Wall %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -Walloca %s |
| 3 |
|
| 4 |
#ifdef SILENCE |
| 5 |
// expected-no-diagnostics |
| 6 |
#endif |
| 7 |
|
| 8 |
void test1(int a) { |
| 9 |
__builtin_alloca(a); |
| 10 |
#ifndef SILENCE |
| 11 |
// expected-warning@-2 {{use of function '__builtin_alloca' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability}} |
| 12 |
#endif |
| 13 |
} |
| 14 |
|
| 15 |
void test2(int a) { |
| 16 |
__builtin_alloca_with_align(a, 32); |
| 17 |
#ifndef SILENCE |
| 18 |
// expected-warning@-2 {{use of function '__builtin_alloca_with_align' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability}} |
| 19 |
#endif |
| 20 |
} |
| 21 |
|
| 22 |
void test3(int a) { |
| 23 |
__builtin_alloca_uninitialized(a); |
| 24 |
#ifndef SILENCE |
| 25 |
// expected-warning@-2 {{use of function '__builtin_alloca_uninitialized' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability}} |
| 26 |
#endif |
| 27 |
} |
| 28 |
|
| 29 |
void test4(int a) { |
| 30 |
__builtin_alloca_with_align_uninitialized(a, 32); |
| 31 |
#ifndef SILENCE |
| 32 |
// expected-warning@-2 {{use of function '__builtin_alloca_with_align_uninitialized' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability}} |
| 33 |
#endif |
| 34 |
} |