diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 7888cf86de0a5c..6e98dc9f5a3166 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -172,7 +172,7 @@ static void update_strong_cache(const PyTypeObject *const type, PyObject *key, PyObject *zone); static PyObject * -zone_from_strong_cache(const PyTypeObject *const type, PyObject *key); +zone_from_strong_cache(const PyTypeObject *const type, PyObject *const key); static PyObject * zoneinfo_new_instance(PyTypeObject *type, PyObject *key) @@ -1219,10 +1219,21 @@ calendarrule_new(uint8_t month, uint8_t week, uint8_t day, int8_t hour, // it may create a bug. Considering that the compiler should be able to // optimize out the first comparison if day is an unsigned integer anyway, // we will leave this comparison in place and disable the compiler warning. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wtautological-compare" +#endif +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif if (day < 0 || day > 6) { -#pragma GCC diagnostic pop +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))) +# pragma GCC diagnostic pop +#endif +#ifdef __clang__ +# pragma clang diagnostic pop +#endif PyErr_Format(PyExc_ValueError, "Day must be in [0, 6]"); return -1; }