Mercurial > hg > CbC > CbC_gcc
diff libcpp/init.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | 3bfb6c00c1e0 |
children | b7f97abdc517 |
line wrap: on
line diff
--- a/libcpp/init.c Sun Feb 07 18:28:00 2010 +0900 +++ b/libcpp/init.c Fri Feb 12 23:39:51 2010 +0900 @@ -1,7 +1,7 @@ /* CPP Library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009 - 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 @@ -28,7 +28,7 @@ #include "localedir.h" static void init_library (void); -static void mark_named_operators (cpp_reader *); +static void mark_named_operators (cpp_reader *, int); static void read_original_filename (cpp_reader *); static void read_original_directory (cpp_reader *); static void post_options (cpp_reader *); @@ -160,7 +160,7 @@ CPP_OPTION (pfile, warn_trigraphs) = 2; CPP_OPTION (pfile, warn_endif_labels) = 1; CPP_OPTION (pfile, warn_deprecated) = 1; - CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99); + CPP_OPTION (pfile, warn_long_long) = 0; CPP_OPTION (pfile, dollars_in_ident) = 1; CPP_OPTION (pfile, warn_dollars) = 1; CPP_OPTION (pfile, warn_variadic_macros) = 1; @@ -381,7 +381,7 @@ /* Mark the C++ named operators in the hash table. */ static void -mark_named_operators (cpp_reader *pfile) +mark_named_operators (cpp_reader *pfile, int flags) { const struct builtin_operator *b; @@ -390,12 +390,30 @@ b++) { cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len); - hp->flags |= NODE_OPERATOR; + hp->flags |= flags; hp->is_directive = 0; hp->directive_index = b->value; } } +/* Helper function of cpp_type2name. Return the string associated with + named operator TYPE. */ +const char * +cpp_named_operator2name (enum cpp_ttype type) +{ + const struct builtin_operator *b; + + for (b = operator_array; + b < (operator_array + ARRAY_SIZE (operator_array)); + b++) + { + if (type == b->value) + return (const char *) b->name; + } + + return NULL; +} + void cpp_init_special_builtins (cpp_reader *pfile) { @@ -416,7 +434,7 @@ if (b->always_warn_if_redefined || CPP_OPTION (pfile, warn_builtin_macro_redefined)) hp->flags |= NODE_WARN; - hp->value.builtin = (enum builtin_type) b->value; + hp->value.builtin = (enum cpp_builtin_type) b->value; } } @@ -509,13 +527,20 @@ void cpp_post_options (cpp_reader *pfile) { + int flags; + sanity_checks (pfile); post_options (pfile); /* Mark named operators before handling command line macros. */ + flags = 0; if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names)) - mark_named_operators (pfile); + flags |= NODE_OPERATOR; + if (CPP_OPTION (pfile, warn_cxx_operator_names)) + flags |= NODE_DIAGNOSTIC | NODE_WARN_OPERATOR; + if (flags != 0) + mark_named_operators (pfile, flags); } /* Setup for processing input from the file named FNAME, or stdin if @@ -631,12 +656,11 @@ } /* 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. */ @@ -651,9 +675,8 @@ 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); @@ -664,8 +687,6 @@ /* 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