Clang already supports the pragma prefixed by "GCC" or "clang".
MSVC has more recently added support for the pragma, but without any prefix; see https://devblogs.microsoft.com/cppblog/broken-warnings-theory/#external-headers
Differential D104770
Add support for #pragma system_header with -fms-extensions hans on Jun 23 2021, 2:17 AM. Authored by
Details Clang already supports the pragma prefixed by "GCC" or "clang". MSVC has more recently added support for the pragma, but without any prefix; see https://devblogs.microsoft.com/cppblog/broken-warnings-theory/#external-headers
Diff Detail
Event Timeline
Comment Actions LGTM, though you could add a test that #pragma system_header gives a diagnostic outside of -fms-extensions mode if you think that's valuable. Comment Actions Thanks! Yes, I'll do that, and I'll also add a test to see that it actually warns when no system_header is used. |
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.