]> granicus.if.org Git - graphviz/commitdiff
cgraph: squash a macOS warning in 'sprint' tester
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 5 Apr 2022 04:22:04 +0000 (21:22 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 12 Apr 2022 00:00:42 +0000 (17:00 -0700)
macOS provides an `INT8_C` macro that generates an `int`, not an `int8_t`, which
ends up resulting in this code generating `printf` format warnings. An upcoming
commit which enables `-Werror` on this code causes test failures without this.

lib/cgraph/test_sprint.c

index f6c85fced6f47f8a0d833e0fded90c8cf036e62b..885b4be004996362d70fb2edca2bc2bb066c6c33 100644 (file)
@@ -81,7 +81,7 @@ static void test_utf8(void) {
 static void test_int(void) {
   char *s =
       gv_sprint("%d is a nice number, more than %" PRId8 ", less than %lu", 7,
-                INT8_C(-1), 42ul);
+                (int8_t)INT8_C(-1), 42ul);
   assert(strcmp(s, "7 is a nice number, more than -1, less than 42") == 0);
   free(s);
 }