[PATCH] D104770: Add support for #pragma system_header with -fms-extensions

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 23 02:20:56 PDT 2021


hans added inline comments.


================
Comment at: clang/test/Lexer/pragma-operators.cpp:22
 #define pragma_L _Pragma(L"GCC diagnostic push")
-#define pragma_u8 _Pragma(u8"system_header")
+#define pragma_u8 _Pragma(u8"pack(1)")
 #define pragma_u _Pragma(u"GCC diagnostic pop")
----------------
I had to change the pragma here, because now we will warn about system_header being ignored in a non-header file which would break this test.


================
Comment at: clang/test/Preprocessor/pragma_sysheader.c:1
-// RUN: %clang_cc1 -verify -pedantic %s -fsyntax-only
-// RUN: %clang_cc1 -E %s | FileCheck %s
+// RUN: %clang_cc1 -verify -std=c99 -pedantic %s -fsyntax-only
+// RUN: %clang_cc1 -verify -std=c99 -pedantic %s -fsyntax-only -DCLANG
----------------
Adding -std=c99 is necessary, because in newer language modes (which are now the default), Clang doesn't warn about repeated typedef declarations, so the test wasn't actually testing the system_header pragma anymore.


================
Comment at: clang/test/Preprocessor/pragma_sysheader.c:6
 // rdar://6899937
-#include "pragma_sysheader.h"
-
+#include "Inputs/pragma_sysheader.h"
 
----------------
Moving the .h file to Inputs/ is just a cleanup.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104770/new/

https://reviews.llvm.org/D104770



More information about the cfe-commits mailing list