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: Jakub Jelinek <jakub at redhat dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, 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 17:34:31 +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> <54752FBC dot 6020804 at gmail dot com> <20141126073341 dot GB1679 at tucnak dot redhat dot com>
On 11/26/14 15:33, Jakub Jelinek wrote:
> On Wed, Nov 26, 2014 at 09:41:16AM +0800, Chen Gang wrote:
>> 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",
>
> Oh, and please use spaces around HOST_WIDE_INT_PRINT_DEC etc.,
> with C++11 user defined literals it is always better to have whitespace
> in there.
>
OK, thanks, I shall notice about it when send patch v4.
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed