Use __func__ rather than __FUNCTION__

We already use C99's __func__ in places, use it more generally.  This
patch doesn't change uses in the testsuite.  I've also left one in
gold.h that is protected by GCC_VERSION < 4003.  If any of the
remaining uses bothers anyone I invite patches.

bfd/
	* bfd-in.h: Replace __FUNCTION__ with __func__.
	* elf32-bfin.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-cris.c: Replace __FUNCTION__ with __func__.
	* config/tc-m68hc11.c: Likewise.
	* config/tc-msp430.c: Likewise.
gold/
	* dwp.h: Replace __FUNCTION__ with __func__.
	* gold.h: Likewise, except for use inside GCC_VERSION < 4003.
ld/
	* emultempl/pe.em: Replace __FUNCTION__ with __func__.
	* emultempl/pep.em: Likewise.
	* pe-dll.c: Likewise.
This commit is contained in:
Alan Modra
2023-01-12 16:46:23 +10:30
parent 2070fc67ba
commit 4981a31d52
13 changed files with 33 additions and 34 deletions

View File

@ -365,10 +365,10 @@ extern int bfd_stat (bfd *, struct stat *);
/* Deprecated old routines. */ /* Deprecated old routines. */
#if __GNUC__ #if __GNUC__
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
(_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __func__), \
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
(_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __func__), \
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#else #else
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \

View File

@ -372,10 +372,10 @@ extern int bfd_stat (bfd *, struct stat *);
/* Deprecated old routines. */ /* Deprecated old routines. */
#if __GNUC__ #if __GNUC__
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
(_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __func__), \
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
(_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __func__), \
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#else #else
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \

View File

