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]

Re: cpplib: patch: three long-standing bugs


Other than the issue of what to do with NUL bytes in the source, I have only one
question about this patch. Why not generate a message for each unterminated
conditional on the stack? This patch appears to generate a message for the
innermost one.

Dave

Zack Weinberg wrote:

> This patch nails three long-standing but simply fixed bugs in cpplib.
> They are items 4-6 on cpplib's todo list:
>
> | 4. Make it diagnose unterminated conditionals. The code to do this is
> | broken. Also, fix the test cases that are supposed to verify that this
> | works.
> |
> | 5. Ignore ASCII NUL in an input file, with a warning. Right now it
> | silently mangles the output.  This is easy to fix; in
> | read_and_prescan, don't assume that NUL ends the current chunk of
> | input. But you have to not wreck performance while you're at
> | it. read_and_prescan is fragile.
> |
> | 6. Make -traditional not affect the handling of string constants. In
> | cpplib, in -traditional mode, string constants are silently ended at
> | the end of the line. This is inconsistent with cc1, which accepts
> | multiline string constants in any mode (with a pedwarn).
>
> It turns out that there were no tests for unterminated conditionals,
> so I added some.  Can CVS handle a file with NULs in it?
>
> Bootstraps with no regressions on x86.
>
> zw
>
> 1999-09-03 19:39 -0700  Zack Weinberg  <zack@bitmover.com>
>
>         * cpperror.c (cpp_print_containing_files): Use cpp_message not
>         cpp_notice to print "In file included from ...".
>         * cppfiles.c (find_position): Don't maintain column counter,
>         just line counter and pointer to line base.  All callers
>         changed to match.
>         (read_and_prescan): NUL does not necessarily indicate the end
>         of the chunk; check it.  Discard NULs embedded in the input
>         file with a warning.
>         * cpplib.c (conditional_skip): Set temp->lineno.
>         (do_endif): Make error message clearer.
>         (cpp_get_token [case EOF]): Check for and diagnose an open if
>         block.
>         (parse_string): Do not behave differently if CPP_TRADITIONAL
>         is set.  Fix comment.




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