On Mon, Mar 21, 2022 at 5:13 AM Jiufu Guo <guoji...@linux.ibm.com> wrote:
>
> Hi!
>
> There is a rare corner case: where __vector is followed only with ";"
> and near the end of the file.
>
> Like the case in PR101168:
> using vdbl =  __vector double;
> #define BREAK 1
>
> For this case, "__vector double" is not followed by a PP_NAME, it is
> followed by CPP_SEMICOLON and then EOF.  In this case, there is no
> more tokens in the file.  Then, do not need to continue to parse the
> file.
>
> This patch pass bootstrap and regtest on ppc64 and ppc64le.

This is okay. Maybe a tweak to the comment, see below.

Thanks, David

>
>
> BR,
> Jiufu
>
>
>         PR preprocessor/101168
>
> gcc/ChangeLog:
>
>         * config/rs6000/rs6000-c.cc (rs6000_macro_to_expand):
>         Avoid empty identifier.
>
> gcc/testsuite/ChangeLog:
>
>         * g++.target/powerpc/pr101168.C: New test.
>
>
> ---
>  gcc/config/rs6000/rs6000-c.cc               | 4 +++-
>  gcc/testsuite/g++.target/powerpc/pr101168.C | 6 ++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/g++.target/powerpc/pr101168.C
>
> diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
> index 3b62b499df2..f8cc7bad812 100644
> --- a/gcc/config/rs6000/rs6000-c.cc
> +++ b/gcc/config/rs6000/rs6000-c.cc
> @@ -282,7 +282,9 @@ rs6000_macro_to_expand (cpp_reader *pfile, const 
> cpp_token *tok)
>                 expand_bool_pixel = __pixel_keyword;
>               else if (ident == C_CPP_HASHNODE (__bool_keyword))
>                 expand_bool_pixel = __bool_keyword;
> -             else
> +
> +             /* If it needs to check tokens continue.  */

Maybe /* If there are more tokens to check.  */ ?

> +             else if (ident)
>                 {
>                   /* Try two tokens down, too.  */
>                   do
> diff --git a/gcc/testsuite/g++.target/powerpc/pr101168.C 
> b/gcc/testsuite/g++.target/powerpc/pr101168.C
> new file mode 100644
> index 00000000000..284e77fdc88
> --- /dev/null
> +++ b/gcc/testsuite/g++.target/powerpc/pr101168.C
> @@ -0,0 +1,6 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target powerpc_altivec_ok } */
> +/* { dg-options "-maltivec" } */
> +
> +using vdbl =  __vector double;
> +#define BREAK 1
> --
> 2.25.1
>

Reply via email to