| 1 |
// REQUIRES: hexagon-registered-target |
| 2 |
|
| 3 |
// Verify that hexagon_types.h can be included after a B0 macro definition |
| 4 |
// without conflicts, that B0 is restored afterward, and that the |
| 5 |
// lowercase b0() alias is usable even while B0 is still a macro. |
| 6 |
|
| 7 |
// RUN: %clang_cc1 -fsyntax-only -internal-isystem %S/../../lib/Headers/ \ |
| 8 |
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-linux-musl \ |
| 9 |
// RUN: -verify %s |
| 10 |
|
| 11 |
// RUN: %clang_cc1 -fsyntax-only -internal-isystem %S/../../lib/Headers/ \ |
| 12 |
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-linux-musl \ |
| 13 |
// RUN: -x c++ -verify %s |
| 14 |
|
| 15 |
// expected-no-diagnostics |
| 16 |
|
| 17 |
// Simulate the POSIX termios.h B0 macro definition. |
| 18 |
#define B0 0000000 |
| 19 |
|
| 20 |
#include <hexagon_types.h> |
| 21 |
|
| 22 |
// Verify B0 is restored after including hexagon_types.h. |
| 23 |
#ifndef B0 |
| 24 |
#error "B0 should be defined after including hexagon_types.h" |
| 25 |
#endif |
| 26 |
|
| 27 |
_Static_assert(B0 == 0, "B0 should still be 0 after including hexagon_types.h"); |
| 28 |
|
| 29 |
// In C++ mode, verify the lowercase b0() alias works even with B0 defined. |
| 30 |
#ifdef __cplusplus |
| 31 |
void test_b0_alias(void) { |
| 32 |
HEXAGON_Vect64C v(0x0807060504030201LL); |
| 33 |
signed char got = v.b0(); |
| 34 |
(void)got; |
| 35 |
HEXAGON_Vect64C v2 = v.b0(0x42); |
| 36 |
(void)v2; |
| 37 |
} |
| 38 |
#endif |