aboutsummaryrefslogtreecommitdiff
path: root/gcc/fix-header.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-11-11 15:50:52 +0000
committerRichard Stallman <rms@gnu.org>1993-11-11 15:50:52 +0000
commit10b8b0ba6971847336e0368bd2cdb62fe352767b (patch)
tree451c56f2432991194375b354d4045f81abda1d60 /gcc/fix-header.c
parentce95080d6da2a435c651a73c71caae6ff24f4412 (diff)
downloadgcc-10b8b0ba6971847336e0368bd2cdb62fe352767b.zip
gcc-10b8b0ba6971847336e0368bd2cdb62fe352767b.tar.gz
gcc-10b8b0ba6971847336e0368bd2cdb62fe352767b.tar.bz2
(fancy_abort): Defined.
(write_rbrac): When adding proto for memmove, put it inside #ifndef memmove. From-SVN: r6071
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 74a9688..3a08d93 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,