File: 0003-Suppress-Wformat-overflow-warning-error.patch

package info (click to toggle)
rapidjson 1.1.0%2Bdfsg2-7.6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,264 kB
  • sloc: cpp: 18,852; ansic: 2,434; python: 235; xml: 182; sh: 83; makefile: 10; javascript: 2
file content (41 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 152511689bd9b9cdeed6a580479698e13df056b6 Mon Sep 17 00:00:00 2001
From: Philipp A Hartmann <pah@qo.cx>
Date: Sun, 15 Jul 2018 16:02:03 +0200
Subject: [PATCH 3/3] Suppress -Wformat-overflow warning/error

GCC 7 and later warn about overflow/truncation when using
sprintf and related functions with fixed-size buffers.

Suppress the warning in schematest.cpp.
---
 test/perftest/schematest.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/perftest/schematest.cpp b/test/perftest/schematest.cpp
index 468f5fe6..7d27344b 100644
--- a/test/perftest/schematest.cpp
+++ b/test/perftest/schematest.cpp
@@ -11,6 +11,11 @@
 
 using namespace rapidjson;
 
+RAPIDJSON_DIAG_PUSH
+#if defined(__GNUC__) && __GNUC__ >= 7
+RAPIDJSON_DIAG_OFF(format-overflow)
+#endif
+
 template <typename Allocator>
 static char* ReadFile(const char* filename, Allocator& allocator) {
     const char *paths[] = {
@@ -42,6 +47,8 @@ static char* ReadFile(const char* filename, Allocator& allocator) {
     return json;
 }
 
+RAPIDJSON_DIAG_POP
+
 class Schema : public PerfTest {
 public:
     Schema() {}
-- 
2.18.0