Skip to contentSkip to conversation

rt-tests: printf format compile warning

PATCH NAK Frank Rowand 4 participants 5 messages May 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rt-tests: printf format compile warning

V2: use type casting instead of ugly constant in format string

Fix printf format string to fix compile warning for ARM 32 bit target.

---
src/cyclictest/cyclictest.c | 2 1 + 1 - 0 !

 1 file changed, 1 insertion(+), 1 deletion(-)
src/cyclictest/cyclictest.c +1 -1
Index: b/src/cyclictest/cyclictest.c
===================================================================
@@ -1575,7 +1575,7 @@ int main(int argc, char **argv)
 		print_tids(parameters, num_threads);
 		if (break_thread_id) {
 			printf("# Break thread: %d\n", break_thread_id);
-			printf("# Break value: %lu\n", break_thread_value);
+			printf("# Break value: %llu\n", (unsigned long long)break_thread_value);
 		}
 	}
 	
#1 lore raw
Quoted 6 lines · Frank Rowand

V2: use type casting instead of ugly constant in format string

Fix printf format string to fix compile warning for ARM 32 bit target.

Oh much better. :-)

Quoted 19 lines

---
src/cyclictest/cyclictest.c | 2 1 + 1 - 0 !

 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +1 -1
@@ -1575,7 +1575,7 @@ int main(int argc, char **argv)
 		print_tids(parameters, num_threads);
 		if (break_thread_id) {
 			printf("# Break thread: %d\n", break_thread_id);
-			printf("# Break value: %lu\n", break_thread_value);
+			printf("# Break value: %llu\n", (unsigned long long)break_thread_value);
 		}
 	}
 
Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#2 lore raw
Quoted 17 lines · On Thu, 03 May 2012 14:13:56 -0700 Darren Hart <[email protected]> wrote:
Quoted 6 lines · Frank Rowand

V2: use type casting instead of ugly constant in format string

Fix printf format string to fix compile warning for ARM 32 bit target.

Oh much better. :-)

Quoted 5 lines

---
src/cyclictest/cyclictest.c | 2 1 + 1 - 0 !

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines

Index: b/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c int main(int argc, char **argv) · line 1581

Quoted 8 lines
src/cyclictest/cyclictest.c +1 -1
@@ -1575,7 +1575,7 @@ int main(int argc, char **argv)
 		print_tids(parameters, num_threads);
 		if (break_thread_id) {
 			printf("# Break thread: %d\n", break_thread_id);
-			printf("# Break value: %lu\n", break_thread_value);
+			printf("# Break value: %llu\n", (unsigned long long)break_thread_value);
 		}
 	}
 

Yes, I like this better. I pulled the original and applied this.

#3 lore raw
Quoted 37 lines · Clark Williams
Quoted 17 lines · On Thu, 03 May 2012 14:13:56 -0700 Darren Hart <[email protected]> wrote:
Quoted 6 lines · Frank Rowand

V2: use type casting instead of ugly constant in format string

Fix printf format string to fix compile warning for ARM 32 bit target.

Oh much better. :-)

Quoted 5 lines

---
src/cyclictest/cyclictest.c | 2 1 + 1 - 0 !

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines

Index: b/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c int main(int argc, char **argv) · line 1581

Quoted 8 lines
src/cyclictest/cyclictest.c +1 -1
@@ -1575,7 +1575,7 @@ int main(int argc, char **argv)
 		print_tids(parameters, num_threads);
 		if (break_thread_id) {
 			printf("# Break thread: %d\n", break_thread_id);
-			printf("# Break value: %lu\n", break_thread_value);
+			printf("# Break value: %llu\n", (unsigned long long)break_thread_value);
 		}
 	}
 
Quoted 1 line

Yes, I like this better. I pulled the original and applied this.

Well, I really hate the C99 macros too, they're uglier than sin. But, you want to fix a compiler error on 32-bit by creating one on 64-bits? What are you guys smoking?

NAK

The above patch creates the following error on 64-bit src/cyclictest/cyclictest.c:1564:4: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ [-Wformat]

#4 lore raw
Quoted 47 lines · John Kacur
Quoted 37 lines · Clark Williams
Quoted 17 lines · On Thu, 03 May 2012 14:13:56 -0700 Darren Hart <[email protected]> wrote:
Quoted 6 lines · Frank Rowand

V2: use type casting instead of ugly constant in format string

Fix printf format string to fix compile warning for ARM 32 bit target.

Oh much better. :-)

Quoted 5 lines

---
 src/cyclictest/cyclictest.c |    2       1 +     1 -     0 !

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines

Index: b/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c int main(int argc, char **argv) · line 1581

Quoted 8 lines
src/cyclictest/cyclictest.c +1 -1
@@ -1575,7 +1575,7 @@ int main(int argc, char **argv)
           print_tids(parameters, num_threads);
           if (break_thread_id) {
                   printf("# Break thread: %d\n", break_thread_id);
-                 printf("# Break value: %lu\n", break_thread_value);
+                 printf("# Break value: %llu\n", (unsigned long long)break_thread_value);
           }
   }
 
Quoted 1 line

Yes, I like this better. I pulled the original and applied this.

Well, I really hate the C99 macros too, they're uglier than sin. But, you want to fix a compiler error on 32-bit by creating one on 64-bits? What are you guys smoking?

Quoted 6 lines

NAK

The above patch creates the following error on 64-bit src/cyclictest/cyclictest.c:1564:4: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ [-Wformat]

Ok, obviously, it's me who must have been smoking something. My bad, my bad. there is a cast in there.

That patch is way better, sorry. I approve!
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html