summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cpperror.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/cpperror.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/cpperror.c')
-rw-r--r--contrib/gcc/cpperror.c105
1 files changed, 68 insertions, 37 deletions
diff --git a/contrib/gcc/cpperror.c b/contrib/gcc/cpperror.c
index c4cac06..c7339dc 100644
--- a/contrib/gcc/cpperror.c
+++ b/contrib/gcc/cpperror.c
@@ -1,5 +1,5 @@
/* Default error handlers for CPP Library.
- Copyright (C) 1986, 87, 89, 92 - 95, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1986, 87, 89, 92-95, 98, 1999 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -24,18 +24,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef EMACS
#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include "system.h"
-#include "gansidecl.h"
#else
#include <stdio.h>
#endif /* not EMACS */
#include "cpplib.h"
+#include "intl.h"
/* Print the file names and line numbers of the #include
commands which led to the current file. */
@@ -68,16 +63,16 @@ cpp_print_containing_files (pfile)
if (first)
{
first = 0;
- fprintf (stderr, "In file included");
+ cpp_notice ("In file included from %s:%ld",
+ ip->nominal_fname, line);
}
else
- fprintf (stderr, ",\n ");
+ cpp_message (pfile, -1, ",\n from %s:%ld",
+ ip->nominal_fname, line);
}
-
- fprintf (stderr, " from %s:%ld", ip->nominal_fname, line);
}
if (! first)
- fprintf (stderr, ":\n");
+ fputs (":\n", stderr);
/* Record we have printed the status as of this time. */
pfile->input_stack_listing_current = 1;
@@ -95,44 +90,58 @@ cpp_file_line_for_message (pfile, filename, line, column)
fprintf (stderr, "%s:%d: ", filename, line);
}
-/* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning */
+/* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning, -1 for notice */
void
-v_cpp_message (pfile, is_error, msg, ap)
+v_cpp_message (pfile, is_error, msgid, ap)
cpp_reader * pfile;
int is_error;
- const char *msg;
+ const char *msgid;
va_list ap;
{
- if (!is_error)
- fprintf (stderr, "warning: ");
- else if (is_error == 2)
- pfile->errors = CPP_FATAL_LIMIT;
- else if (pfile->errors < CPP_FATAL_LIMIT)
- pfile->errors++;
- vfprintf (stderr, msg, ap);
- fprintf (stderr, "\n");
+ switch (is_error)
+ {
+ case -1:
+ break;
+ case 0:
+ fprintf (stderr, _("warning: "));
+ break;
+ case 1:
+ if (pfile->errors < CPP_FATAL_LIMIT)
+ pfile->errors++;
+ break;
+ case 2:
+ pfile->errors = CPP_FATAL_LIMIT;
+ break;
+ default:
+ cpp_fatal (pfile, "internal error: bad is_error(%d) in v_cpp_message", is_error);
+ }
+
+ vfprintf (stderr, _(msgid), ap);
+
+ if (0 <= is_error)
+ fprintf (stderr, "\n");
}
void
-cpp_message VPROTO ((cpp_reader *pfile, int is_error, const char *msg, ...))
+cpp_message VPROTO ((cpp_reader *pfile, int is_error, const char *msgid, ...))
{
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
cpp_reader *pfile;
int is_error;
- const char *msg;
+ const char *msgid;
#endif
va_list ap;
- VA_START (ap, msg);
+ VA_START (ap, msgid);
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
pfile = va_arg (ap, cpp_reader *);
is_error = va_arg (ap, int);
- msg = va_arg (ap, const char *);
+ msgid = va_arg (ap, const char *);
#endif
- v_cpp_message(pfile, is_error, msg, ap);
+ v_cpp_message(pfile, is_error, msgid, ap);
va_end(ap);
}
@@ -143,23 +152,23 @@ cpp_message VPROTO ((cpp_reader *pfile, int is_error, const char *msg, ...))
CPP_FATAL_ERRORS. */
void
-cpp_fatal VPROTO ((cpp_reader *pfile, const char *str, ...))
+cpp_fatal VPROTO ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
cpp_reader *pfile;
- const char *str;
+ const char *msgid;
#endif
va_list ap;
- VA_START (ap, str);
+ VA_START (ap, msgid);
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
pfile = va_arg (ap, cpp_reader *);
- str = va_arg (ap, const char *);
+ msgid = va_arg (ap, const char *);
#endif
fprintf (stderr, "%s: ", progname);
- v_cpp_message (pfile, 2, str, ap);
+ v_cpp_message (pfile, 2, msgid, ap);
va_end(ap);
}
@@ -175,3 +184,25 @@ cpp_pfatal_with_name (pfile, name)
exit (FATAL_EXIT_CODE);
#endif
}
+
+/* Print an error message. */
+
+void
+cpp_notice VPROTO ((const char *msgid, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ const char *msgid;
+#endif
+ va_list ap;
+
+ VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+ msgid = va_arg (ap, const char *);
+#endif
+
+ fprintf (stderr, "%s: ", progname);
+ v_cpp_message ((cpp_reader *) 0, -1, msgid, ap);
+ va_end(ap);
+}
+
OpenPOWER on IntegriCloud