Make the display of the warning "Useless use of a constant (%s)" more robust
authorRafael Garcia-Suarez <rgs@consttype.org>
Wed, 25 Jan 2012 10:41:13 +0000 (11:41 +0100)
committerRafael Garcia-Suarez <rgs@consttype.org>
Wed, 25 Jan 2012 10:48:22 +0000 (11:48 +0100)
commit919f76a3449f063cc80397cca2b402c89b2e5f07
treeb150f901321c6abcd458edeac0237b4a00be1909
parent803e389cdb9c1254934c107b0dcddbfd9821cd0a
Make the display of the warning "Useless use of a constant (%s)" more robust

If the constant is a string (POK), we dump it using pv_pretty, to
properly escape non-printable characters. This also improves detection
of utf-8 encoding in the constant to be printed. Also, this patch
streamlines the tests for the type and value of that constant.

Potential backwards-compatibility issues : if the constant is a string
it will now be enclosed in double quotes, like this :
    Useless use of a constant ("a") in void context
instead of
    Useless use of a constant (a) in void context
op.c
t/lib/warnings/op
t/lib/warnings/perly