Skip to content

Commit 5649cb8

Browse files
comandpixar-oss
authored andcommitted
Add ignores for GCC 11 compiler warnings.
(Internal change: 2346268)
1 parent bb38a72 commit 5649cb8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pxr/base/arch/pragmas.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
#define ARCH_PRAGMA_UNUSED_FUNCTION \
4949
_Pragma("GCC diagnostic ignored \"-Wunused-function\"")
5050

51+
#define ARCH_PRAGMA_STRINGOP_OVERFLOW \
52+
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"")
53+
5154
#elif defined(ARCH_COMPILER_CLANG)
5255

5356
#define ARCH_PRAGMA_PUSH \
@@ -181,6 +184,10 @@
181184
#define ARCH_PRAGMA_UNUSED_FUNCTION
182185
#endif
183186

187+
#if !defined ARCH_PRAGMA_STRINGOP_OVERFLOW
188+
#define ARCH_PRAGMA_STRINGOP_OVERFLOW
189+
#endif
190+
184191
#if !defined ARCH_PRAGMA_UNUSED_PRIVATE_FIELD
185192
#define ARCH_PRAGMA_UNUSED_PRIVATE_FIELD
186193
#endif

pxr/base/vt/testenv/testVtCpp.cpp

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

5454
#include "pxr/base/arch/defines.h"
5555
#include "pxr/base/arch/fileSystem.h"
56+
#include "pxr/base/arch/pragmas.h"
5657

5758
#include <cstdio>
5859
#include <cmath>
@@ -505,6 +506,9 @@ static void testArray() {
505506
// Test that attempts to create overly large arrays throw
506507
// std::bad_alloc
507508

509+
ARCH_PRAGMA_PUSH
510+
ARCH_PRAGMA_STRINGOP_OVERFLOW
511+
508512
VtIntArray ia;
509513
try {
510514
ia.resize(std::numeric_limits<size_t>::max());
@@ -530,6 +534,8 @@ static void testArray() {
530534
catch (std::bad_alloc const &) {
531535
// pass
532536
}
537+
538+
ARCH_PRAGMA_POP
533539
}
534540
}
535541

0 commit comments

Comments
 (0)