Skip to content

Commit db67e6f

Browse files
ldionnetstellar
authored andcommitted
[libc++] Fix -Wgnu-include-next in stddef.h (#88214)
As reported in #86843, we must have #pragma GCC system_header before we use #include_next, otherwise the compiler may not understand that we're in a system header and may issue a diagnostic for our usage of (cherry picked from commit 3c4b673)
1 parent 647fbc7 commit db67e6f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcxx/include/stddef.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626

2727
#include <__config>
2828

29+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
30+
# pragma GCC system_header
31+
#endif
32+
2933
// Note: This include is outside of header guards because we sometimes get included multiple times
3034
// with different defines and the underlying <stddef.h> will know how to deal with that.
3135
#include_next <stddef.h>
3236

3337
#ifndef _LIBCPP_STDDEF_H
3438
# define _LIBCPP_STDDEF_H
3539

36-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
37-
# pragma GCC system_header
38-
# endif
39-
4040
# ifdef __cplusplus
4141
typedef decltype(nullptr) nullptr_t;
4242
# endif

0 commit comments

Comments
 (0)