@ -4917,8 +4917,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
&& (info->symbolic && (info->symbolic
|| h->dynindx == -1 || h->forced_local) && h->def_regular) || h->dynindx == -1 || h->forced_local) && h->def_regular)
{ {
_bfd_error_handler (_("*** check this relocation %s"), _bfd_error_handler (_("*** check this relocation %s"), __func__);
__FUNCTION__);
rela.r_info = ELF32_R_INFO (0, R_BFIN_PCREL24); rela.r_info = ELF32_R_INFO (0, R_BFIN_PCREL24);
rela.r_addend = bfd_get_signed_32 (output_bfd, rela.r_addend = bfd_get_signed_32 (output_bfd,
(sgot->contents (sgot->contents

View File

@ -5539,7 +5539,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
/* xgettext:c-format */ /* xgettext:c-format */
(_("%pB: relocation %s against STT_GNU_IFUNC " (_("%pB: relocation %s against STT_GNU_IFUNC "
"symbol `%s' isn't handled by %s"), input_bfd, "symbol `%s' isn't handled by %s"), input_bfd,
howto->name, name, __FUNCTION__); howto->name, name, __func__);
bfd_set_error (bfd_error_bad_value); bfd_set_error (bfd_error_bad_value);
return bfd_reloc_notsupported; return bfd_reloc_notsupported;

View File

@ -3021,7 +3021,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
(_("%pB: relocation %s against STT_GNU_IFUNC " (_("%pB: relocation %s against STT_GNU_IFUNC "
"symbol `%s' isn't handled by %s"), input_bfd, "symbol `%s' isn't handled by %s"), input_bfd,
_bfd_sparc_elf_howto_table[r_type].name, _bfd_sparc_elf_howto_table[r_type].name,
name, __FUNCTION__); name, __func__);
bfd_set_error (bfd_error_bad_value); bfd_set_error (bfd_error_bad_value);
return false; return false;
} }

View File

@ -548,11 +548,11 @@ cris_relax_frag (segT seg ATTRIBUTE_UNUSED, fragS *fragP,
if (fragP->fr_symbol == NULL if (fragP->fr_symbol == NULL
|| S_GET_SEGMENT (fragP->fr_symbol) != absolute_section) || S_GET_SEGMENT (fragP->fr_symbol) != absolute_section)
as_fatal (_("internal inconsistency problem in %s: fr_symbol %lx"), as_fatal (_("internal inconsistency problem in %s: fr_symbol %lx"),
__FUNCTION__, (long) fragP->fr_symbol); __func__, (long) fragP->fr_symbol);
symbolP = fragP->fr_symbol; symbolP = fragP->fr_symbol;
if (symbol_resolved_p (symbolP)) if (symbol_resolved_p (symbolP))
as_fatal (_("internal inconsistency problem in %s: resolved symbol"), as_fatal (_("internal inconsistency problem in %s: resolved symbol"),
__FUNCTION__); __func__);
aim = S_GET_VALUE (symbolP); aim = S_GET_VALUE (symbolP);
break; break;
@ -562,7 +562,7 @@ cris_relax_frag (segT seg ATTRIBUTE_UNUSED, fragS *fragP,
default: default:
as_fatal (_("internal inconsistency problem in %s: fr_subtype %d"), as_fatal (_("internal inconsistency problem in %s: fr_subtype %d"),
__FUNCTION__, fragP->fr_subtype); __func__, fragP->fr_subtype);
} }
/* The rest is stolen from relax_frag. There's no obvious way to /* The rest is stolen from relax_frag. There's no obvious way to
@ -962,7 +962,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE): case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE):
if (symbolP == NULL) if (symbolP == NULL)
as_fatal (_("internal inconsistency in %s: bdapq no symbol"), as_fatal (_("internal inconsistency in %s: bdapq no symbol"),
__FUNCTION__); __func__);
opcodep[0] = S_GET_VALUE (symbolP); opcodep[0] = S_GET_VALUE (symbolP);
var_part_size = 0; var_part_size = 0;
break; break;
@ -975,7 +975,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
opcodep[1] |= BDAP_INCR_HIGH; opcodep[1] |= BDAP_INCR_HIGH;
if (symbolP == NULL) if (symbolP == NULL)
as_fatal (_("internal inconsistency in %s: bdap.w with no symbol"), as_fatal (_("internal inconsistency in %s: bdap.w with no symbol"),
__FUNCTION__); __func__);
md_number_to_chars (var_partp, S_GET_VALUE (symbolP), 2); md_number_to_chars (var_partp, S_GET_VALUE (symbolP), 2);
var_part_size = 2; var_part_size = 2;
break; break;
@ -4237,7 +4237,7 @@ s_cris_dtpoff (int bytes)
if (bytes != 4) if (bytes != 4)
as_fatal (_("internal inconsistency problem: %s called for %d bytes"), as_fatal (_("internal inconsistency problem: %s called for %d bytes"),
__FUNCTION__, bytes); __func__, bytes);
expression (&ex); expression (&ex);

View File

@ -3892,17 +3892,17 @@ m68hc11_relax_frag (segT seg ATTRIBUTE_UNUSED, fragS *fragP,
if (fragP->fr_symbol == NULL if (fragP->fr_symbol == NULL
|| S_GET_SEGMENT (fragP->fr_symbol) != absolute_section) || S_GET_SEGMENT (fragP->fr_symbol) != absolute_section)
as_fatal (_("internal inconsistency problem in %s: fr_symbol %lx"), as_fatal (_("internal inconsistency problem in %s: fr_symbol %lx"),
__FUNCTION__, (long) fragP->fr_symbol); __func__, (long) fragP->fr_symbol);
symbolP = fragP->fr_symbol; symbolP = fragP->fr_symbol;
if (symbol_resolved_p (symbolP)) if (symbol_resolved_p (symbolP))
as_fatal (_("internal inconsistency problem in %s: resolved symbol"), as_fatal (_("internal inconsistency problem in %s: resolved symbol"),
__FUNCTION__); __func__);
aim = S_GET_VALUE (symbolP); aim = S_GET_VALUE (symbolP);
break; break;
default: default:
as_fatal (_("internal inconsistency problem in %s: fr_subtype %d"), as_fatal (_("internal inconsistency problem in %s: fr_subtype %d"),
__FUNCTION__, fragP->fr_subtype); __func__, fragP->fr_subtype);
} }
/* The rest is stolen from relax_frag. There's no obvious way to /* The rest is stolen from relax_frag. There's no obvious way to

View File

@ -4868,7 +4868,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
if (!cc || !cc->name) if (!cc || !cc->name)
as_fatal (_("internal inconsistency problem in %s: insn %04lx"), as_fatal (_("internal inconsistency problem in %s: insn %04lx"),
__FUNCTION__, (long) insn); __func__, (long) insn);
where = fragP->fr_literal + fragP->fr_fix; where = fragP->fr_literal + fragP->fr_fix;
bfd_putl16 (cc->lop0, where); bfd_putl16 (cc->lop0, where);
bfd_putl16 (cc->lop1, where + 2); bfd_putl16 (cc->lop1, where + 2);
@ -4910,7 +4910,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
} }
if (!hc || !hc->name) if (!hc || !hc->name)
as_fatal (_("internal inconsistency problem in %s: ext. insn %04lx"), as_fatal (_("internal inconsistency problem in %s: ext. insn %04lx"),
__FUNCTION__, (long) insn); __func__, (long) insn);
rela = BFD_RELOC_MSP430_10_PCREL; rela = BFD_RELOC_MSP430_10_PCREL;
/* Apply a fix for a first label if necessary. /* Apply a fix for a first label if necessary.
another fix will be applied to the next word of insn anyway. */ another fix will be applied to the next word of insn anyway. */
@ -4942,7 +4942,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
} }
if (!hc || !hc->name) if (!hc || !hc->name)
as_fatal (_("internal inconsistency problem in %s: ext. insn %04lx"), as_fatal (_("internal inconsistency problem in %s: ext. insn %04lx"),
__FUNCTION__, (long) insn); __func__, (long) insn);
rela = BFD_RELOC_MSP430_RL_PCREL; rela = BFD_RELOC_MSP430_RL_PCREL;
where = fragP->fr_literal + fragP->fr_fix; where = fragP->fr_literal + fragP->fr_fix;
bfd_putl16 (hc->lop0, where); bfd_putl16 (hc->lop0, where);
@ -4954,7 +4954,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
default: default:
as_fatal (_("internal inconsistency problem in %s: %lx"), as_fatal (_("internal inconsistency problem in %s: %lx"),
__FUNCTION__, (long) fragP->fr_subtype); __func__, (long) fragP->fr_subtype);
break; break;
} }
@ -4991,7 +4991,7 @@ msp430_relax_frag (segT seg ATTRIBUTE_UNUSED, fragS * fragP,
symbolP = fragP->fr_symbol; symbolP = fragP->fr_symbol;
if (symbol_resolved_p (symbolP)) if (symbol_resolved_p (symbolP))
as_fatal (_("internal inconsistency problem in %s: resolved symbol"), as_fatal (_("internal inconsistency problem in %s: resolved symbol"),
__FUNCTION__); __func__);
/* We know the offset. calculate a distance. */ /* We know the offset. calculate a distance. */
aim = S_GET_VALUE (symbolP) - fragP->fr_address - fragP->fr_fix; aim = S_GET_VALUE (symbolP) - fragP->fr_address - fragP->fr_fix;
} }

