]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Stream warning suppressions [PR115757]
authorNathaniel Shead <nathanieloshead@gmail.com>
Sun, 7 Jul 2024 03:56:25 +0000 (13:56 +1000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Jul 2024 17:05:59 +0000 (19:05 +0200)
commit7a88eb35ef4834fcd98408fe5505360fead99f43
tree52eb05601ab67b2b567f7b7992ef38a05304db84
parent141ad69ba60f4c22382b66240a1c6c2104102846
c++/modules: Stream warning suppressions [PR115757]

Currently we don't stream the contents of 'nowarn_map'; this means that
warning suppressions don't get applied in importers, which is
particularly relevant for templates (as in the linked testcase).

Rather than streaming the whole contents of 'nowarn_map', this patch
instead just streams the exported suppressions for each tree node
individually, to not build up additional locations and suppressions for
tree nodes that do not need to be streamed.

PR c++/115757

gcc/cp/ChangeLog:

* module.cc (trees_out::core_vals): Write warning specs for
DECLs and EXPRs.
(trees_in::core_vals): Read warning specs.

gcc/ChangeLog:

* tree.h (put_warning_spec_at): Declare new function.
(has_warning_spec): Likewise.
(get_warning_spec): Likewise.
(put_warning_spec): Likewise.
* diagnostic-spec.h (nowarn_spec_t::from_bits): New function.
* diagnostic-spec.cc (put_warning_spec_at): New function.
* warning-control.cc (has_warning_spec): New function.
(get_warning_spec): New function.
(put_warning_spec): New function.

gcc/testsuite/ChangeLog:

* g++.dg/modules/warn-spec-1_a.C: New test.
* g++.dg/modules/warn-spec-1_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/module.cc
gcc/diagnostic-spec.cc
gcc/diagnostic-spec.h
gcc/testsuite/g++.dg/modules/warn-spec-1_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/warn-spec-1_b.C [new file with mode: 0644]
gcc/tree.h
gcc/warning-control.cc