summaryrefslogtreecommitdiff
path: root/gcc/fix-header.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-11-11 15:50:52 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-11-11 15:50:52 +0000
commit54244b9001e63a5807d8a06298ccb74e6bf52fb4 (patch)
tree451c56f2432991194375b354d4045f81abda1d60 /gcc/fix-header.c
parent15de1a86684309f0b68e76f7b38bef51083876b0 (diff)
downloadgcc-54244b9001e63a5807d8a06298ccb74e6bf52fb4.tar.gz
(fancy_abort): Defined.
(write_rbrac): When adding proto for memmove, put it inside #ifndef memmove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6071 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fix-header.c')
-rw-r--r--gcc/fix-header.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index 74a96889b5d..3a08d9365f7 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -112,15 +112,26 @@ int seen_S_IFDIR = 0, seen_S_ISDIR = 0;
int seen_S_IFIFO = 0, seen_S_ISFIFO = 0;
int seen_S_IFLNK = 0, seen_S_ISLNK = 0;
int seen_S_IFREG = 0, seen_S_ISREG = 0;
-
+
/* Wrapper around free, to avoid prototype clashes. */
-void xfree (ptr)
+void
+xfree (ptr)
char *ptr;
{
free (ptr);
}
+/* Avoid error if config defines abort as fancy_abort.
+ It's not worth "really" implementing this because ordinary
+ compiler users never run fix-header. */
+
+void
+fancy_abort ()
+{
+ abort ();
+}
+
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
struct obstack scan_file_obstack;
@@ -360,11 +371,23 @@ write_rbrac ()
/* Now we print out prototypes for those functions that we haven't seen. */
for (rptr = required_functions; *rptr; rptr++)
{
+ int macro_protect = 0;
+
fn = lookup_std_proto (*rptr);
if (fn == NULL || !REQUIRED (fn))
continue;
+
+ /* In the case of memmove, protect in case the application
+ defines it as a macro before including the header. */
+ if (!strcmp (fn->fname, "memmove"))
+ macro_protect = 1;
+
+ if (macro_protect)
+ fprintf (outf, "#ifndef %s\n", fn->fname);
fprintf (outf, "extern %s %s (%s);\n",
fn->rtype, fn->fname, fn->params);
+ if (macro_protect)
+ fprintf (outf, "#endif\n");
}
if (required_unseen_count)
fprintf (outf,