]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostic: Save/restore diagnostic context history and push/pop state for PCH [PR116847]
authorJakub Jelinek <jakub@redhat.com>
Fri, 27 Sep 2024 14:07:40 +0000 (16:07 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 27 Sep 2024 14:07:40 +0000 (16:07 +0200)
commit64072e60b1599ae7d347c2cdee46c3b0e37fc338
tree4ab233a209c4ce21a2d155b33e1634d997888f63
parentddc72ba6c6c2c84a1a95340840bd5fde1f2bde44
diagnostic: Save/restore diagnostic context history and push/pop state for PCH [PR116847]

The following patch on top of the just posted cleanup patch
saves/restores the m_classification_history and m_push_list
vectors for PCH.  Without that as the testcase shows during parsing
of the templates we don't report ignored diagnostics, but after loading
PCH header when instantiating those templates those warnings can be
emitted.  This doesn't show up on x86_64-linux build because configure
injects there -fcf-protection -mshstk flags during library build (and so
also during PCH header creation), but make check doesn't use those flags
and so the PCH header is ignored.

2024-09-26  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/116847
gcc/
* diagnostic.h (diagnostic_option_classifier): Add pch_save and
pch_restore method declarations.
(diagnostic_context): Add pch_save and pch_restore inline method
definitions.
* diagnostic.cc (diagnostic_option_classifier::pch_save): New method.
(diagnostic_option_classifier::pch_restore): Likewise.
gcc/c-family/
* c-pch.cc: Include diagnostic.h.
(c_common_write_pch): Call global_dc->pch_save.
(c_common_read_pch): Call global_dc->pch_restore.
gcc/testsuite/
* g++.dg/pch/pr116847.C: New test.
* g++.dg/pch/pr116847.Hs: New test.
gcc/c-family/c-pch.cc
gcc/diagnostic.cc
gcc/diagnostic.h
gcc/testsuite/g++.dg/pch/pr116847.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pch/pr116847.Hs [new file with mode: 0644]