aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog38
-rw-r--r--libcpp/Makefile.in19
-rw-r--r--libcpp/directives.c9
-rw-r--r--libcpp/errors.c170
-rw-r--r--libcpp/include/cpplib.h69
-rw-r--r--libcpp/include/line-map.h8
-rw-r--r--libcpp/init.c13
-rw-r--r--libcpp/internal.h7
-rw-r--r--libcpp/line-map.c41
-rw-r--r--libcpp/macro.c12
-rw-r--r--libcpp/makedepend.c206
-rw-r--r--libcpp/po/ChangeLog8
-rw-r--r--libcpp/po/cpplib.pot33
-rw-r--r--libcpp/po/es.po32
14 files changed, 158 insertions, 507 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index d86092b677c..a9841c7314d 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,41 @@
+2009-03-29 Joseph Myers <joseph@codesourcery.com>
+
+ PR preprocessor/34695
+ * makedepend.c: Remove.
+ * Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
+ (all, clean, TAGS_SOURCES, include): Remove makedepend handling.
+ * directives.c (cpp_errors): Remove.
+ * errors.c (print_location, _cpp_begin_message, v_message):
+ Remove.
+ (cpp_error, cpp_error_with_line): Always use error callback.
+ (cpp_error, cpp_error_with_line, cpp_errno): Return bool.
+ * include/cpplib.h (cpp_options): Remove pedantic_errors,
+ inhibit_warnings, warn_system_headers, inhibit_errors,
+ warnings_are_errors, client_diagnostic.
+ (cpp_callbacks): Add extra arguments to error callback; make it
+ return bool.
+ (cpp_finish): Return void.
+ (cpp_destroy): Remove inaccurate comment about return value.
+ (cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
+ (CPP_DL_NOTE): Define.
+ * include/line-map.h (linemap_print_containing_files): Remove.
+ * init.c (cpp_finish): Do not check for or return number of
+ errors.
+ * internal.h (cpp_reader): Remove errors field.
+ * line-map.c (linemap_print_containing_files): Remove.
+ * macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
+ about previous definition. Only emit it if previous diagnostic
+ was emitted.
+
+2009-03-28 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.in (po/$(PACKAGE).pot): Use $(mkinstalldirs) not
+ mkinstalldirs.
+
+2009-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ * include/cpplib.h (struct cpp_dir): Reorder fields for 64-bit hosts.
+
2009-02-21 Joseph Myers <joseph@codesourcery.com>
* lex.c (lex_string): Return a CPP_LESS token for missing '>' in a
diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
index 2d82ebdd8b3..8d99d721a64 100644
--- a/libcpp/Makefile.in
+++ b/libcpp/Makefile.in
@@ -1,7 +1,7 @@
# @configure_input@
# Makefile for libcpp. Run 'configure' to generate Makefile from Makefile.in
-# Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc.
#This file is part of libcpp.
@@ -73,13 +73,12 @@ ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
libcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
mkdeps.o pch.o symtab.o traditional.o
-makedepend_OBJS = makedepend.o
libcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
mkdeps.c pch.c symtab.c traditional.c
-all: libcpp.a makedepend$(EXEEXT) $(USED_CATALOGS)
+all: libcpp.a $(USED_CATALOGS)
.SUFFIXES:
.SUFFIXES: .c .gmo .o .obj .po .pox
@@ -89,12 +88,6 @@ libcpp.a: $(libcpp_a_OBJS)
$(AR) $(ARFLAGS) libcpp.a $(libcpp_a_OBJS)
$(RANLIB) libcpp.a
-makedepend$(EXEEXT): $(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a
- @rm -f makedepend$(EXEEXT)
- $(CC) $(CFLAGS) $(LDFLAGS) -o makedepend$(EXEEXT) \
- $(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a \
- $(LIBINTL) $(LIBICONV)
-
# Rules to rebuild the configuration
Makefile: $(srcdir)/Makefile.in config.status
@@ -166,7 +159,7 @@ mostlyclean:
-rm -f *.o
clean: mostlyclean
- -rm -rf makedepend$(EXEEXT) libcpp.a $(srcdir)/autom4te.cache
+ -rm -rf libcpp.a $(srcdir)/autom4te.cache
distclean: clean
-rm -f config.h stamp-h1 config.status config.cache config.log \
@@ -236,7 +229,7 @@ endif
# Rule for regenerating the message template.
$(PACKAGE).pot: po/$(PACKAGE).pot
po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
- mkinstalldirs $(srcdir)/po
+ $(mkinstalldirs) $(srcdir)/po
$(XGETTEXT) --default-domain=$(PACKAGE) \
--keyword=_ --keyword=N_ \
--keyword=cpp_error:3 --keyword=cpp_errno:3 \
@@ -248,7 +241,7 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
sed 's:$(srcdir)/::g' <po/$(PACKAGE).pot.tmp >po/$(PACKAGE).pot
rm po/$(PACKAGE).pot.tmp
-TAGS_SOURCES = $(libcpp_a_SOURCES) makedepend.c internal.h ucnid.h \
+TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \
include/line-map.h include/symtab.h include/cpp-id-data.h \
include/cpplib.h include/mkdeps.h system.h
@@ -260,7 +253,7 @@ TAGS: $(TAGS_SOURCES)
.NOEXPORT:
# Dependencies
--include $(patsubst %.o, $(DEPDIR)/%.Po, $(libcpp_a_OBJS) $(makedepend_OBJS))
+-include $(patsubst %.o, $(DEPDIR)/%.Po, $(libcpp_a_OBJS))
# Dependencies on generated headers have to be explicit.
init.o: localedir.h
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 9e0744b23d9..f9e0fc2e6bc 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1,7 +1,7 @@
/* CPP Library. (Directive handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2007, 2008 Free Software Foundation, Inc.
+ 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -2299,13 +2299,6 @@ handle_assertion (cpp_reader *pfile, const char *str, int type)
run_directive (pfile, type, str, count);
}
-/* The number of errors for a given reader. */
-unsigned int
-cpp_errors (cpp_reader *pfile)
-{
- return pfile->errors;
-}
-
/* The options structure. */
cpp_options *
cpp_get_options (cpp_reader *pfile)
diff --git a/libcpp/errors.c b/libcpp/errors.c
index e3d56292848..c053f39355a 100644
--- a/libcpp/errors.c
+++ b/libcpp/errors.c
@@ -1,6 +1,6 @@
/* Default error handlers for CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
- 2001, 2002, 2004, 2008 Free Software Foundation, Inc.
+ 2001, 2002, 2004, 2008, 2009 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
@@ -28,171 +28,69 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "cpplib.h"
#include "internal.h"
-static void print_location (cpp_reader *, source_location, unsigned int);
-
-/* Print the logical file location (LINE, COL) in preparation for a
- diagnostic. Outputs the #include chain if it has changed. A line
- of zero suppresses the include stack, and outputs the program name
- instead. */
-static void
-print_location (cpp_reader *pfile, source_location line, unsigned int col)
-{
- if (line == 0)
- fprintf (stderr, "%s: ", progname);
- else
- {
- const struct line_map *map;
- linenum_type lin;
-
- map = linemap_lookup (pfile->line_table, line);
- linemap_print_containing_files (pfile->line_table, map);
-
- lin = SOURCE_LINE (map, line);
- if (col == 0)
- {
- col = SOURCE_COLUMN (map, line);
- if (col == 0)
- col = 1;
- }
-
- if (lin == 0)
- fprintf (stderr, "%s:", map->to_file);
- else if (CPP_OPTION (pfile, show_column) == 0)
- fprintf (stderr, "%s:%u:", map->to_file, lin);
- else
- fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
-
- fputc (' ', stderr);
- }
-}
-
-/* Set up for a diagnostic: print the file and line, bump the error
- counter, etc. SRC_LOC is the logical line number; zero means to print
- at the location of the previously lexed token, which tends to be
- the correct place by default. The column number can be specified either
- using COLUMN or (if COLUMN==0) extracting SOURCE_COLUMN from SRC_LOC.
- (This may seem redundant, but is useful when pre-scanning (cleaning) a line,
- when we haven't yet verified whether the current line_map has a
- big enough max_column_hint.)
-
- Returns 0 if the error has been suppressed. */
-static int
-_cpp_begin_message (cpp_reader *pfile, int code,
- source_location src_loc, unsigned int column)
-{
- int level = CPP_DL_EXTRACT (code);
-
- switch (level)
- {
- case CPP_DL_WARNING:
- case CPP_DL_PEDWARN:
- if (cpp_in_system_header (pfile)
- && ! CPP_OPTION (pfile, warn_system_headers))
- return 0;
- /* Fall through. */
-
- case CPP_DL_WARNING_SYSHDR:
- if (CPP_OPTION (pfile, warnings_are_errors)
- || (level == CPP_DL_PEDWARN && CPP_OPTION (pfile, pedantic_errors)))
- {
- if (CPP_OPTION (pfile, inhibit_errors))
- return 0;
- level = CPP_DL_ERROR;
- pfile->errors++;
- }
- else if (CPP_OPTION (pfile, inhibit_warnings))
- return 0;
- break;
-
- case CPP_DL_ERROR:
- if (CPP_OPTION (pfile, inhibit_errors))
- return 0;
- /* ICEs cannot be inhibited. */
- case CPP_DL_ICE:
- pfile->errors++;
- break;
- }
-
- print_location (pfile, src_loc, column);
- if (CPP_DL_WARNING_P (level))
- fputs (_("warning: "), stderr);
- else if (level == CPP_DL_ICE)
- fputs (_("internal error: "), stderr);
- else
- fputs (_("error: "), stderr);
-
- return 1;
-}
-
-/* Don't remove the blank before do, as otherwise the exgettext
- script will mistake this as a function definition */
-#define v_message(msgid, ap) \
- do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
-
-/* Exported interface. */
-
/* Print an error at the location of the previously lexed token. */
-void
+bool
cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
{
source_location src_loc;
va_list ap;
-
+ bool ret;
+
va_start (ap, msgid);
- if (CPP_OPTION (pfile, client_diagnostic))
- pfile->cb.error (pfile, level, _(msgid), &ap);
- else
+ if (CPP_OPTION (pfile, traditional))
{
- if (CPP_OPTION (pfile, traditional))
- {
- if (pfile->state.in_directive)
- src_loc = pfile->directive_line;
- else
- src_loc = pfile->line_table->highest_line;
- }
- /* We don't want to refer to a token before the beginning of the
- current run -- that is invalid. */
- else if (pfile->cur_token == pfile->cur_run->base)
- {
- if (pfile->cur_run->prev != NULL)
- src_loc = pfile->cur_run->prev->limit->src_loc;
- else
- src_loc = 0;
- }
+ if (pfile->state.in_directive)
+ src_loc = pfile->directive_line;
else
- {
- src_loc = pfile->cur_token[-1].src_loc;
- }
-
- if (_cpp_begin_message (pfile, level, src_loc, 0))
- v_message (msgid, ap);
+ src_loc = pfile->line_table->highest_line;
+ }
+ /* We don't want to refer to a token before the beginning of the
+ current run -- that is invalid. */
+ else if (pfile->cur_token == pfile->cur_run->base)
+ {
+ if (pfile->cur_run->prev != NULL)
+ src_loc = pfile->cur_run->prev->limit->src_loc;
+ else
+ src_loc = 0;
}
+ else
+ {
+ src_loc = pfile->cur_token[-1].src_loc;
+ }
+
+ if (!pfile->cb.error)
+ abort ();
+ ret = pfile->cb.error (pfile, level, src_loc, 0, _(msgid), &ap);
va_end (ap);
+ return ret;
}
/* Print an error at a specific location. */
-void
+bool
cpp_error_with_line (cpp_reader *pfile, int level,
source_location src_loc, unsigned int column,
const char *msgid, ...)
{
va_list ap;
+ bool ret;
va_start (ap, msgid);
- if (_cpp_begin_message (pfile, level, src_loc, column))
- v_message (msgid, ap);
+ if (!pfile->cb.error)
+ abort ();
+ ret = pfile->cb.error (pfile, level, src_loc, column, _(msgid), &ap);
va_end (ap);
+ return ret;
}
-void
+bool
cpp_errno (cpp_reader *pfile, int level, const char *msgid)
{
if (msgid[0] == '\0')
msgid = _("stdout");
- cpp_error (pfile, level, "%s: %s", msgid, xstrerror (errno));
+ return cpp_error (pfile, level, "%s: %s", msgid, xstrerror (errno));
}
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 7faff381837..a53858b4d2f 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -1,6 +1,6 @@
/* Definitions for CPP library.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2007, 2008
+ 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
@@ -302,22 +302,9 @@ struct cpp_options
/* Nonzero means print names of header files (-H). */
unsigned char print_include_names;
- /* Nonzero means cpp_pedwarn causes a hard error. */
- unsigned char pedantic_errors;
-
- /* Nonzero means don't print warning messages. */
- unsigned char inhibit_warnings;
-
/* Nonzero means complain about deprecated features. */
unsigned char warn_deprecated;
- /* Nonzero means don't suppress warnings from system headers. */
- unsigned char warn_system_headers;
-
- /* Nonzero means don't print error messages. Has no option to
- select it, but can be set by a user of cpplib (e.g. fix-header). */
- unsigned char inhibit_errors;
-
/* Nonzero means warn if slash-star appears in a comment. */
unsigned char warn_comments;
@@ -353,9 +340,6 @@ struct cpp_options
explicitly undefined. */
unsigned char warn_builtin_macro_redefined;
- /* Nonzero means turn warnings into errors. */
- unsigned char warnings_are_errors;
-
/* Nonzero means we should look for header.gcc files that remap file
names. */
unsigned char remap;
@@ -450,9 +434,6 @@ struct cpp_options
/* Nonzero means __STDC__ should have the value 0 in system headers. */
unsigned char stdc_0_in_system_headers;
- /* True means error callback should be used for diagnostics. */
- bool client_diagnostic;
-
/* True disables tokenization outside of preprocessing directives. */
bool directives_only;
};
@@ -492,10 +473,11 @@ struct cpp_callbacks
be expanded. */
cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *);
- /* Called to emit a diagnostic if client_diagnostic option is true.
- This callback receives the translated message. */
- void (*error) (cpp_reader *, int, const char *, va_list *)
- ATTRIBUTE_FPTR_PRINTF(3,0);
+ /* Called to emit a diagnostic. This callback receives the
+ translated message. */
+ bool (*error) (cpp_reader *, int, source_location, unsigned int,
+ const char *, va_list *)
+ ATTRIBUTE_FPTR_PRINTF(5,0);
/* Callbacks for when a macro is expanded, or tested (whether
defined or not at the time) in #ifdef, #ifndef or "defined". */
@@ -516,14 +498,17 @@ struct cpp_dir
char *name;
unsigned int len;
- /* The canonicalized NAME as determined by lrealpath. This field
- is only used by hosts that lack reliable inode numbers. */
- char *canonical_name;
-
/* One if a system header, two if a system header that has extern
"C" guards for C++. */
unsigned char sysp;
+ /* Is this a user-supplied directory? */
+ bool user_supplied_p;
+
+ /* The canonicalized NAME as determined by lrealpath. This field
+ is only used by hosts that lack reliable inode numbers. */
+ char *canonical_name;
+
/* Mapping of file names for this directory for MS-DOS and related
platforms. A NULL-terminated array of (from, to) pairs. */
const char **name_map;
@@ -538,9 +523,6 @@ struct cpp_dir
directories in the search path. */
ino_t ino;
dev_t dev;
-
- /* Is this a user-supplied directory? */
- bool user_supplied_p;
};
/* Name under which this program was invoked. */
@@ -697,19 +679,13 @@ extern void cpp_init_iconv (cpp_reader *);
/* Call this to finish preprocessing. If you requested dependency
generation, pass an open stream to write the information to,
- otherwise NULL. It is your responsibility to close the stream.
-
- Returns cpp_errors (pfile). */
-extern int cpp_finish (cpp_reader *, FILE *deps_stream);
+ otherwise NULL. It is your responsibility to close the stream. */
+extern void cpp_finish (cpp_reader *, FILE *deps_stream);
/* Call this to release the handle at the end of preprocessing. Any
- use of the handle after this function returns is invalid. Returns
- cpp_errors (pfile). */
+ use of the handle after this function returns is invalid. */
extern void cpp_destroy (cpp_reader *);
-/* Error count. */
-extern unsigned int cpp_errors (cpp_reader *);
-
extern unsigned int cpp_token_len (const cpp_token *);
extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *);
extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *,
@@ -836,24 +812,21 @@ cpp_num cpp_num_sign_extend (cpp_num, size_t);
/* An internal consistency check failed. Prints "internal error: ",
otherwise the same as CPP_DL_ERROR. */
#define CPP_DL_ICE 0x04
-/* Extracts a diagnostic level from an int. */
-#define CPP_DL_EXTRACT(l) (l & 0xf)
-/* Nonzero if a diagnostic level is one of the warnings. */
-#define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
- && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
+/* An informative note following a warning. */
+#define CPP_DL_NOTE 0x05
/* Output a diagnostic of some kind. */
-extern void cpp_error (cpp_reader *, int, const char *msgid, ...)
+extern bool cpp_error (cpp_reader *, int, const char *msgid, ...)
ATTRIBUTE_PRINTF_3;
/* Output a diagnostic with "MSGID: " preceding the
error string of errno. No location is printed. */
-extern void cpp_errno (cpp_reader *, int, const char *msgid);
+extern bool cpp_errno (cpp_reader *, int, const char *msgid);
/* Same as cpp_error, except additionally specifies a position as a
(translation unit) physical line and physical column. If the line is
zero, then no location is printed. */
-extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
+extern bool cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
const char *msgid, ...) ATTRIBUTE_PRINTF_5;
/* In lex.c */
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 81e888bc20f..a8ce298064b 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -1,5 +1,5 @@
/* Map logical line numbers to (source file, line number) pairs.
- Copyright (C) 2001, 2003, 2004, 2007
+ Copyright (C) 2001, 2003, 2004, 2007, 2008, 2009
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -144,12 +144,6 @@ extern const struct line_map *linemap_add
extern const struct line_map *linemap_lookup
(struct line_maps *, source_location);
-/* Print the file names and line numbers of the #include commands
- which led to the map MAP, if any, to stderr. Nothing is output if
- the most recently listed stack is the same as the current one. */
-extern void linemap_print_containing_files (struct line_maps *,
- const struct line_map *);
-
/* Converts a map and a source_location to source line. */
#define SOURCE_LINE(MAP, LOC) \
((((LOC) - (MAP)->start_location) >> (MAP)->column_bits) + (MAP)->to_line)
diff --git a/libcpp/init.c b/libcpp/init.c
index cc7a09ed8c2..ffba852032e 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -1,6 +1,7 @@
/* CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -615,12 +616,11 @@ read_original_directory (cpp_reader *pfile)
}
/* This is called at the end of preprocessing. It pops the last
- buffer and writes dependency output, and returns the number of
- errors.
+ buffer and writes dependency output.
Maybe it should also reset state, such that you could call
cpp_start_read with a new filename to restart processing. */
-int
+void
cpp_finish (cpp_reader *pfile, FILE *deps_stream)
{
/* Warn about unused macros before popping the final buffer. */
@@ -635,9 +635,8 @@ cpp_finish (cpp_reader *pfile, FILE *deps_stream)
while (pfile->buffer)
_cpp_pop_buffer (pfile);
- /* Don't write the deps file if there are errors. */
if (CPP_OPTION (pfile, deps.style) != DEPS_NONE
- && deps_stream && pfile->errors == 0)
+ && deps_stream)
{
deps_write (pfile->deps, deps_stream, 72);
@@ -648,8 +647,6 @@ cpp_finish (cpp_reader *pfile, FILE *deps_stream)
/* Report on headers that could use multiple include guards. */
if (CPP_OPTION (pfile, print_include_names))
_cpp_report_missing_guards (pfile);
-
- return pfile->errors;
}
static void
diff --git a/libcpp/internal.h b/libcpp/internal.h
index af075b4b1c9..d4eeda4bc61 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -1,6 +1,6 @@
/* Part of CPP library.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007,
+ 2008, 2009 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
@@ -388,9 +388,6 @@ struct cpp_reader
/* Nonzero prevents the lexer from re-using the token runs. */
unsigned int keep_tokens;
- /* Error counter for exit code. */
- unsigned int errors;
-
/* Buffer to hold macro definition string. */
unsigned char *macro_buffer;
unsigned int macro_buffer_len;
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 964a7cd9a77..2802c672aae 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1,5 +1,5 @@
/* Map logical line numbers to (source file, line number) pairs.
- Copyright (C) 2001, 2003, 2004, 2007, 2008
+ Copyright (C) 2001, 2003, 2004, 2007, 2008, 2009
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -302,45 +302,6 @@ linemap_lookup (struct line_maps *set, source_location line)
return &set->maps[mn];
}
-/* Print the file names and line numbers of the #include commands
- which led to the map MAP, if any, to stderr. Nothing is output if
- the most recently listed stack is the same as the current one. */
-
-void
-linemap_print_containing_files (struct line_maps *set,
- const struct line_map *map)
-{
- if (MAIN_FILE_P (map) || set->last_listed == map->included_from)
- return;
-
- set->last_listed = map->included_from;
- map = INCLUDED_FROM (set, map);
-
- fprintf (stderr, _("In file included from %s:%u"),
- map->to_file, LAST_SOURCE_LINE (map));
-
- while (! MAIN_FILE_P (map))
- {
- map = INCLUDED_FROM (set, map);
- /* Translators note: this message is used in conjunction
- with "In file included from %s:%ld" and some other
- tricks. We want something like this:
-
- | In file included from sys/select.h:123,
- | from sys/types.h:234,
- | from userfile.c:31:
- | bits/select.h:45: <error message here>
-
- with all the "from"s lined up.
- The trailing comma is at the beginning of this message,
- and the trailing colon is not translated. */
- fprintf (stderr, _(",\n from %s:%u"),
- map->to_file, LAST_SOURCE_LINE (map));
- }
-
- fputs (":\n", stderr);
-}
-
/* Print an include trace, for e.g. the -H option of the preprocessor. */
static void
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 8122648ea39..3a20c36ed39 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -1,7 +1,7 @@
/* Part of CPP library. (Macro and #define handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009 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
@@ -1807,11 +1807,13 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
if (warn_of_redefinition (pfile, node, macro))
{
- cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->directive_line, 0,
- "\"%s\" redefined", NODE_NAME (node));
+ bool warned;
+ warned = cpp_error_with_line (pfile, CPP_DL_PEDWARN,
+ pfile->directive_line, 0,
+ "\"%s\" redefined", NODE_NAME (node));
- if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
- cpp_error_with_line (pfile, CPP_DL_PEDWARN,
+ if (warned && node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
+ cpp_error_with_line (pfile, CPP_DL_NOTE,
node->value.macro->line, 0,
"this is the location of the previous definition");
}
diff --git a/libcpp/makedepend.c b/libcpp/makedepend.c
deleted file mode 100644
index c67f64e236e..00000000000
--- a/libcpp/makedepend.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Dependency generator utility.
- Copyright (C) 2004 Free Software Foundation, Inc.
- Contributed by Zack Weinberg, May 2004
-
-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
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#include "config.h"
-#include "system.h"
-#include "line-map.h"
-#include "cpplib.h"
-#include "getopt.h"
-#include "mkdeps.h"
-
-const char *progname;
-const char *vpath;
-
-static const char *output_file;
-static bool had_errors;
-
-/* Option lists, to give to cpplib before each input file. */
-struct cmd_line_macro
-{
- struct cmd_line_macro *next;
- bool is_undef;
- const char *macro;
-};
-
-static struct cmd_line_macro *cmd_line_macros;
-static cpp_dir *cmd_line_searchpath;
-
-static void
-add_clm (const char *macro, bool is_undef)
-{
- struct cmd_line_macro *clm = XNEW (struct cmd_line_macro);
- clm->next = cmd_line_macros;
- clm->is_undef = is_undef;
- clm->macro = macro;
- cmd_line_macros = clm;
-}
-
-static void
-add_dir (char *name, bool sysp)
-{
- cpp_dir *dir = XNEW (cpp_dir);
- dir->next = cmd_line_searchpath;
- dir->name = name;
- dir->sysp = sysp;
- dir->construct = 0;
- dir->user_supplied_p = 1;
- cmd_line_searchpath = dir;
-}
-
-/* Command line processing. */
-
-static void ATTRIBUTE_NORETURN
-usage (int errcode)
-{
- fprintf (stderr,
-"usage: %s [-vh] [-V vpath] [-Dname[=def]...] [-Uname] [-Idir...] [-o file] sources...\n",
- progname);
- exit (errcode);
-}
-
-static int
-parse_options (int argc, char **argv)
-{
- static const struct option longopts[] = {
- { "--help", no_argument, 0, 'h' },
- { 0, 0, 0, 0 }
- };
-
- for (;;)
- switch (getopt_long (argc, argv, "hD:U:I:J:o:V:", longopts, 0))
- {
- case 'h': usage (0);
- case 'D': add_clm (optarg, false); break;
- case 'U': add_clm (optarg, true); break;
- case 'I': add_dir (optarg, false); break;
- case 'J': add_dir (optarg, true); break;
- case 'o':
- if (output_file)
- {
- fprintf (stderr, "%s: too many output files\n", progname);
- usage (2);
- }
- output_file = optarg;
- break;
- case 'V':
- if (vpath)
- {
- fprintf (stderr, "%s: too many vpaths\n", progname);
- usage (2);
- }
- vpath = optarg;
- break;
- case '?':
- usage (2); /* getopt has issued the error message. */
-
- case -1: /* end of options */
- if (optind == argc)
- {
- fprintf (stderr, "%s: no input files\n", progname);
- usage (2);
- }
- return optind;
-
- default:
- abort ();
- }
-}
-
-/* Set up cpplib from command line options. */
-static cpp_reader *
-reader_init (struct line_maps *line_table)
-{
- cpp_reader *reader;
- cpp_options *options;
-
- linemap_init (line_table);
- reader = cpp_create_reader (CLK_GNUC89, 0, line_table);
-
- /* Ignore warnings and errors (we don't have access to system
- headers). Request dependency output. */
- options = cpp_get_options (reader);
- options->inhibit_warnings = 1;
- options->inhibit_errors = 1;
- options->deps.style = DEPS_USER;
-
- /* Further initialization. */
- cpp_post_options (reader);
- cpp_init_iconv (reader);
- cpp_set_include_chains (reader, cmd_line_searchpath, cmd_line_searchpath,
- false);
- if (vpath)
- {
- struct deps *deps = cpp_get_deps (reader);
- deps_add_vpath (deps, vpath);
- }
-
- return reader;
-}
-
-/* Process one input source file. */
-static void
-process_file (const char *file)
-{
- struct line_maps line_table;
- cpp_reader *reader = reader_init (&line_table);
-
- if (!cpp_read_main_file (reader, file))
- had_errors = true;
- else
- {
- struct cmd_line_macro *clm;
-
- cpp_init_builtins (reader, true);
- for (clm = cmd_line_macros; clm; clm = clm->next)
- (clm->is_undef ? cpp_undef : cpp_define) (reader, clm->macro);
-
- cpp_scan_nooutput (reader);
- if (cpp_finish (reader, stdout))
- had_errors = true;
- }
- cpp_destroy (reader);
- linemap_free (&line_table);
-}
-
-/* Master control. */
-
-int
-main(int argc, char **argv)
-{
- int first_input, i;
-
- progname = argv[0];
- xmalloc_set_program_name (progname);
-
- first_input = parse_options (argc, argv);
- if (output_file)
- if (!freopen (output_file, "w", stdout))
- {
- perror (output_file);
- return 1;
- }
-
- for (i = first_input; i < argc; i++)
- process_file (argv[i]);
-
- return had_errors;
-}
diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog
index 354082b7a01..f953ffbb54b 100644
--- a/libcpp/po/ChangeLog
+++ b/libcpp/po/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-28 Joseph Myers <joseph@codesourcery.com>
+
+ * cpplib.pot: Regenerate.
+
+2009-03-04 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
2009-02-13 Joseph S. Myers <joseph@codesourcery.com>
* zh_CN.po: Update.
diff --git a/libcpp/po/cpplib.pot b/libcpp/po/cpplib.pot
index c4ae3af86c0..62c28846e4c 100644
--- a/libcpp/po/cpplib.pot
+++ b/libcpp/po/cpplib.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n"
-"POT-Creation-Date: 2008-11-18 20:02+0000\n"
+"POT-Creation-Date: 2009-03-28 06:55+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -398,7 +398,7 @@ msgid "unterminated #%s"
msgstr ""
#: directives-only.c:222
-#: lex.c:1138
+#: lex.c:1148
#: traditional.c:162
msgid "unterminated comment"
msgstr ""
@@ -748,28 +748,28 @@ msgstr ""
msgid "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro"
msgstr ""
-#: lex.c:664
+#: lex.c:674
msgid "null character(s) preserved in literal"
msgstr ""
-#: lex.c:667
+#: lex.c:677
#, c-format
msgid "missing terminating %c character"
msgstr ""
-#: lex.c:1149
+#: lex.c:1159
msgid "C++ style comments are not allowed in ISO C90"
msgstr ""
-#: lex.c:1151
+#: lex.c:1161
msgid "(this will be reported only once per input file)"
msgstr ""
-#: lex.c:1156
+#: lex.c:1166
msgid "multi-line comment"
msgstr ""
-#: lex.c:1469
+#: lex.c:1480
#, c-format
msgid "unspellable token %s"
msgstr ""
@@ -924,28 +924,33 @@ msgstr ""
msgid "while writing precompiled header"
msgstr ""
-#: pch.c:485
+#: pch.c:484
+#, c-format
+msgid "%s: not used because `%.*s' is poisoned"
+msgstr ""
+
+#: pch.c:506
#, c-format
msgid "%s: not used because `%.*s' not defined"
msgstr ""
-#: pch.c:497
+#: pch.c:518
#, c-format
msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'"
msgstr ""
-#: pch.c:538
+#: pch.c:559
#, c-format
msgid "%s: not used because `%s' is defined"
msgstr ""
-#: pch.c:558
+#: pch.c:579
#, c-format
msgid "%s: not used because `__COUNTER__' is invalid"
msgstr ""
-#: pch.c:567
-#: pch.c:737
+#: pch.c:588
+#: pch.c:758
msgid "while reading precompiled header"
msgstr ""
diff --git a/libcpp/po/es.po b/libcpp/po/es.po
index 8e45e979d69..b96ef24b2d0 100644
--- a/libcpp/po/es.po
+++ b/libcpp/po/es.po
@@ -1,14 +1,14 @@
-# Mensajes en español para cpplib-4.3.0
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# Mensajes en español para cpplib-4.4-b20081121
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
-# Cristian Othón Martínez Vera <cfuga@itam.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
+# Cristian Othón Martínez Vera <cfuga@itam.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009.
#
msgid ""
msgstr ""
-"Project-Id-Version: cpplib-4.3.0\n"
+"Project-Id-Version: cpplib 4.4-b20081121\n"
"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n"
"POT-Creation-Date: 2008-11-18 20:02+0000\n"
-"PO-Revision-Date: 2008-03-18 12:01-0600\n"
+"PO-Revision-Date: 2009-03-03 23:45-0600\n"
"Last-Translator: Cristian Othón Martínez Vera <cfuga@itam.mx>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
@@ -160,9 +160,9 @@ msgid "#%s is a GCC extension"
msgstr "#%s es una extensión de GCC"
#: directives.c:352
-#, fuzzy, c-format
+#, c-format
msgid "#%s is a deprecated GCC extension"
-msgstr "#%s es una extensión de GCC"
+msgstr "#%s es una extensión de GCC obsoleta"
#: directives.c:366
msgid "suggest not using #elif in traditional C"
@@ -267,7 +267,7 @@ msgstr "\"%s\" después de # no es un entero positivo"
#: directives.c:1042
#, c-format
msgid "%s"
-msgstr ""
+msgstr "%s"
#: directives.c:1066
#, c-format
@@ -522,14 +522,12 @@ msgid "\"%s\" is not defined"
msgstr "\"%s\" no está definido"
#: expr.c:756
-#, fuzzy
msgid "assertions are a GCC extension"
-msgstr "las constantes binarias son una extensión GCC"
+msgstr "las aserciones son una extensión GCC"
#: expr.c:759
-#, fuzzy
msgid "assertions are a deprecated extension"
-msgstr "las constantes binarias son una extensión GCC"
+msgstr "las aserciones son una extensión obsoleta"
#: expr.c:892 expr.c:921
#, c-format
@@ -546,9 +544,9 @@ msgid "missing expression between '(' and ')'"
msgstr "falta una expresión entre '(' y ')'"
#: expr.c:932
-#, fuzzy, c-format
+#, c-format
msgid "%s with no expression"
-msgstr "#if sin expresión"
+msgstr "%s sin expresión"
#: expr.c:935
#, c-format
@@ -565,9 +563,9 @@ msgid " ':' without preceding '?'"
msgstr " ':' sin una '?' precedente"
#: expr.c:994
-#, fuzzy, c-format
+#, c-format
msgid "unbalanced stack in %s"
-msgstr "pila desbalanceada en #if"
+msgstr "pila desbalanceada en %s"
#: expr.c:1014
#, c-format
@@ -830,7 +828,7 @@ msgstr "la función de macro \"%s\" se debe usar con argumentos en C tradicional"
#: macro.c:1016
#, c-format
msgid "invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98"
-msgstr ""
+msgstr "al invocar el macro %s argumento %d: los argumentos de macro vacíos están indefinidos en ISO C90 y en ISO C++98"
#: macro.c:1453
#, c-format