cython/cython — pull request #168 by bfroehle (2012-12-10 20:07:30+00:00)
Title: Fix warning: unused function '__pyx_pw_5numpy_7ndarray_1__getbuffer__'

I've been noticing some unused function warnings of the following variety:

```
test.cpp:1189:12: warning: unused function '__pyx_pw_5numpy_7ndarray_1__getbuffer__' [-Wunused-function]
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
^
test.cpp:2008:13: warning: unused function '__pyx_pw_5numpy_7ndarray_3__releasebuffer__' [-Wunused-function]
static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
^
2 warnings generated.
```

These can be easily generated from a small test script:

```cython
from numpy cimport import_array, import_ufunc
import_array(); import_ufunc()
```

These warnings were once silenced by some code introduced in a previous commit:

> commit 6cc61605a91c8ebf16318a07439a206118d81614
> Author: Lisandro Dalcin
> Date: Wed Apr 28 16:18:43 2010 -0300
> introduce CYTHON_UNUSED macro to annotate functions and parametes
> - Silent compiler warnings about unused function/parametes
> - Defined to __attribute__((__unused__)) for GCC(>3.4) and ICC
> - Applied to a __{get|release}buffer__ special methods
> - Applied to a couple of (self,unused) parameter pairs

But later reappeared in:

> commit 519a19a9006494c6165ea481553a298d9bf9a008
> Author: Vitja Makarov
> Date: Sun Jan 8 19:22:38 2012 +0400
> DefNode: split into function and python wrapper

This pull request re-silences the warnings by adding `CYTHON_UNUSED` to the function prototype.

```
OLD:
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/

NEW:
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
```