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

Petr Machata pmachata at redhat.com
Thu Feb 7 21:45:46 UTC 2013


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.

Thanks,
PM



More information about the Ltrace-devel mailing list