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: [PATCH v3] gcc/c-family/c-cppbuiltin.c: Let buffer enough to print host wide integer value


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


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