[gcc-in-cxx] Fix cp/parser.c for C++

Ian Lance Taylor iant@google.com
Mon Mar 2 22:34:00 GMT 2009


Thomas Neumann <tneumann@users.sourceforge.net> writes:

> The patch below adds a missing cast to enum to cp/parser.c. As the already
> existing comment mentions, the enum value is smuggled as int value through
> the tree.
>
> Ok to commit?
>
> Thomas
>
> * cp/parser.c (cp_lexer_get_preprocessor_token): Add missing cast to enum.
>
> diff --git gcc/cp/parser.c gcc/cp/parser.c
> --- gcc/cp/parser.c  (revision 144249)
> +++ gcc/cp/parser.c  (working copy)
> @@ -470,7 +470,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
>    else if (token->type == CPP_PRAGMA)
>      {
>        /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST.  */
> -      token->pragma_kind = TREE_INT_CST_LOW (token->u.value);
> +      token->pragma_kind = (enum pragma_kind) TREE_INT_CST_LOW (token->u.value);
>        token->u.value = NULL_TREE;
>      }
>  }

Line too long; write as

      token->pragma_kind = ((enum pragma_kind)
			    TREE_INT_CST_LOW (token->u.value));

OK for the gcc-in-cxx branch with that change.

Thanks.

Ian



More information about the Gcc-patches mailing list