[Ltrace-devel] [PATCH] Fix build with Clang on FreeBSD

Andrey Zonov zont at FreeBSD.org
Mon Feb 11 13:43:57 UTC 2013


---
 breakpoints.c  | 2 +-
 glob.c         | 2 +-
 lens_default.c | 2 +-
 options.c      | 4 ++--
 output.c       | 8 +++++---
 5 files changed, 10 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 1dccdd1..dd11a33 100644
--- a/output.c
+++ b/output.c
@@ -100,7 +100,8 @@ 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;
@@ -109,7 +110,8 @@ 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 +=
@@ -602,7 +604,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/20130211/ec7047c7/attachment.pgp>


More information about the Ltrace-devel mailing list