Skip to content

Commit

Permalink
Suppress -Wformat-truncation for older GCC (#101557)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored May 9, 2024
1 parent 7037516 commit 315c4c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/native/libs/System.Globalization.Native/pal_icushim.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,19 @@ static int FindSymbolVersion(int majorVer, int minorVer, int subVer, char* symbo
// First try just the unversioned symbol
if (dlsym(libicuuc, "u_strlen") == NULL)
{
// suppress Wformat-truncation false-positive warning for gcc 7 and 8
#if defined(__GNUC__) && __GNUC__ > 6 &&__GNUC__ < 9
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation"
#endif

// Now try just the _majorVer added
snprintf(symbolVersion, symbolVersionLen, "_%d%s", majorVer, suffix);

#if defined(__GNUC__) && __GNUC__ > 6 &&__GNUC__ < 9
#pragma GCC diagnostic pop
#endif

snprintf(symbolName, SYMBOL_NAME_SIZE, "u_strlen%s", symbolVersion);
if (dlsym(libicuuc, symbolName) == NULL)
{
Expand Down

0 comments on commit 315c4c4

Please sign in to comment.