aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/c-ppoutput.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2013-11-23 18:32:53 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2013-11-23 18:32:53 +0000
commit81e5b01765266b6e24802deab241aeb513eb5704 (patch)
tree2fc63906136497dd451e94988bc08838475abff7 /contrib/gcc/c-ppoutput.c
parent0a9655a082b25b1eaeb36ad7832f4c91d3e7f45d (diff)
downloadsrc-81e5b01765266b6e24802deab241aeb513eb5704.tar.gz
src-81e5b01765266b6e24802deab241aeb513eb5704.zip
gcc: Bring updates from Google's enhanced gcc-4.2.1.
Google released and enhanced version of gcc-4.2.1 plus their local patches for Android[1]. The patches are owned by Google and the license hasn't been changed from the original GPLv2. We are only bringing a subset of the available patches that may be helpful in FreeBSD. Changes specific to android are not included. From the README.google file[1]. Patches applied to google_vendor_src_branch/gcc/gcc-4.2.1: gcc/Makefile.in gcc/c-common.c gcc/c-common.h gcc/c-opts.c gcc/c-typeck.c gcc/cp/typeck.c gcc/doc/invoke.texi gcc/flags.h gcc/opts.c gcc/tree-flow.h gcc/tree-ssa-alias-warnings.c gcc/tree-ssa-alias.c Backport of -Wstrict-aliasing from mainline. Silvius Rus <rus@google.com> gcc/coverage.c: Patch coverage_checksum_string for PR 25351. Seongbae Park <spark@google.com> Not yet submitted to FSF. gcc/c-opts.c gcc/c-ppoutput.c gcc/c.opt gcc/doc/cppopts.texi libcpp/Makefile.in libcpp/directives-only.c libcpp/directives.c libcpp/files.c libcpp/include/cpplib.h libcpp/init.c libcpp/internal.h libcpp/macro.c Support for -fdirectives-only. Ollie Wild <aaw@google.com>. Submitted to FSF but not yet approved. libstdc++-v3/include/ext/hashtable.h http://b/742065 http://b/629994 Reduce min size of hashtable for hash_map, hash_set from 53 to 5 libstdc++-v3/include/ext/hashtable.h http://b/629994 Do not iterate over buckets if hashtable is empty. gcc/common.opt gcc/doc/invoke.texi gcc/flags.h gcc/gimplify.c gcc/opts.c Add Saito's patch for -finstrument-functions-exclude-* options. gcc/common.opt gcc/doc/invoke.texi gcc/final.c gcc/flags.h gcc/opts.c gcc/testsuite/gcc.dg/Wframe-larger-than.c Add a new flag -Wframe-larger-than- which enables a new warning when a frame size of a function is larger than specified. This patch hasn't been integrated into gcc mainline yet. gcc/tree-vrp.c Add a hack to avoid using ivopts information for pointers starting at constant values. Reference: [1] https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.2.1/ Obtained from: Google Inc. MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=258501
Diffstat (limited to 'contrib/gcc/c-ppoutput.c')
-rw-r--r--contrib/gcc/c-ppoutput.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/gcc/c-ppoutput.c b/contrib/gcc/c-ppoutput.c
index 10540b7f1251..62b350b9ef33 100644
--- a/contrib/gcc/c-ppoutput.c
+++ b/contrib/gcc/c-ppoutput.c
@@ -41,6 +41,8 @@ static struct
/* General output routines. */
static void scan_translation_unit (cpp_reader *);
+static void print_lines_directives_only (int, const void *, size_t);
+static void scan_translation_unit_directives_only (cpp_reader *);
static void scan_translation_unit_trad (cpp_reader *);
static void account_for_newlines (const unsigned char *, size_t);
static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
@@ -75,6 +77,9 @@ preprocess_file (cpp_reader *pfile)
}
else if (cpp_get_options (pfile)->traditional)
scan_translation_unit_trad (pfile);
+ else if (cpp_get_options (pfile)->directives_only
+ && !cpp_get_options (pfile)->preprocessed)
+ scan_translation_unit_directives_only (pfile);
else
scan_translation_unit (pfile);
@@ -179,6 +184,26 @@ scan_translation_unit (cpp_reader *pfile)
}
}
+static void
+print_lines_directives_only (int lines, const void *buf, size_t size)
+{
+ print.src_line += lines;
+ fwrite (buf, 1, size, print.outf);
+}
+
+/* Writes out the preprocessed file, handling spacing and paste
+ avoidance issues. */
+static void
+scan_translation_unit_directives_only (cpp_reader *pfile)
+{
+ struct _cpp_dir_only_callbacks cb;
+
+ cb.print_lines = print_lines_directives_only;
+ cb.maybe_print_line = maybe_print_line;
+
+ _cpp_preprocess_dir_only (pfile, &cb);
+}
+
/* Adjust print.src_line for newlines embedded in output. */
static void
account_for_newlines (const unsigned char *str, size_t len)