public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Don't declare xmalloc and others in ldmisc.h
Date: Wed, 2 Aug 2023 07:59:06 +0930	[thread overview]
Message-ID: <ZMmHMgmgHhCauxSh@squeak.grove.modra.org> (raw)

	* ldmisc.h (xmalloc, xrealloc, xexit, yyerror): Don't declare.
	* emultempl/pdp11.em: Include libiberty.h.
	* emultempl/ticoff.em: Likewise.
	* emultempl/vms.em: Likewise.
	* ldctor.c: Likewise.
	* ldelfgen.c: Likewise.
	* ldgram.y: Likewise.
	(yyerror): Prototype and make static.

diff --git a/ld/emultempl/pdp11.em b/ld/emultempl/pdp11.em
index 8ff260a4c13..c6dbdeedd6a 100644
--- a/ld/emultempl/pdp11.em
+++ b/ld/emultempl/pdp11.em
@@ -21,6 +21,7 @@
 fragment <<EOF
 
 /* --- \begin{pdp11.em} */
+#include "libiberty.h"
 #include "getopt.h"
 
 static void
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 31abefe6674..8a3bfae7fcb 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -28,6 +28,7 @@ fragment <<EOF
 #define TARGET_IS_${EMULATION_NAME}
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfdlink.h"
 #include "ctf-api.h"
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 3d2cd4a56c7..1d90169e93d 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -22,6 +22,7 @@
 # This file is sourced from generic.em.
 
 fragment <<EOF
+#include "libiberty.h"
 #include "getopt.h"
 
 static void
diff --git a/ld/ldctor.c b/ld/ldctor.c
index 2f80aa02df6..936bf4a7977 100644
--- a/ld/ldctor.c
+++ b/ld/ldctor.c
@@ -20,6 +20,7 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfdlink.h"
 #include "safe-ctype.h"
diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c
index 8e4a188964e..62fce3e60fa 100644
--- a/ld/ldelfgen.c
+++ b/ld/ldelfgen.c
@@ -19,6 +19,7 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfdlink.h"
 #include "ctf-api.h"
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 9dbf10b2b1f..2b4b5070982 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -27,6 +27,7 @@
 #define DONTDECLARE_MALLOC
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfdlink.h"
 #include "ctf-api.h"
@@ -58,6 +59,8 @@ static char *error_names[ERROR_NAME_MAX];
 static int error_index;
 #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
 #define POP_ERROR()   error_index--;
+
+static void yyerror (const char *);
 %}
 %union {
   bfd_vma integer;
@@ -1506,9 +1509,8 @@ opt_semicolon:
 	;
 
 %%
-void
-yyerror(arg)
-     const char *arg;
+static void
+yyerror (const char *arg)
 {
   if (ldfile_assumed_script)
     einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
diff --git a/ld/ldmisc.h b/ld/ldmisc.h
index 6fbc4c7e687..5ab9157cdf8 100644
--- a/ld/ldmisc.h
+++ b/ld/ldmisc.h
@@ -27,10 +27,6 @@ extern void minfo (const char *, ...);
 extern void info_msg (const char *, ...);
 extern void lfinfo (FILE *, const char *, ...);
 extern void info_assert (const char *, unsigned int);
-extern void yyerror (const char *);
-extern void *xmalloc (size_t);
-extern void *xrealloc (void *, size_t);
-extern void xexit (int);
 
 #define ASSERT(x) \
 do { if (!(x)) info_assert(__FILE__,__LINE__); } while (0)

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2023-08-01 22:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMmHMgmgHhCauxSh@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).