Hello Jakub,

Jakub Jelinek <ja...@redhat.com> writes:

> __has_{cpp_,}attribute builtin macros are effectively function-like macros
> taking one argument (and the ISO preprocessor expands macros in the argument
> which is IMHO desirable), but the traditional preprocessor has been crashing
> on them or reporting errors.
> As the hook uses cpp_get_token and thus the ISO preprocessor, we need to set
> up things such that the argument and ()s around it are already preprocessed
> and ready to be reparsed by the ISO preprocessor (this is similar to how
> e.g. #if/#elif and various other directives are handled).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2015-03-11  Jakub Jelinek  <ja...@redhat.com>
>
>       PR preprocessor/65238
>       * internal.h (_cpp_scan_out_logical_line): Add third argument.
>       * directives.c (prepare_directive_trad): Pass false to it.
>       * traditional.c (_cpp_read_logical_line_trad,
>       _cpp_create_trad_definition): Likewise.
>       (struct fun_macro): Add paramc field.
>       (fun_like_macro): New function.
>       (maybe_start_funlike): Handle NODE_BUILTIN macros.  Initialize
>       macro->paramc field.
>       (save_argument): Use macro->paramc instead of
>       macro->node->value.macro->paramc.
>       (push_replacement_text): Formatting fix.
>       (recursive_macro): Use fun_like_macro helper.
>       (_cpp_scan_out_logical_line): Likewise.  Add BUILTIN_MACRO_ARG
>       argument.  Initialize fmacro.paramc field.  Handle builtin
>       function-like macros.
>
>       * c-c++-common/cpp/pr65238-1.c: New test.
>       * gcc.dg/cpp/pr65238-2.c: New test.
>       * gcc.dg/cpp/trad/pr65238-3.c: New test.
>       * gcc.dg/cpp/trad/pr65238-4.c: New test.

I do not have the rights to ACK this but FWIW it looks OK to me.  Sorry
for the delay in reviewing this.

Thanks!

Cheers,

-- 
                Dodji

Reply via email to