diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-02-26 10:50:51 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-02-26 10:50:51 +0100 |
commit | 3b72464ba5e4597d2d559bcdbf150637adeb00b0 (patch) | |
tree | ee628bb1944ffa65337d7e23d01428eef995ea0f | |
parent | 751b37047b2ad3a358d41ac792487b42430e9901 (diff) | |
download | gcc-3b72464ba5e4597d2d559bcdbf150637adeb00b0.zip gcc-3b72464ba5e4597d2d559bcdbf150637adeb00b0.tar.gz gcc-3b72464ba5e4597d2d559bcdbf150637adeb00b0.tar.bz2 |
simple-diagnostic-path: Inline two trivial methods [PR116143]
Various plugin tests fail with --enable-checking=release, because the
num_events and num_threads methods of simple_diagnostic_path are only used
inside of #if CHECKING_P code inside of GCC proper and then tested inside of
some plugin tests. So, with --enable-checking=yes they are compiled into
cc1/cc1plus etc. binaries and plugins can call those, but with
--enable-checking=release they are optimized away (at least for LTO builds).
As they are trivial, the following patch just defines them inline, so that
the plugin tests get their definitions directly and don't have to rely
on cc1/cc1plus etc. exporting those.
2025-02-26 Jakub Jelinek <jakub@redhat.com>
PR testsuite/116143
* simple-diagnostic-path.h (simple_diagnostic_path::num_events): Define
inline.
(simple_diagnostic_path::num_threads): Likewise.
* simple-diagnostic-path.cc (simple_diagnostic_path::num_events):
Remove out of line definition.
(simple_diagnostic_path::num_threads): Likewise.
-rw-r--r-- | gcc/simple-diagnostic-path.cc | 15 | ||||
-rw-r--r-- | gcc/simple-diagnostic-path.h | 4 |
2 files changed, 2 insertions, 17 deletions
diff --git a/gcc/simple-diagnostic-path.cc b/gcc/simple-diagnostic-path.cc index b7fb74f..5af69b6 100644 --- a/gcc/simple-diagnostic-path.cc +++ b/gcc/simple-diagnostic-path.cc @@ -41,15 +41,6 @@ simple_diagnostic_path::simple_diagnostic_path (pretty_printer *event_pp) add_thread ("main"); } -/* Implementation of diagnostic_path::num_events vfunc for - simple_diagnostic_path: simply get the number of events in the vec. */ - -unsigned -simple_diagnostic_path::num_events () const -{ - return m_events.length (); -} - /* Implementation of diagnostic_path::get_event vfunc for simple_diagnostic_path: simply return the event in the vec. */ @@ -59,12 +50,6 @@ simple_diagnostic_path::get_event (int idx) const return *m_events[idx]; } -unsigned -simple_diagnostic_path::num_threads () const -{ - return m_threads.length (); -} - const diagnostic_thread & simple_diagnostic_path::get_thread (diagnostic_thread_id_t idx) const { diff --git a/gcc/simple-diagnostic-path.h b/gcc/simple-diagnostic-path.h index 9988b1c..e9a97f2 100644 --- a/gcc/simple-diagnostic-path.h +++ b/gcc/simple-diagnostic-path.h @@ -100,9 +100,9 @@ class simple_diagnostic_path : public diagnostic_path public: simple_diagnostic_path (pretty_printer *event_pp); - unsigned num_events () const final override; + unsigned num_events () const final override { return m_events.length (); } const diagnostic_event & get_event (int idx) const final override; - unsigned num_threads () const final override; + unsigned num_threads () const final override { return m_threads.length (); } const diagnostic_thread & get_thread (diagnostic_thread_id_t) const final override; bool |