View File

@ -94,7 +94,7 @@ gold_info(const char* msg, ...) ATTRIBUTE_PRINTF_1;
#define gold_unreachable() \ #define gold_unreachable() \
(gold::do_gold_unreachable(__FILE__, __LINE__, \ (gold::do_gold_unreachable(__FILE__, __LINE__, \
static_cast<const char*>(__FUNCTION__))) static_cast<const char*>(__func__)))
extern void do_gold_unreachable(const char*, int, const char*) extern void do_gold_unreachable(const char*, int, const char*)
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;

View File

@ -163,7 +163,7 @@ gold_nomem() ATTRIBUTE_NORETURN;
#if defined(__GNUC__) && GCC_VERSION < 4003 #if defined(__GNUC__) && GCC_VERSION < 4003
#define FUNCTION_NAME static_cast<const char*>(__FUNCTION__) #define FUNCTION_NAME static_cast<const char*>(__FUNCTION__)
#else #else
#define FUNCTION_NAME __FUNCTION__ #define FUNCTION_NAME __func__
#endif #endif
// This macro and function are used in cases which can not arise if // This macro and function are used in cases which can not arise if

View File

@ -1188,7 +1188,7 @@ pe_fixup_stdcalls (void)
struct bfd_link_hash_entry *undef, *sym; struct bfd_link_hash_entry *undef, *sym;
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s\n", __FUNCTION__); printf ("%s\n", __func__);
for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next) for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next)
if (undef->type == bfd_link_hash_undefined) if (undef->type == bfd_link_hash_undefined)
@ -1461,7 +1461,7 @@ gld${EMULATION_NAME}_after_open (void)
bfd *a; bfd *a;
struct bfd_link_hash_entry *sym; struct bfd_link_hash_entry *sym;
printf ("%s()\n", __FUNCTION__); printf ("%s()\n", __func__);
for (sym = link_info.hash->undefs; sym; sym=sym->u.undef.next) for (sym = link_info.hash->undefs; sym; sym=sym->u.undef.next)
printf ("-%s\n", sym->root.string); printf ("-%s\n", sym->root.string);

