diff options
author | Alan Modra <amodra@gmail.com> | 2020-12-15 22:10:27 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-12-16 15:17:53 +1030 |
commit | 342371d54cbbddf4342e1b261ad7c0941d7912d3 (patch) | |
tree | 4a04f06ce0a0f72dd55976679b28694d0570e9d2 /bfd/libxcoff.h | |
parent | 61d2295d723c7d202f530ccca1eacb4cfedf06d9 (diff) | |
download | gdb-342371d54cbbddf4342e1b261ad7c0941d7912d3.zip gdb-342371d54cbbddf4342e1b261ad7c0941d7912d3.tar.gz gdb-342371d54cbbddf4342e1b261ad7c0941d7912d3.tar.bz2 |
XCOFF constify
There are occasions where it is reasonable to use a macro defining
function parameters, but this isn't one of them. Use typedefs
instead, which also simplifies declaring a const array of function
pointers.
* libxcoff.h (struct xcoff_backend_data_rec): Constify
_xcoff_glink_code.
(XCOFF_RELOC_FUNCTION_ARGS, XCOFF_COMPLAIN_FUNCTION_ARGS): Delete.
(xcoff_reloc_function, xcoff_complain_function): New typedef.
(xcoff_calculate_relocation, xcoff_complain_overflow),
(xcoff_reloc_type_noop, xcoff_reloc_type_fail),
(xcoff_reloc_type_pos, xcoff_reloc_type_neg),
(xcoff_reloc_type_rel, xcoff_reloc_type_toc),
(xcoff_reloc_type_ba, xcoff_reloc_type_crel): Update declaration.
* coff-rs6000.c (xcoff_reloc_type_br): Declare using typedef.
(xcoff_complain_overflow_dont_func): Likewise.
(xcoff_complain_overflow_bitfield_func): Likewise.
(xcoff_complain_overflow_signed_func): Likewise.
(xcoff_complain_overflow_unsigned_func): Likewise.
(xcoff_calculate_relocation, xcoff_complain_overflow): Constify.
(xcoff_glink_code): Constify.
* coff64-rs6000.c (xcoff64_reloc_type_br): Declare using typedef.
(xcoff64_calculate_relocation, xcoff64_glink_code): Constify.
Diffstat (limited to 'bfd/libxcoff.h')
-rw-r--r-- | bfd/libxcoff.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h index cba9afd..c4b69ac 100644 --- a/bfd/libxcoff.h +++ b/bfd/libxcoff.h @@ -90,7 +90,7 @@ struct xcoff_backend_data_rec /* Global linkage. The first word of global linkage code must be be modified by filling in the correct TOC offset. */ - unsigned long *_xcoff_glink_code; + const unsigned long *_xcoff_glink_code; /* Size of the global link code in bytes of the xcoff_glink_code table. */ unsigned long _xcoff_glink_size; @@ -210,30 +210,30 @@ struct xcoff_backend_data_rec #endif #define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1) -#define XCOFF_RELOC_FUNCTION_ARGS \ - bfd *, asection *, bfd *, struct internal_reloc *, \ - struct internal_syment *, struct reloc_howto_struct *, bfd_vma, bfd_vma, \ - bfd_vma *relocation, bfd_byte *contents +typedef bfd_boolean xcoff_reloc_function (bfd *, asection *, bfd *, + struct internal_reloc *, + struct internal_syment *, + struct reloc_howto_struct *, + bfd_vma, bfd_vma, + bfd_vma *, bfd_byte *); -#define XCOFF_COMPLAIN_FUNCTION_ARGS \ - bfd *, bfd_vma, bfd_vma, struct reloc_howto_struct *howto +typedef bfd_boolean xcoff_complain_function (bfd *, bfd_vma, bfd_vma, + struct reloc_howto_struct *); -extern bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) - (XCOFF_RELOC_FUNCTION_ARGS); -extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW]) - (XCOFF_COMPLAIN_FUNCTION_ARGS); +extern xcoff_reloc_function *const xcoff_calculate_relocation[]; +extern xcoff_complain_function *const xcoff_complain_overflow[]; #define XCOFF_NO_LONG_SECTION_NAMES (FALSE), bfd_coff_set_long_section_names_disallowed /* Relocation functions */ -bfd_boolean xcoff_reloc_type_noop (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_fail (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_pos (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_neg (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_rel (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_toc (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_ba (XCOFF_RELOC_FUNCTION_ARGS); -bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS); +extern xcoff_reloc_function xcoff_reloc_type_noop; +extern xcoff_reloc_function xcoff_reloc_type_fail; +extern xcoff_reloc_function xcoff_reloc_type_pos; +extern xcoff_reloc_function xcoff_reloc_type_neg; +extern xcoff_reloc_function xcoff_reloc_type_rel; +extern xcoff_reloc_function xcoff_reloc_type_toc; +extern xcoff_reloc_function xcoff_reloc_type_ba; +extern xcoff_reloc_function xcoff_reloc_type_crel; /* Structure to describe dwarf sections. Useful to convert from XCOFF section name to flag and vice-versa. |