Skip to content

Commit 6c63afc

Browse files
authored
gh-129467: Fix compiler warning in mpdecimal word_to_string() (#116346)
Turn off false-positive -Wstringop-overflow in word_to_string().
1 parent 652f66a commit 6c63afc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Misc/sbom.spdx.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_decimal/libmpdec/io.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ mpd_qset_string_exact(mpd_t *dec, const char *s, uint32_t *status)
347347
or the location of a decimal point. */
348348
#define EXTRACT_DIGIT(s, x, d, dot) \
349349
if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
350+
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
351+
#pragma GCC diagnostic push
352+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
353+
#endif
350354
static inline char *
351355
word_to_string(char *s, mpd_uint_t x, int n, char *dot)
352356
{
@@ -378,6 +382,9 @@ word_to_string(char *s, mpd_uint_t x, int n, char *dot)
378382
*s = '\0';
379383
return s;
380384
}
385+
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
386+
#pragma GCC diagnostic pop
387+
#endif
381388

382389
/* Print exponent x to string s. Undefined for MPD_SSIZE_MIN. */
383390
static inline char *

0 commit comments

Comments
 (0)