This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v3] gcc/c-family/c-cppbuiltin.c: Let buffer enough to print host wide integer value
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: rth at redhat dot com, Jeff Law <law at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Nov 2014 09:41:16 +0800
- Subject: Re: [PATCH v3] gcc/c-family/c-cppbuiltin.c: Let buffer enough to print host wide integer value
- Authentication-results: sourceware.org; auth=none
- References: <5474DB2F dot 3010702 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1411260029190 dot 17237 at digraph dot polyomino dot org dot uk>
On 11/26/14 8:31, Joseph Myers wrote:
> On Wed, 26 Nov 2014, Chen Gang wrote:
>
>> + gcc_assert (wi::fits_to_tree_p (value, char_type_node)
>> + || wi::fits_to_tree_p (value, short_integer_type_node)
>> + || wi::fits_to_tree_p (value, integer_type_node)
>> + || wi::fits_to_tree_p (value, long_integer_type_node)
>> + || wi::fits_to_tree_p (value, long_long_integer_type_node));
>
> It doesn't make sense to check for char or short, since you can't write a
> constant of one of those types. And it doesn't make sense to check for
> int or long when checking for long long, as the ranges of int and long are
> subsets of that of long long. So just check long long here.
>
>> + buf = (char *) alloca (strlen (macro) + vlen + extra);
>> +
>> + sprintf (buf, "%s=%s"HOST_WIDE_INT_PRINT_DEC"%s%s",
>> + macro,
>> + value < 0 ? "(" : "",
>> + value,
>> + wi::fits_to_tree_p (value, char_type_node)
>> + || wi::fits_to_tree_p (value, short_integer_type_node)
>> + || wi::fits_to_tree_p (value, integer_type_node)
>
> No need to check for char or short here.
>
Thank you very much for your patient work, I shall send patch v4 for it
within 2 days.
And I have no any ideas about the attachments in your reply mail. If it
is really related with this thread, please let me know.
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed