Skip to content

Commit 1525116

Browse files
committed
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.
1 parent a26267d commit 1525116

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/perftest/schematest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
using namespace rapidjson;
1313

14+
RAPIDJSON_DIAG_PUSH
15+
#if defined(__GNUC__) && __GNUC__ >= 7
16+
RAPIDJSON_DIAG_OFF(format-overflow)
17+
#endif
18+
1419
template <typename Allocator>
1520
static char* ReadFile(const char* filename, Allocator& allocator) {
1621
const char *paths[] = {
@@ -42,6 +47,8 @@ static char* ReadFile(const char* filename, Allocator& allocator) {
4247
return json;
4348
}
4449

50+
RAPIDJSON_DIAG_POP
51+
4552
class Schema : public PerfTest {
4653
public:
4754
Schema() {}

0 commit comments

Comments
 (0)