[gjs/gnome-3-34] test-coverage: Ignore format-nonliteral warning



commit 95035b01652e5465d9911b1fb2807f499fb39c5b
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 24 02:54:10 2019 +0200

    test-coverage: Ignore format-nonliteral warning

 test/gjs-test-coverage.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 78ed0dd3..d59bee49 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -793,7 +793,18 @@ hit_count_is_more_than_for_function(const char *line,
     max_buf_size = strcspn(line, "\n");
     detected_function = g_new(char, max_buf_size + 1);
     GjsAutoChar format_string = g_strdup_printf("%%5u,%%%zus", max_buf_size);
+
+// clang-format off
+#if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
+#endif
     nmatches = sscanf(line, format_string, &hit_count, detected_function);
+#if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+_Pragma("GCC diagnostic pop")
+#endif
+// clang-format on
+
     g_assert_cmpint(nmatches, ==, 2);
 
     g_assert_cmpstr(data->function, ==, detected_function);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]