diff options
author | Ken Matsui <kmatsui@gcc.gnu.org> | 2024-03-01 22:10:55 -0800 |
---|---|---|
committer | Ken Matsui <kmatsui@gcc.gnu.org> | 2024-10-08 21:17:47 -0400 |
commit | 821d56100e1110ab6a166f50819522254eb30923 (patch) | |
tree | 5fb0a0aeb61c795781d51a274568139d4647d804 /libcpp/include/cpplib.h | |
parent | 41179a3276807c6bb6d30f9bafb6b9da31320e48 (diff) | |
download | gcc-821d56100e1110ab6a166f50819522254eb30923.zip gcc-821d56100e1110ab6a166f50819522254eb30923.tar.gz gcc-821d56100e1110ab6a166f50819522254eb30923.tar.bz2 |
gcc, libcpp: Add warning switch for "#pragma once in main file" [PR89808]
This patch adds a warning switch for "#pragma once in main file". The
warning option name is Wpragma-once-outside-header, which is the same
as Clang provides.
PR preprocessor/89808
gcc/c-family/ChangeLog:
* c.opt (Wpragma_once_outside_header): Define new option.
* c.opt.urls: Regenerate.
gcc/ChangeLog:
* doc/invoke.texi (Warning Options): Document
-Wno-pragma-once-outside-header.
libcpp/ChangeLog:
* include/cpplib.h (cpp_warning_reason): Define
CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER.
* directives.cc (do_pragma_once): Use
CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wno-pragma-once-outside-header.C: New test.
* g++.dg/warn/Wpragma-once-outside-header.C: New test.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Marek Polacek <polacek@redhat.com>
Diffstat (limited to 'libcpp/include/cpplib.h')
-rw-r--r-- | libcpp/include/cpplib.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index fbddc34..bff6601 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -714,7 +714,8 @@ enum cpp_warning_reason { CPP_W_BIDIRECTIONAL, CPP_W_INVALID_UTF8, CPP_W_UNICODE, - CPP_W_HEADER_GUARD + CPP_W_HEADER_GUARD, + CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER }; /* Callback for header lookup for HEADER, which is the name of a |