llvm-capstone/clang/test/Preprocessor/whitespace-ms-extensions.c
Michael Kruse 0e2586779c [Preprocessor] Ensure newline after #pragma introduced by -fms-extensions.
The -fms-extensions converts __pragma (and _Pragma) into a #pragma that
has to occur at the beginning of a line and end with a newline. This
patch ensures that the newline after the #pragma is added even if
Token::isAtStartOfLine() indicated that we should not start a newline.

Committing relying post-commit review since the change is small, some
downstream uses might be blocked without this fix, and to make clear the
decision of the new -fminimize-whitespace feature (fix on main, revert
on clang-13.x branch) suggested by @aaron.ballman in D104601.

Differential Revision: https://reviews.llvm.org/D107183
2021-08-01 19:08:13 -05:00

20 lines
481 B
C

// RUN: %clang_cc1 -E -P %s -o - | FileCheck %s
// RUN: %clang_cc1 -E -P -fms-extensions %s -o - | FileCheck %s --check-prefix=MSEXT
// -fms-extensions changes __pragma into #pragma
// Ensure that there is a newline after the #pragma line.
#define MACRO \
text \
__pragma(PRAGMA) \
after
before MACRO text
// CHECK: before text __pragma(PRAGMA) after text
// MSEXT: before text
// MSEXT-NEXT: #pragma PRAGMA
// MSEXT-NEXT: after text