wpp: Stop parsing single and double quoted string constants after a first newline character.

Matteo Bruni matteo.mystral at gmail.com
Thu Mar 15 06:55:08 CDT 2012


Il 14 marzo 2012 23:02, Józef Kucia <joseph.kucia at gmail.com> ha scritto:
> @@ -679,11 +649,23 @@ void pp_writestring(const char *format, ...)
>                }
>        }
>  <pp_iqs,pp_dqs,pp_sqs>\\.      add_string(ppy_text, ppy_leng);
> -<pp_iqs,pp_dqs,pp_sqs>\n       {
> +<pp_iqs>\n             {
>                newline(1);
>                add_string(ppy_text, ppy_leng);
>                ppy_warning("Newline in string constant encountered (started line %d)", string_start());
>        }
> +<pp_dqs>\n             {
> +               newline(-1);
> +               add_string(ppy_text, ppy_leng);
> +               ppy_warning("Newline in double quoted string constant encountered (started line %d)", string_start());
> +               if(end_double_quoted_string()) return tDQSTRING;
> +       }
> +<pp_sqs>\n             {
> +               newline(-1);
> +               add_string(ppy_text, ppy_leng);
> +               ppy_warning("Newline in single quoted string constant encountered (started line %d)", string_start());
> +               if(end_single_quoted_string()) return tSQSTRING;
> +       }
>
>        /*
>         * Identifier scanning

I'm not sure this is legit. If I'm reading the C spec correctly, a
character or string constant can be only terminated by ' or "
respectively. Although it can't contain unescaped newline characters
either, so it looks like we are actually in the realm of "undefined
behavior".
So, I guess this change will only have any effect on non-standard
complying sources, and in the specific case of asm-style comments, it
brings us the behavior we want. On the other hand, it also actually
turns an error (unexpected end of file) into a warning, which may be
troublesome in general.
I hope it doesn't break anything else...

(You can take this email as "okay for me, but someone else may know better")



More information about the wine-devel mailing list