aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorOllie Wild <aaw@google.com>2007-07-30 18:29:20 +0000
committerOllie Wild <aaw@gcc.gnu.org>2007-07-30 18:29:20 +0000
commitccfc4c91bb38ae91e4fe206fca657366e5f7caa7 (patch)
treebb584ffda6bfb46d8b03b533da0e2f408e0bbd23 /gcc/doc
parent7bc980e1d9410f6182088fe4b60f125634e71941 (diff)
downloadgcc-ccfc4c91bb38ae91e4fe206fca657366e5f7caa7.zip
gcc-ccfc4c91bb38ae91e4fe206fca657366e5f7caa7.tar.gz
gcc-ccfc4c91bb38ae91e4fe206fca657366e5f7caa7.tar.bz2
directives-only.c: New file.
libcpp/ * directives-only.c: New file. * internal.h (struct _cpp_dir_only_callbacks): New. (_cpp_preprocess_dir_only): New function. * directives.c (_cpp_handle_directive): Check directives_only before disabling execution of indented directives. * files.c (_cpp_stack_file): Add directives_only check. * include/cpplib.h (struct cpp_options): Add directives_only. (cpp_init_special_builtins): New function. * init.c (cpp_init_special_builtins): New function. (cpp_init_builtins): Move builtin_array initialization to cpp_init_special_builtins. (post_options): Check directives_only before setting pfile->state.prevent_expansion = 1. * macro.c (_cpp_builtin_macro_text): Print an error if __COUNTER__ is expanded inside a directive while -fdirectives-only is enabled. * Makefile.in (libcpp_a_OBJS): Add directives-only.o. (libcpp_a_SOURCES): Add directives-only.c. gcc/ * c-ppoutput.c (print_lines_directives_only): New function. (scan_translation_unit_directives_only): New function. (preprocess_file): Add call to scan_translation_unit_directives_only. * c-opts.c (c_common_handle_option): Add OPT_fdirectives_only. (sanitize_cpp_opts): Add default flag_dump_macros setting for -fdirectives-only. Add errors for -fdirectives-only conflict with -Wunused-macros and -traditional. (finish_options): Add builtin macro initialization for -fdirectives-only + -fpreprocessed. * c.opt (fdirectives-only): New. * doc/cppopts.texi (fdirectives-only): New. gcc/testsuite/ * gcc.dg/cpp/counter-2.c: New test. * gcc.dg/cpp/counter-3.c: New test. * gcc.dg/cpp/dir-only-1.c: New test. * gcc.dg/cpp/dir-only-1.h: New file. * gcc.dg/cpp/dir-only-2.c: New test. * gcc.dg/cpp/dir-only-3.c: New test. * gcc.dg/cpp/dir-only-3a.h: New file. * gcc.dg/cpp/dir-only-3b.h: New file. * gcc.dg/cpp/dir-only-4.c: New test. * gcc.dg/cpp/dir-only-5.c: New test. * gcc.dg/cpp/dir-only-6.c: New test. From-SVN: r127066
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/cppopts.texi22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index 73db832..dbc8f0e 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -518,6 +518,28 @@ Search @var{dir} only for header files requested with
If @var{dir} begins with @code{=}, then the @code{=} will be replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
+@item -fdirectives-only
+@opindex fdirectives-only
+When preprocessing, handle directives, but do not expand macros.
+
+The option's behavior depends on the @option{-E} and @option{-fpreprocessed}
+options.
+
+With @option{-E}, preprocessing is limited to the handling of directives
+such as @code{#define}, @code{#ifdef}, and @code{#error}. Other
+preprocessor operations, such as macro expansion and trigraph
+conversion are not performed. In addition, the @option{-dD} option is
+implicitly enabled.
+
+With @option{-fpreprocessed}, predefinition of command line and most
+builtin macros is disabled. Macros such as @code{__LINE__}, which are
+contextually dependent, are handled normally. This enables compilation of
+files previously preprocessed with @code{-E -fdirectives-only}.
+
+With both @option{-E} and @option{-fpreprocessed}, the rules for
+@option{-fpreprocessed} take precedence. This enables full preprocessing of
+files previously preprocessed with @code{-E -fdirectives-only}.
+
@item -fdollars-in-identifiers
@opindex fdollars-in-identifiers
@anchor{fdollars-in-identifiers}