From 651fd56d1e09791b06592e1348d5d629b6918bc7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Aug 1999 23:31:14 +0000 Subject: * section.c (global_syms): Only initialize union field if __STDC__. --- bfd/ChangeLog | 5 +++++ bfd/section.c | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cb37a17c44a..96be6715cf6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +1999-08-06 Ian Lance Taylor + + * section.c (global_syms): Only initialize union field if + __STDC__. + 1999-08-04 Mark Mitchell * elf32-mips.c (mips_elf_got16_entry): Don't multiply GOT index by diff --git a/bfd/section.c b/bfd/section.c index 3e0aa2b2079..4f3edacb2ed 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -481,19 +481,27 @@ CODE_FRAGMENT . ((section->reloc_done) ? (section)->_cooked_size: (abort(),1)) */ +/* We use a macro to initialize the static asymbol structures because + traditional C does not permit us to initialize a union member while + gcc warns if we don't initialize it. */ + /* the_bfd, name, value, attr, section [, udata] */ +#ifdef __STDC__ +#define GLOBAL_SYM_INIT(NAME, SECTION) \ + { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }} +#else +#define GLOBAL_SYM_INIT(NAME, SECTION) \ + { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION } +#endif + /* These symbols are global, not specific to any BFD. Therefore, anything that tries to change them is broken, and should be repaired. */ + static const asymbol global_syms[] = { - /* the_bfd, name, value, attr, section [, udata] */ - {0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, - (asection *) &bfd_com_section, { 0 }}, - {0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, - (asection *) &bfd_und_section, { 0 }}, - {0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, - (asection *) &bfd_abs_section, { 0 }}, - {0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, - (asection *) &bfd_ind_section, { 0 }}, + GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section), + GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section), + GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section), + GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section) }; #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ -- cgit v1.2.1