diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-02-09 15:31:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 15:31:26 (GMT) |
commit | bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e (patch) | |
tree | b0bdd00da587355830e8b18fbadc72054ae0ad0c /Modules | |
parent | 5bb0005f9ff768ac443924b4bb26c3818ce8dc5a (diff) | |
download | cpython-bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e.zip cpython-bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e.tar.gz cpython-bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e.tar.bz2 |
Fix some warnings produced by different compilers. (#5593)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_decimal/libmpdec/mpdecimal.c | 6 | ||||
-rw-r--r-- | Modules/socketmodule.c | 8 | ||||
-rw-r--r-- | Modules/timemodule.c | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c index 328ab92..bfa8bb3 100644 --- a/Modules/_decimal/libmpdec/mpdecimal.c +++ b/Modules/_decimal/libmpdec/mpdecimal.c @@ -53,6 +53,12 @@ #endif +/* Disable warning that is part of -Wextra since gcc 7.0. */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7 + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + + #if defined(_MSC_VER) #define ALWAYS_INLINE __forceinline #elif defined(LEGACY_COMPILER) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 13936aa..23061be 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -4867,7 +4867,9 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) if (type == -1) { int tmp; socklen_t slen = sizeof(tmp); - if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &tmp, &slen) == 0) { + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, + (void *)&tmp, &slen) == 0) + { type = tmp; } else { #ifdef MS_WINDOWS @@ -4885,7 +4887,9 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) if (proto == -1) { int tmp; socklen_t slen = sizeof(tmp); - if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &tmp, &slen) == 0) { + if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, + (void *)&tmp, &slen) == 0) + { proto = tmp; } else { #ifdef MS_WINDOWS diff --git a/Modules/timemodule.c b/Modules/timemodule.c index b17ab5a..998216c 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1192,11 +1192,13 @@ _PyTime_GetProcessTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) if (freq != -1) { /* check that _PyTime_MulDiv(t, SEC_TO_NS, ticks_per_second) cannot overflow below */ +#if LONG_MAX > _PyTime_MAX / SEC_TO_NS if ((_PyTime_t)freq > _PyTime_MAX / SEC_TO_NS) { PyErr_SetString(PyExc_OverflowError, "_SC_CLK_TCK is too large"); return -1; } +#endif ticks_per_second = freq; } |