mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-129467: Fix compiler warning in mpdecimal word_to_string() (#116346)
Turn off false-positive -Wstringop-overflow in word_to_string().
This commit is contained in:
parent
652f66ac38
commit
6c63afc3be
2 changed files with 9 additions and 2 deletions
|
@ -347,6 +347,10 @@ mpd_qset_string_exact(mpd_t *dec, const char *s, uint32_t *status)
|
|||
or the location of a decimal point. */
|
||||
#define EXTRACT_DIGIT(s, x, d, dot) \
|
||||
if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#endif
|
||||
static inline char *
|
||||
word_to_string(char *s, mpd_uint_t x, int n, char *dot)
|
||||
{
|
||||
|
@ -378,6 +382,9 @@ word_to_string(char *s, mpd_uint_t x, int n, char *dot)
|
|||
*s = '\0';
|
||||
return s;
|
||||
}
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* Print exponent x to string s. Undefined for MPD_SSIZE_MIN. */
|
||||
static inline char *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue