summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/fix-header.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-10-16 06:09:09 +0000
committerobrien <obrien@FreeBSD.org>1999-10-16 06:09:09 +0000
commitcae8fa8120c70195f34a2456f18c4c848a2d3e0c (patch)
treef7d3a3ab9c32694206552e767626366f016f2062 /contrib/gcc/fix-header.c
parent84656b55b6e25e30322dc903a05de53706361d3d (diff)
downloadFreeBSD-src-cae8fa8120c70195f34a2456f18c4c848a2d3e0c.zip
FreeBSD-src-cae8fa8120c70195f34a2456f18c4c848a2d3e0c.tar.gz
Virgin import of the GCC 2.95.1 compilers
Diffstat (limited to 'contrib/gcc/fix-header.c')
-rw-r--r--contrib/gcc/fix-header.c140
1 files changed, 11 insertions, 129 deletions
diff --git a/contrib/gcc/fix-header.c b/contrib/gcc/fix-header.c
index 8ba79ff..af0577e 100644
--- a/contrib/gcc/fix-header.c
+++ b/contrib/gcc/fix-header.c
@@ -1,5 +1,5 @@
/* fix-header.c - Make C header file suitable for C++.
- Copyright (C) 1993, 94-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1993, 94-98, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -71,19 +71,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Written by Per Bothner <bothner@cygnus.com>, July 1993. */
#include "hconfig.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include "system.h"
-#include "gansidecl.h"
#include "obstack.h"
#include "scan.h"
#include "cpplib.h"
#include "cpphash.h"
-void fatal PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
+static void v_fatal PROTO ((const char *, va_list)) ATTRIBUTE_NORETURN;
+void fatal PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
sstring buf;
@@ -341,7 +336,7 @@ setgid\0setpgid\0setsid\0setuid\0sleep\0sysconf\0tcgetpgrp\0tcsetpgrp\0\
ttyname\0unlink\0write\0" },
{ CONTINUED, POSIX2_SYMBOL, "getopt\0" },
{ CONTINUED, XOPEN_EXTENDED_SYMBOL,
- "lockf\0gethostid\0gethostname\0readlink\0" },
+ "lockf\0gethostid\0gethostname\0readlink\0symlink\0" },
{ "utime.h", POSIX1_SYMBOL, "utime\0" },
@@ -372,16 +367,6 @@ xfree (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;
@@ -401,7 +386,7 @@ lookup_std_proto (name, name_length)
if (hash_tab[i] == 0)
return NULL;
fn = &std_protos[hash_tab[i]];
- if (strlen (fn->fname) == name_length
+ if ((int) strlen (fn->fname) == name_length
&& strncmp (fn->fname, name, name_length) == 0)
return fn;
i = (i+1) % HASH_SIZE;
@@ -637,7 +622,7 @@ read_scan_file (in_fname, argc, argv)
obstack_init (&scan_file_obstack);
cpp_reader_init (&scan_in);
- scan_in.data = &scan_options;
+ scan_in.opts = &scan_options;
cpp_options_init (&scan_options);
i = cpp_handle_options (&scan_in, argc, argv);
if (i < argc && ! CPP_FATAL_ERRORS (&scan_in))
@@ -697,7 +682,7 @@ read_scan_file (in_fname, argc, argv)
/* Append "_filbuf" and/or "_flsbuf" to the required functions. */
if (need_filbuf + need_flsbuf)
{
- char *new_list;
+ const char *new_list;
if (need_filbuf)
SET_REQUIRED (fn);
if (need_flsbuf)
@@ -876,15 +861,6 @@ write_rbrac ()
#endif
}
-char *
-xstrdup (str)
- char *str;
-{
- char *copy = (char *) xmalloc (strlen (str) + 1);
- strcpy (copy, str);
- return copy;
-}
-
/* Returns 1 iff the file is properly protected from multiple inclusion:
#ifndef PROTECT_NAME
#define PROTECT_NAME
@@ -1151,7 +1127,7 @@ main (argc, argv)
special_file_handling = stdio_h;
include_entry = std_include_table;
while (include_entry->name != NULL
- && (include_entry->name == CONTINUED
+ && ((strcmp (include_entry->name, CONTINUED) == 0)
|| strcmp (inc_filename, include_entry->name) != 0))
include_entry++;
@@ -1164,7 +1140,7 @@ main (argc, argv)
if (entry->flags)
add_symbols (entry->flags, entry->names);
entry++;
- if (entry->name != CONTINUED)
+ if (strcmp (entry->name, CONTINUED) != 0)
break;
}
}
@@ -1325,71 +1301,6 @@ main (argc, argv)
return 0;
}
-/* Stub error functions. These replace cpperror.c,
- because we want to suppress error messages. */
-
-void
-cpp_file_line_for_message (pfile, filename, line, column)
- cpp_reader * pfile;
- char *filename;
- int line, column;
-{
- if (!verbose)
- return;
- if (column > 0)
- fprintf (stderr, "%s:%d:%d: ", filename, line, column);
- else
- fprintf (stderr, "%s:%d: ", filename, line);
-}
-
-void
-cpp_print_containing_files (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
-{
-}
-
-/* IS_ERROR is 2 for fatal error, 1 for error, 0 for warning */
-
-void
-v_cpp_message (pfile, is_error, msg, ap)
- cpp_reader *pfile;
- int is_error;
- const char *msg;
- va_list ap;
-{
- if (is_error == 1)
- pfile->errors++;
- else if (is_error > 1)
- pfile->errors = CPP_FATAL_LIMIT;
- if (!verbose)
- return;
- if (!is_error)
- fprintf (stderr, "warning: ");
- vfprintf (stderr, msg, ap);
- fprintf (stderr, "\n");
-}
-
-void
-cpp_message VPROTO ((cpp_reader *pfile, int is_error, const char *msg, ...))
-{
-#ifndef __STDC__
- cpp_reader *pfile;
- int is_error;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-
-#ifndef __STDC__
- pfile = va_arg (ap, cpp_reader *);
- is_error = va_arg (ap, const int);
- msg = va_arg (ap, const char *);
-#endif
-
- v_cpp_message(pfile, is_error, msg, ap);
- va_end(ap);
-}
static void
v_fatal (str, ap)
@@ -1406,46 +1317,17 @@ v_fatal (str, ap)
void
fatal VPROTO ((const char *str, ...))
{
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
const char *str;
#endif
va_list ap;
VA_START(ap, str);
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
str = va_arg (ap, const char *);
#endif
v_fatal(str, ap);
va_end(ap);
}
-
-void
-cpp_fatal VPROTO ((cpp_reader * pfile, const char *str, ...))
-{
-#ifndef __STDC__
- cpp_reader * pfile;
- const char *str;
-#endif
- va_list ap;
-
- VA_START(ap, str);
-
-#ifndef __STDC__
- pfile = va_arg (ap, cpp_reader *);
- str = va_arg (ap, const char *);
-#endif
-
- v_fatal(str, ap);
- va_end(ap);
-}
-
-void
-cpp_pfatal_with_name (pfile, name)
- cpp_reader *pfile;
- const char *name;
-{
- cpp_perror_with_name (pfile, name);
- exit (FATAL_EXIT_CODE);
-}
OpenPOWER on IntegriCloud