Commit 12be3d4b authored by Stefan Behnel's avatar Stefan Behnel Committed by GitHub

Merge pull request #2839 from fortran-favors-the-old/gcc_diagnostic_pragma

Avoid GCC diagnostic pragma if GCC < 4.6
parents bce20eb6 b511e2dd
......@@ -710,6 +710,10 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
// NOTE: inlining because most arguments are constant, which collapses lots of code below
// GCC diagnostic pragmas were introduced in GCC 4.6
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define GCC_DIAGNOSTIC
#endif
static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t width, char padding_char, char format_char) {
// simple and conservative C string allocation on the stack: each byte gives at most 3 digits, plus sign
char digits[sizeof({{TYPE}})*3+2];
......@@ -719,12 +723,12 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
Py_ssize_t length, ulength;
int prepend_sign, last_one_off;
{{TYPE}} remaining;
#ifdef __GNUC__
#ifdef GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
const {{TYPE}} neg_one = ({{TYPE}}) -1, const_zero = ({{TYPE}}) 0;
#ifdef __GNUC__
#ifdef GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
const int is_unsigned = neg_one > const_zero;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment