[gjs] test-coverage: Ignore format-nonliteral warning
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] test-coverage: Ignore format-nonliteral warning
- Date: Thu, 10 Oct 2019 18:27:24 +0000 (UTC)
commit 7ed46b49dc880e6e00f9d427a5bb6406a3dde725
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]