This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++] Return error_mark_node from cp_parser_constant_expression


On 06/04/2012 08:40 PM, Jason Merrill wrote:
On 06/04/2012 06:36 AM, Florian Weimer wrote:
(Sorry if Thunderbird has garbled the changelog entries.)

I add the ChangeLog to the top of the patch to avoid this. :)

Good idea.


- if (TREE_CODE (w) != INTEGER_CST)
+ if (w == error_mark_node)
+ ; /* Continue with error processing below. */
+ else if (TREE_CODE (w) != INTEGER_CST)

- error ("enumerator value for %qD is not an integer constant",
- name);
+ if (value != error_mark_node)
+ error ("enumerator value for %qD is not an integer constant",
+ name);

Hmm, I don't see these errors as redundant, but rather as giving context for the previous error.

Even with caret diagnostics? Anyway, I will try to resolve this in a different way.


+ else if (!parser->integral_constant_expression_p
+ && !parser->non_integral_constant_expression_p)
+ expression = error_mark_node;

This doesn't make sense to me. parser->integral_constant_expression_p should always be true at this point if you're moving the restore later (which also seems unnecessary).

I think parser->integral_constant_expression_p reflects the result of the cp_parser_assignment_expression() call earlier in this function.


--
Florian Weimer / Red Hat Product Security Team


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]