[Python-Dev] [Python-checkins] cpython: Issue #19976: Argument Clinic METH_NOARGS functions now always

Stefan Behnel stefan_ml at behnel.de
Sat Jan 4 22:17:43 CET 2014


Stefan Krah, 04.01.2014 21:00:
> Probably Rietveld did not send mail, so I mention my review comments again:
> 
> larry.hastings wrote:
>> +#ifdef __GNUC__
>> +#define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
>> +#else
>> +#define Py_UNUSED(name) _unused_ ## name
>> +#endif
>> +
> 
> The Intel compiler defines __GNUC__ but chokes on the __attribute__().
> 
> This works:
> 
> #if defined(__GNUC__) && !defined(__INTEL_COMPILER)

We use this in Cython and according to the mailing list echo, it would seem
that there are people running it through Intel's compiler as well:

"""
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 &&
__GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
"""

I wonder why this works, though, given that you say Intel doesn't support
"__attribute__". The only difference I can spot is the space behind it.

In any case, I agree that the right way to do it is a bit more complex than
in the original commit.

Stefan




More information about the Python-Dev mailing list