Skip to content

Commit baf41fc

Browse files
committed
Add -Wno-strict-aliasing to CFLAGS to ignore gcc warning
GitHub issue #133 was raised by @archey: Compilation issues due to strict aliasing These errors occured when building with gcc 6.3: ``` gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-all --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC -DBBBVERSION41 -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-x86_64-2.7/source/py_gpio.o -Wall -Werror -Wextra -Wno-missing-field-initializers source/py_gpio.c: In function ‘py_event_detected’: source/py_gpio.c:433:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Py_RETURN_TRUE; ^~~~~~~~~~~~~~ source/py_gpio.c:435:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Py_RETURN_FALSE; ^~~~~~~~~~~~~~~ source/py_gpio.c: In function ‘py_wait_for_edge’: source/py_gpio.c:479:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Py_RETURN_FALSE; ^~~~~~~~~~~~~~~ cc1: all warnings being treated as errors error: command 'gcc' failed with exit status 1 ``` Py_RETURN_TRUE and Py_RETURN_FALSE are part of the Python C API: https://docs.python.org/2/c-api/bool.html
1 parent af620d5 commit baf41fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
else:
2222
kernel41 = None
2323

24-
CFLAGS = ['-Wall', '-Werror', '-Wextra', '-Wno-missing-field-initializers' ]
24+
CFLAGS = ['-Wall', '-Werror', '-Wextra', '-Wno-missing-field-initializers', '-Wno-strict-aliasing' ]
2525

2626
classifiers = ['Development Status :: 3 - Alpha',
2727
'Operating System :: POSIX :: Linux',

0 commit comments

Comments
 (0)