This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Make attributes accept enum values (PR c/50459)
- From: Richard Henderson <rth at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 16 Apr 2014 14:35:41 -0700
- Subject: Re: [C PATCH] Make attributes accept enum values (PR c/50459)
- Authentication-results: sourceware.org; auth=none
- References: <20140414151045 dot GA20332 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1404141720210 dot 3714 at laptop-mg dot saclay dot inria dot fr> <20140414173232 dot GB20332 at redhat dot com>
On 04/14/2014 10:32 AM, Marek Polacek wrote:
> + if (TREE_CODE (val) != IDENTIFIER_NODE
> + && TREE_CODE (val) != FUNCTION_DECL)
> + val = default_conversion (val);
> + else if (TREE_CODE (val) == IDENTIFIER_NODE)
> + {
> + tree t = lookup_name (val);
> + if (t && TREE_CODE (t) == CONST_DECL)
> + val = default_conversion (t);
> + }
In addition to Jason's comment, a general style point:
if (X != A && X != B)
...
else if (X == A)
...
should be written
if (X == A)
...
else if (X != B)
...
As a general rule, positive tests are easier to reason with than negative tests.
r~