aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-08-18 21:35:23 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-08-21 09:45:54 +1000
commite668771ff0dcc3c72937768e5c37b6f287b97799 (patch)
treeda8c89c05c73bc929cb1426cd7493ebe72843178 /gcc/cp/decl2.cc
parentc7b76a076cb2c6ded7ae208464019b04cb0531a2 (diff)
downloadgcc-e668771ff0dcc3c72937768e5c37b6f287b97799.zip
gcc-e668771ff0dcc3c72937768e5c37b6f287b97799.tar.gz
gcc-e668771ff0dcc3c72937768e5c37b6f287b97799.tar.bz2
c++/modules: Remove unnecessary errors when not writing compiled module
It was pointed out to me that the current error referencing an internal linkage entity reads almost like an ICE message, with the message finishing with the unhelpful: m.cpp:1:8: error: failed to write compiled module: Bad file data 1 | export module M; | ^~~~~~ Similarly, whenever we decide not to emit a module CMI due to other errors we currently emit the following message: m.cpp:1:8: warning: not writing module ‘M’ due to errors 1 | export module M; | ^~~~~~ Neither of these messages really add anything useful; users already understand that when an error is reported then the normal outputs will not be created, so these messages are just noise. There is one case we still need this latter message, however; when an error in a template has been silenced with '-Wno-template-body' we still don't want to write a module CMI, so emit an error now instead. This patch also removes a number of dg-prune-output directives in the testsuite that are no longer needed with this change. gcc/cp/ChangeLog: * module.cc (module_state::write_begin): Return a boolean to indicate errors rather than just doing set_error(). (finish_module_processing): Prevent emission of unnecessary errors; only indicate module writing occurred if write_begin succeeds. gcc/testsuite/ChangeLog: * g++.dg/modules/export-1.C: Remove message. * g++.dg/modules/internal-1.C: Remove message. * g++.dg/modules/ambig-2_b.C: Remove unnecessary pruning. * g++.dg/modules/atom-decl-2.C: Likewise. * g++.dg/modules/atom-pragma-3.C: Likewise. * g++.dg/modules/atom-preamble-2_f.C: Likewise. * g++.dg/modules/block-decl-2.C: Likewise. * g++.dg/modules/dir-only-4.C: Likewise. * g++.dg/modules/enum-12.C: Likewise. * g++.dg/modules/exp-xlate-1_b.C: Likewise. * g++.dg/modules/export-3.C: Likewise. * g++.dg/modules/friend-3.C: Likewise. * g++.dg/modules/friend-5_b.C: Likewise. * g++.dg/modules/inc-xlate-1_e.C: Likewise. * g++.dg/modules/linkage-2.C: Likewise. * g++.dg/modules/local-extern-1.C: Likewise. * g++.dg/modules/main-1.C: Likewise. * g++.dg/modules/map-2.C: Likewise. * g++.dg/modules/mod-decl-1.C: Likewise. * g++.dg/modules/mod-decl-3.C: Likewise. * g++.dg/modules/pr99174.H: Likewise. * g++.dg/modules/pr99468.H: Likewise. * g++.dg/modules/token-1.C: Likewise. * g++.dg/modules/token-3.C: Likewise. * g++.dg/modules/token-4.C: Likewise. * g++.dg/modules/token-5.C: Likewise. * g++.dg/modules/using-10.C: Likewise. * g++.dg/modules/using-12.C: Likewise. * g++.dg/modules/using-3.C: Likewise. * g++.dg/modules/using-9.C: Likewise. * g++.dg/modules/using-enum-2.C: Likewise. * g++.dg/modules/permissive-error-1.C: New test. * g++.dg/modules/permissive-error-2.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp/decl2.cc')
0 files changed, 0 insertions, 0 deletions