[Ltrace-devel] [PATCH] Fix build with 32-bit Clang

Andrey Zonov zont at FreeBSD.org
Mon Feb 11 13:29:20 UTC 2013


On 2/8/13 1:45 AM, Petr Machata wrote:
> Andrey Zonov <zont at FreeBSD.org> writes:
> 
>> diff --git a/glob.c b/glob.c
>> index b26637f..06fec47 100644
>> --- a/glob.c
>> +++ b/glob.c
>> @@ -27,7 +27,7 @@
>>  static ssize_t
>>  match_character_class(const char *glob, size_t length, size_t from)
>>  {
>> -	size_t i;
>> +	size_t i = 0;
>>  	if (length > 0)
>>  		for (i = from + 2; i < length - 1 && glob[++i] != ':'; )
>>  			;
> 
> FWIW this is rewritten to memchr on config branch anyway, but never
> mind, that's not a problem.
> 
>> diff --git a/output.c b/output.c
>> index fe62bb4..fbb3ac8 100644
>> --- a/output.c
>> +++ b/output.c
>> @@ -95,7 +95,7 @@ begin_of_line(struct process *proc, int is_func, int
>> indent)
>>  		old_tv.tv_sec = tv.tv_sec;
>>  		old_tv.tv_usec = tv.tv_usec;
>>  		current_column += fprintf(options.output, "%3lu.%06d ",
>> -					  diff.tv_sec, (int)diff.tv_usec);
>> +				(unsigned long)diff.tv_sec, (int)diff.tv_usec);
>>  	}
>>  	if (opt_t) {
>>  		struct timeval tv;
> 
> See below.
> 
>> @@ -104,7 +104,7 @@ begin_of_line(struct process *proc, int is_func, int
>> indent)
>>  		gettimeofday(&tv, &tz);
>>  		if (opt_t > 2) {
>>  			current_column += fprintf(options.output, "%lu.%06d ",
>> -						  tv.tv_sec, (int)tv.tv_usec);
>> +					(unsigned long)tv.tv_sec, (int)tv.tv_usec);
> 
> This should be:
> 
>  			current_column += fprintf(options.output, "%lu.%06d ",
> -						  tv.tv_sec, (int)tv.tv_usec);
> +                                                 (unsigned long)tv.tv_sec,
> +                                                 (int)tv.tv_usec);
> 
>>  		} else if (opt_t > 1) {
>>  			struct tm *tmp = localtime(&tv.tv_sec);
>>  			current_column +=
> 
> Apart from those two coding style nits, that's fine.
> 
> Just out of curiosity, do those citations come from FreeBSD?  Mismatches
> in sizes of tv_usec and tv_sec seem like they should be due to libc
> differences, it doesn't seem like something that you can attribute to
> LLVM.
> 

Clang just makes more strict checking on types and other things than
gcc.  Since Clang is default compiler on FreeBSD, all these errors
should be fixed before I'll come up with FreeBSD support.

Thanks for reviewing, I'll send updated patch in a moment.

-- 
Andrey Zonov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 535 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20130211/4f436dbf/attachment.pgp>


More information about the Ltrace-devel mailing list