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

Andrey Zonov zont at FreeBSD.org
Mon Feb 4 20:16:06 UTC 2013


---
 breakpoints.c  | 2 +-
 glob.c         | 2 +-
 lens_default.c | 2 +-
 options.c      | 4 ++--
 output.c       | 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/breakpoints.c b/breakpoints.c
index 8db4e26..88ada7f 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -382,7 +382,7 @@ breakpoints_init(struct process *proc)
 	struct entry_breakpoint *entry_bp = NULL;
 	int bp_state = 0;
 	int result = -1;
-	switch (lib != NULL) {
+	switch ((int)(lib != NULL)) {
 	fail:
 		switch (bp_state) {
 		case 2:
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] != ':'; )
 			;
diff --git a/lens_default.c b/lens_default.c
index ed3d0e1..9f60dae 100644
--- a/lens_default.c
+++ b/lens_default.c
@@ -673,7 +673,7 @@ bitvect_lens_format_cb(struct lens *lens, FILE *stream,
 	unsigned neg = bits > sz * 4 ? 0xff : 0x00;
  	int o = 0;
-	if (acc_fprintf(&o, stream, "%s<", "~" + (neg == 0x00)) < 0)
+	if (acc_fprintf(&o, stream, "%s<", &"~"[neg == 0x00]) < 0)
 		return -1;
  	size_t bitno = 0;
diff --git a/options.c b/options.c
index eaf32fa..693676b 100644
--- a/options.c
+++ b/options.c
@@ -291,7 +291,7 @@ parse_filter(struct filter *filt, char *expr, int
operators)
 	enum filter_rule_type type = FR_ADD;
  	while (*expr != 0) {
-		size_t s = strcspn(expr, "-+@" + (operators ? 0 : 2));
+		size_t s = strcspn(expr, &"-+@"[operators ? 0 : 2]);
 		char *symname = expr;
 		char *libname;
 		char *next = expr + s + 1;
@@ -310,7 +310,7 @@ parse_filter(struct filter *filt, char *expr, int
operators)
 		} else {
 			assert(expr[s] == '@');
 			expr[s] = 0;
-			s = strcspn(next, "-+" + (operators ? 0 : 2));
+			s = strcspn(next, &"-+"[operators ? 0 : 2]);
 			if (s == 0) {
 				libname = "*";
 				expr = next;
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;
@@ -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);
 		} else if (opt_t > 1) {
 			struct tm *tmp = localtime(&tv.tv_sec);
 			current_column +=
@@ -597,7 +597,7 @@ output_right(enum tof type, struct process *proc,
struct library_symbol *libsym)
  	if (opt_T) {
 		fprintf(options.output, " <%lu.%06d>",
-			current_time_spent.tv_sec,
+			(unsigned long)current_time_spent.tv_sec,
 			(int)current_time_spent.tv_usec);
 	}
 	fprintf(options.output, "\n");
-- 
1.8.0.2


-------------- 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/20130205/e71f75c7/attachment.pgp>


More information about the Ltrace-devel mailing list