diff options
author | Simon Baldwin <simonb@google.com> | 2012-11-16 17:14:05 +0000 |
---|---|---|
committer | Simon Baldwin <simonb@gcc.gnu.org> | 2012-11-16 17:14:05 +0000 |
commit | 5dc99c46786e91f2892c4318ed36054302e0c964 (patch) | |
tree | 709320b578253406cba90335431f68194bf6b70a /libcpp | |
parent | b185792f5216497c74664bdf9ba2d465628d6f4c (diff) | |
download | gcc-5dc99c46786e91f2892c4318ed36054302e0c964.zip gcc-5dc99c46786e91f2892c4318ed36054302e0c964.tar.gz gcc-5dc99c46786e91f2892c4318ed36054302e0c964.tar.bz2 |
cpplib.h (struct cpp_options): Add canonical_system_headers.
* include/cpplib.h (struct cpp_options): Add canonical_system_headers.
* files.c (find_file_in_dir): Call maybe_shorter_path() only if
canonical_system_headers is set.
* init.c (cpp_create_reader): Initialize canonical_system_headers.
* configure.ac: Add new --enable-canonical-system-headers.
* configure: Regenerate.
* config.in: Regenerate.
* doc/cppopts.texi: Document -f[no-]canonical-system-headers.
* doc/install.texi: Document --enable-canonical-system-headers.
* c.opt: Add f[no-]canonical-system-headers.
* c-opts.c (c_common_handle_option): Handle
OPT_fcanonical_system_headers.
From-SVN: r193569
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 10 | ||||
-rw-r--r-- | libcpp/config.in | 3 | ||||
-rwxr-xr-x | libcpp/configure | 16 | ||||
-rw-r--r-- | libcpp/configure.ac | 10 | ||||
-rw-r--r-- | libcpp/files.c | 2 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 3 | ||||
-rw-r--r-- | libcpp/init.c | 6 |
7 files changed, 49 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 4f78ecf..30cef77 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,13 @@ +2012-11-16 Simon Baldwin <simonb@google.com> + + * include/cpplib.h (struct cpp_options): Add canonical_system_headers. + * files.c (find_file_in_dir): Call maybe_shorter_path() only if + canonical_system_headers is set. + * init.c (cpp_create_reader): Initialize canonical_system_headers. + * configure.ac: Add new --enable-canonical-system-headers. + * configure: Regenerate. + * config.in: Regenerate. + 2012-11-09 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/54413 diff --git a/libcpp/config.in b/libcpp/config.in index 05542fe..fca690c 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -11,6 +11,9 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define to enable system headers canonicalization. */ +#undef ENABLE_CANONICAL_SYSTEM_HEADERS + /* Define if you want more run-time sanity checks. */ #undef ENABLE_CHECKING diff --git a/libcpp/configure b/libcpp/configure index d33969b..d07aed3 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -700,6 +700,7 @@ enable_rpath with_libiconv_prefix enable_maintainer_mode enable_checking +enable_canonical_system_headers ' ac_precious_vars='build_alias host_alias @@ -1333,6 +1334,8 @@ Optional Features: --disable-rpath do not hardcode runtime library paths --enable-maintainer-mode enable rules only needed by maintainers --enable-checking enable expensive run-time checks + --enable-canonical-system-headers + enable or disable system headers canonicalization Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -7094,6 +7097,19 @@ $as_echo "#define ENABLE_CHECKING 1" >>confdefs.h fi +# Check whether --enable-canonical-system-headers was given. +if test "${enable_canonical_system_headers+set}" = set; then : + enableval=$enable_canonical_system_headers; +else + enable_canonical_system_headers=yes +fi + +if test $enable_canonical_system_headers != no; then + +$as_echo "#define ENABLE_CANONICAL_SYSTEM_HEADERS 1" >>confdefs.h + +fi + case $target in aarch64*-*-* | \ diff --git a/libcpp/configure.ac b/libcpp/configure.ac index e62da06..34ae5c2 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -132,6 +132,16 @@ if test $enable_checking != no ; then [Define if you want more run-time sanity checks.]) fi +AC_ARG_ENABLE(canonical-system-headers, +[ --enable-canonical-system-headers + enable or disable system headers canonicalization], +[], +enable_canonical_system_headers=yes) +if test $enable_canonical_system_headers != no; then + AC_DEFINE(ENABLE_CANONICAL_SYSTEM_HEADERS, + 1, [Define to enable system headers canonicalization.]) +fi + m4_changequote(,) case $target in aarch64*-*-* | \ diff --git a/libcpp/files.c b/libcpp/files.c index ecaa274..a8288dc 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -389,7 +389,7 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) void **pp; /* We try to canonicalize system headers. */ - if (file->dir->sysp) + if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp) { char * canonical_path = maybe_shorter_path (path); if (canonical_path) diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 72415f0..85432a2 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -493,6 +493,9 @@ struct cpp_options /* True disables tokenization outside of preprocessing directives. */ bool directives_only; + + /* True enables canonicalization of system header file paths. */ + bool canonical_system_headers; }; /* Callback for header lookup for HEADER, which is the name of a diff --git a/libcpp/init.c b/libcpp/init.c index ebe51c7..2ec5ecb 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -28,6 +28,10 @@ along with this program; see the file COPYING3. If not see #include "localedir.h" #include "filenames.h" +#ifndef ENABLE_CANONICAL_SYSTEM_HEADERS +#define ENABLE_CANONICAL_SYSTEM_HEADERS 0 +#endif + static void init_library (void); static void mark_named_operators (cpp_reader *, int); static void read_original_filename (cpp_reader *); @@ -182,6 +186,8 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table, CPP_OPTION (pfile, track_macro_expansion) = 2; CPP_OPTION (pfile, warn_normalize) = normalized_C; CPP_OPTION (pfile, warn_literal_suffix) = 1; + CPP_OPTION (pfile, canonical_system_headers) + = ENABLE_CANONICAL_SYSTEM_HEADERS; CPP_OPTION (pfile, ext_numeric_literals) = 1; /* Default CPP arithmetic to something sensible for the host for the |