]> git.ipfire.org Git - thirdparty/gcc.git/commit
preprocessor: Don't register pragmas in directives-only mode [PR108244]
authorLewis Hyatt <lhyatt@gmail.com>
Thu, 29 Dec 2022 21:55:21 +0000 (16:55 -0500)
committerLewis Hyatt <lhyatt@gmail.com>
Thu, 12 Jan 2023 00:02:42 +0000 (19:02 -0500)
commit9ca4899144de6db61a782b03a1257489bd26f750
treea1320804b3636dd81ad2ca9d73a89ec84336f53a
parent688fc162b76dc6747a30fcfd470f4770da0f4924
preprocessor: Don't register pragmas in directives-only mode [PR108244]

libcpp's directives-only mode does not expect deferred pragmas to be
registered, but to date the c-family registration process has not checked for
this case. That issue became more visible since r13-1544, which added the
commonly used GCC diagnostic pragmas to the set of those registered in
preprocessing modes. Fix it by checking for directives-only mode in
c-family/c-pragma.cc.

gcc/c-family/ChangeLog:

PR preprocessor/108244
* c-pragma.cc (c_register_pragma_1): Don't attempt to register any
deferred pragmas if -fdirectives-only.
(init_pragma): Likewise.

gcc/testsuite/ChangeLog:

* c-c++-common/cpp/pr108244-1.c: New test.
* c-c++-common/cpp/pr108244-2.c: New test.
* c-c++-common/gomp/pr108244-3.c: New test.
gcc/c-family/c-pragma.cc
gcc/testsuite/c-c++-common/cpp/pr108244-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cpp/pr108244-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/pr108244-3.c [new file with mode: 0644]