• Kirill Smelkov's avatar
    Fix build with Python that enables -Werror=declaration-after-statement · e0b25398
    Kirill Smelkov authored
    In C99 declaration after statement is ok, and we explicitly compile with -std=gnu99.
    
    Python >= 3.4 however adds -Werror=declaration-after-statement even for extension
    modules irregardless of their compilation flags:
    
      https://bugs.python.org/issue21121
    
    and the build fails this way:
    
        building 'wendelin.bigfile._bigfile' extension
        creating build/temp.linux-x86_64-3.4
        creating build/temp.linux-x86_64-3.4/bigfile
        creating build/temp.linux-x86_64-3.4/lib
        gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall
    -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -D_GNU_SOURCE
    -I./include -I./3rdparty/ccan -I./3rdparty/include -I/usr/include/python3.4m -c bigfile/_bigfile.c -o build/temp.linux-x86_64-3.4/bigfile/_bigfile.o
    -std=gnu99 -fplan9-extensions -fvisibility=hidden
        bigfile/_bigfile.c: In function ‘pyfile_new’:
        bigfile/_bigfile.c:679:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
             static char *kw_list[] = {"blksize", NULL};
             ^
        cc1: some warnings being treated as errors
        error: command 'gcc' failed with exit status 1
    
    Ensure we turn off this warning and error because we already rely on compiling in C99 mode.
    Reported-and-tested-by: default avatarIvan Tyagov <ivan@tyagov.com>
    e0b25398
Makefile 5.53 KB