https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89808
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Ken Matsui <kmat...@gcc.gnu.org>: https://gcc.gnu.org/g:821d56100e1110ab6a166f50819522254eb30923 commit r15-4191-g821d56100e1110ab6a166f50819522254eb30923 Author: Ken Matsui <kmat...@gcc.gnu.org> Date: Fri Mar 1 22:10:55 2024 -0800 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 <kmat...@gcc.gnu.org> Reviewed-by: Marek Polacek <pola...@redhat.com>