Skip to content

Commit 315c4c4

Browse files
authored
Suppress -Wformat-truncation for older GCC (#101557)
1 parent 7037516 commit 315c4c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/native/libs/System.Globalization.Native/pal_icushim.c

+11
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,19 @@ static int FindSymbolVersion(int majorVer, int minorVer, int subVer, char* symbo
6262
// First try just the unversioned symbol
6363
if (dlsym(libicuuc, "u_strlen") == NULL)
6464
{
65+
// suppress Wformat-truncation false-positive warning for gcc 7 and 8
66+
#if defined(__GNUC__) && __GNUC__ > 6 &&__GNUC__ < 9
67+
#pragma GCC diagnostic push
68+
#pragma GCC diagnostic ignored "-Wformat-truncation"
69+
#endif
70+
6571
// Now try just the _majorVer added
6672
snprintf(symbolVersion, symbolVersionLen, "_%d%s", majorVer, suffix);
73+
74+
#if defined(__GNUC__) && __GNUC__ > 6 &&__GNUC__ < 9
75+
#pragma GCC diagnostic pop
76+
#endif
77+
6778
snprintf(symbolName, SYMBOL_NAME_SIZE, "u_strlen%s", symbolVersion);
6879
if (dlsym(libicuuc, symbolName) == NULL)
6980
{

0 commit comments

Comments
 (0)