mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-13 17:37:00 +00:00

Our diagnostics relating to static assertions were a bit confused. For instance, when in MS compatibility mode in C (where we accept static_assert even without including <assert.h>), we would fail to warn the user that they were using the wrong spelling (even in pedantic mode), we were missing a compatibility warning about using _Static_assert in earlier standards modes, diagnostics for the optional message were not reflected in C as they were in C++, etc.
13 lines
646 B
C
13 lines
646 B
C
// RUN: %clang_cc1 -E -dM %s | FileCheck --strict-whitespace --check-prefix=NOMS %s
|
|
// RUN: %clang_cc1 -fms-compatibility -E -dM %s | FileCheck --strict-whitespace --check-prefix=MS %s
|
|
|
|
// If the assert macro is defined in MS compatibility mode in C, we
|
|
// automatically inject a macro definition for static_assert. Test that the
|
|
// macro is properly added to the preprocessed output. This allows us to
|
|
// diagonse use of the static_assert keyword when <assert.h> has not been
|
|
// included while still being able to compile preprocessed code.
|
|
#define assert
|
|
|
|
MS: #define static_assert _Static_assert
|
|
NOMS-NOT: #define static_assert _Static_assert
|