Hi,
I accidentallly introduced an ODR violation in r17-3257-g6481867ae01355
with the callback_info struct. I wasn't aware that there is a struct of
the same name in plugin.cc. This patch puts the struct in an anonymous
namespace to fix the ODR issues when compiling with LTO, as suggested by
Drea Pinski.
LTO-bootstrapped and regtested with BOOT_C{,XX}FLAGS="-O2 -g -Werror=odr"
without issues (trunk of course doesn't build with these flags).
OK for master?
Best regards,
Josef
PR plugins/126882
gcc/ChangeLog:
* plugin.cc (struct callback_info): Put the struct into an
anonymous namespace.
Signed-off-by: Josef Melcr <[email protected]>
---
gcc/plugin.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/plugin.cc b/gcc/plugin.cc
index c3f01ec4df5..77d913a65c2 100644
--- a/gcc/plugin.cc
+++ b/gcc/plugin.cc
@@ -100,6 +100,7 @@ static int event_horizon = PLUGIN_EVENT_FIRST_DYNAMIC;
parsing. */
static htab_t plugin_name_args_tab = NULL;
+namespace {
/* List node for keeping track of plugin-registered callback. */
struct callback_info
{
@@ -108,6 +109,7 @@ struct callback_info
void *user_data; /* plugin-specified data. */
struct callback_info *next;
};
+}
/* An array of lists of 'callback_info' objects indexed by the event id. */
static struct callback_info *plugin_callbacks_init[PLUGIN_EVENT_FIRST_DYNAMIC];
--
2.55.0