[PATCH] dwarf2out: Print the name of the unspec as part of the warning

2011-03-21 Thread Andreas Krebbel
Hi,

with the attached patch dwarf2out tries to print the name of the
unspec together with the numeric value in case the back end uses
define_c_enum for the unspec constants.

Ok for mainline?

Bye,

-Andreas-


2011-03-21  Andreas Krebbel  

* dwarf2out.c (const_ok_for_output_1): Print the unspec enum name
if possible.


Index: gcc/dwarf2out.c
===
*** gcc/dwarf2out.c.orig
--- gcc/dwarf2out.c
*** const_ok_for_output_1 (rtx *rtlp, void *
*** 13612,13620 
--- 13612,13627 
inform (current_function_decl
? DECL_SOURCE_LOCATION (current_function_decl)
: UNKNOWN_LOCATION,
+ #if NUM_UNSPEC_VALUES > 0
+   "non-delegitimized UNSPEC %s (%d) found in variable location",
+   (XINT (rtl, 1) >= 0 && XINT (rtl, 1) < NUM_UNSPEC_VALUES)
+   ? unspec_strings[XINT (rtl, 1)] : "unkown",
+   XINT (rtl, 1));
+ #else
"non-delegitimized UNSPEC %d found in variable location",
XINT (rtl, 1));
  #endif
+ #endif
expansion_failed (NULL_TREE, rtl,
"UNSPEC hasn't been delegitimized.\n");
return 1;


Re: [PATCH] dwarf2out: Print the name of the unspec as part of the warning

2011-03-22 Thread Richard Henderson
On 03/21/2011 03:26 AM, Andreas Krebbel wrote:
> + (XINT (rtl, 1) >= 0 && XINT (rtl, 1) < NUM_UNSPEC_VALUES)
> + ? unspec_strings[XINT (rtl, 1)] : "unkown",
> + XINT (rtl, 1));

The parentheses ought to be enclosing the entire ternary expression
for clarity.  Also, typo in "unkown".

Ok with that change.


r~