binutils fails to compile on AIX due to mismatched declaration

Alan Modra
Wed Mar 3 22:31:34 GMT 2021

On Wed, Mar 03, 2021 at 02:48:52PM -0400, Calvin Buckley wrote:
> The declaration for a function is incorrect; the implementation of it
> is missing a const. Adding a const to the implementation (line 335) is
> enough to fix this particular issue.
> rs6000-core.c:280:19: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
>  const bfd_cleanup rs6000coff_core_p (bfd *abfd);
>                    ^~~~~~~~~~~~~~~~~
> rs6000-core.c:336:1: error: conflicting types for 'rs6000coff_core_p'
>  rs6000coff_core_p (bfd *abfd)
>  ^~~~~~~~~~~~~~~~~
> rs6000-core.c:280:19: note: previous declaration of 'rs6000coff_core_p' was here
>  const bfd_cleanup rs6000coff_core_p (bfd *abfd);

rs6000-core.c is a file that uses AIX host headers so most people,
including me, don't compile it.  That's the excuse I'm sticking with.


	* rs6000-core.c (rs6000coff_core_p): Correct prototype.

diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 9fed1ff48b..1c19060a5d 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -277,7 +277,7 @@ typedef union
 /* Define prototypes for certain functions, to avoid a compiler warning
    saying that they are missing.  */
-const bfd_cleanup rs6000coff_core_p (bfd *abfd);
+bfd_cleanup rs6000coff_core_p (bfd *abfd);
 bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *core_bfd,
 						       bfd *exec_bfd);
 char * rs6000coff_core_file_failing_command (bfd *abfd);

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list