From: Iain Sandoe Date: Sun, 22 Nov 2020 11:19:32 +0000 (+0000) Subject: Darwin : Avoid a C++ ODR violation seen with LTO. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c52cd517a34b6b37eb17d4defd63bb31e60888b;p=gcc.git Darwin : Avoid a C++ ODR violation seen with LTO. We have a similar code pattern in darwin-c.c to one in c-pragmas (most likely a cut & paste) with a struct type used locally to the TU. With C++ we need to rename the type to avoid an ODR violation. gcc/ChangeLog: * config/darwin-c.c (struct f_align_stack): Rename to type from align_stack to f_align_stack. (push_field_alignment): Likewise. (pop_field_alignment): Likewise. --- diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 9034f49908e..96172305711 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -44,13 +44,12 @@ static bool using_frameworks = false; static const char *find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp); -typedef struct align_stack -{ - int alignment; - struct align_stack * prev; -} align_stack; +struct fld_align_stack { + int alignment; + struct fld_align_stack * prev; +}; -static struct align_stack * field_align_stack = NULL; +static struct fld_align_stack * field_align_stack; /* Maintain a small stack of alignments. This is similar to pragma pack's stack, but simpler. */ @@ -58,7 +57,7 @@ static struct align_stack * field_align_stack = NULL; static void push_field_alignment (int bit_alignment) { - align_stack *entry = XNEW (align_stack); + fld_align_stack *entry = XNEW (fld_align_stack); entry->alignment = maximum_field_alignment; entry->prev = field_align_stack; @@ -72,7 +71,7 @@ pop_field_alignment (void) { if (field_align_stack) { - align_stack *entry = field_align_stack; + fld_align_stack *entry = field_align_stack; maximum_field_alignment = entry->alignment; field_align_stack = entry->prev;