View File

@ -1122,7 +1122,7 @@ pep_fixup_stdcalls (void)
struct bfd_link_hash_entry *undef, *sym; struct bfd_link_hash_entry *undef, *sym;
if (pep_dll_extra_pe_debug) if (pep_dll_extra_pe_debug)
printf ("%s\n", __FUNCTION__); printf ("%s\n", __func__);
for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next) for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next)
if (undef->type == bfd_link_hash_undefined) if (undef->type == bfd_link_hash_undefined)
@ -1466,7 +1466,7 @@ gld${EMULATION_NAME}_after_open (void)
bfd *a; bfd *a;
struct bfd_link_hash_entry *sym; struct bfd_link_hash_entry *sym;
printf ("%s()\n", __FUNCTION__); printf ("%s()\n", __func__);
for (sym = link_info.hash->undefs; sym; sym=sym->u.undef.next) for (sym = link_info.hash->undefs; sym; sym=sym->u.undef.next)
printf ("-%s\n", sym->root.string); printf ("-%s\n", sym->root.string);

View File

@ -1421,7 +1421,7 @@ pe_find_data_imports (const char *symhead,
char *impname; char *impname;
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s:%s\n", __FUNCTION__, undef->root.string); printf ("%s:%s\n", __func__, undef->root.string);
strcpy (name, undef->root.string); strcpy (name, undef->root.string);
impname = name - (sizeof "__imp_" - 1); impname = name - (sizeof "__imp_" - 1);
@ -3501,7 +3501,7 @@ pe_implied_import_dll (const char *filename)
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n", printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n",
__FUNCTION__, sec_name, (unsigned long) vaddr, __func__, sec_name, (unsigned long) vaddr,
(unsigned long) (vaddr + vsize), (unsigned long) flags); (unsigned long) (vaddr + vsize), (unsigned long) flags);
} }
else if (strcmp(sec_name,".rdata") == 0) else if (strcmp(sec_name,".rdata") == 0)
@ -3511,7 +3511,7 @@ pe_implied_import_dll (const char *filename)
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n", printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n",
__FUNCTION__, sec_name, (unsigned long) vaddr, __func__, sec_name, (unsigned long) vaddr,
(unsigned long) (vaddr + vsize), (unsigned long) flags); (unsigned long) (vaddr + vsize), (unsigned long) flags);
} }
else if (strcmp (sec_name,".bss") == 0) else if (strcmp (sec_name,".bss") == 0)
@ -3521,7 +3521,7 @@ pe_implied_import_dll (const char *filename)
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n", printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n",
__FUNCTION__, sec_name, (unsigned long) vaddr, __func__, sec_name, (unsigned long) vaddr,
(unsigned long) (vaddr + vsize), (unsigned long) flags); (unsigned long) (vaddr + vsize), (unsigned long) flags);
} }
} }
@ -3579,7 +3579,7 @@ pe_implied_import_dll (const char *filename)
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n", printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n",
__FUNCTION__, dllname, erva + name_rva, __func__, dllname, erva + name_rva,
(unsigned long) func_rva, is_data ? "(data)" : ""); (unsigned long) func_rva, is_data ? "(data)" : "");
} }
@ -3616,7 +3616,7 @@ pe_implied_import_dll (const char *filename)
if (pe_dll_extra_pe_debug) if (pe_dll_extra_pe_debug)
printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n", printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n",
__FUNCTION__, dllname, erva + name_rva, __func__, dllname, erva + name_rva,
(unsigned long) func_rva, is_data ? "(data)" : ""); (unsigned long) func_rva, is_data ? "(data)" : "");
} }
} }