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.
This commit is contained in:
Iain Sandoe 2020-11-22 11:19:32 +00:00
parent 7a97e2fcf7
commit 3c52cd517a

View File

@ -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;