This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: distcc and ccache speedup: adds directives-only preprocessing


That said, I did run into a few real issues.  The main one is my
handling of include guards.  I'm not properly detecting cases where
code appears outside of an include guard (cf. mi7.c).  There are also
some warnings which I don't handle but easily could (e.g. unterminated
comments) and some incompatible command line options (e.g. -Wunused
and -dD) which should emit warnings or errors.

I'll clean these up and resubmit.

I've finished updating the patch. Here's an overview of the changes I've made:


- Added errors if -fdirectives-only is used in conjunction with -traditional or
 -Wunused-macros.
- Fixed include guard handling.  Faulty (or missing) include guards
now correctly trigger
 multiple inclusion.
- Adds an error for unterminated block comments.
- Fixes incorrect handling of preprocessing directives preceded by
block comments.
- Allows -dCHARS arguments to be used in conjunction with -fdirectives-only.
- Adds support for '-E -fdirectives-only -fpreprocessed', which causes
a two-stage pass to
 return the same output as a single '-E' pass.
- Adds additional test cases.

Using ccache to enforce two-stage processing, the new code still
correctly executes all non-cpp test cases.  The cpp test cases which
fail now do so in predictable and desirable fashion.

Ollie

:ADDPATCH libcpp:

2007-02-27 Ollie Wild <aaw@google.com>

       * 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.

2007-02-27 Ollie Wild <aaw@google.com>

       * 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.
       * Makefile.in (libcpp_a_OBJS): Add directives-only.o.
       (libcpp_a_SOURCES): Add directives-only.c.

2007-02-27 Ollie Wild <aaw@google.com>

       * 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.

Attachment: directives-only.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]