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: [java/c/middle-end/objc] kill %H specifier


On Tue, Jul 14, 2009 at 3:06 PM, Joseph S. Myers<joseph@codesourcery.com> wrote:
> On Mon, 6 Jul 2009, Manuel LÃpez-IbÃÃez wrote:
>
>> - Â Â Â if (integer_zerop (ret))
>> - Â Â Â Â warnmsg = G_("comparison always false due to limited range of "
>> - Â Â Â Â Â Â Â Â Â Â Â"data type");
>> - Â Â Â else
>> - Â Â Â Â warnmsg = G_("comparison always true due to limited range of "
>> - Â Â Â Â Â Â Â Â Â Â Â"data type");
>> - Â Â }
>> -
>> - Â Â Âif (warnmsg)
>> - Â Â {
>> Â Â Â Â location_t location;
>>
>> Â Â Â Â if (!gimple_has_location (stmt))
>> Â Â Â Â Â location = input_location;
>> Â Â Â Â else
>> Â Â Â Â Â location = gimple_location (stmt);
>>
>> - Â Â Â warning (OPT_Wtype_limits, "%H%s", &location, warnmsg);
>> + Â Â Â warning_at (location, OPT_Wtype_limits,
>> + Â Â Â Â Â Â Â Â Â integer_zerop (ret)
>> + Â Â Â Â Â Â Â Â Â ? "comparison always false due to limited range of data type"
>> + Â Â Â Â Â Â Â Â Â : "comparison always true due to limited range of data type");
>
> This causes the "comparison always true" message no longer to be extracted
> for translation by exgettext; if the format string passed to the function
> is an expression more complicated than a single string constant, you still
> need to use G_ to mark up the messages for translation.

In fact since there is no %H anymore, can't we do something like:
if (integer_zerop (ret))
  warning_at (location, OPT_Wtype_limits, "comparison always false due
to limited range of data type");
else
  warning_at (location, OPT_Wtype_limits, "comparison always true due
to limited range of data type");

And simplify this code?

Thanks,
Andrew Pinski


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