Build broken due to constness at 1bd778f5
Building at the latest HEAD does this:
andrea@tisiphone:~/projects/hammer/hammer-1 [221]$ scons --variant=debug --tests build
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o build/debug/examples/base64.o -c -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -Wno-unused-variable -g -D_POSIX_C_SOURCE=200809L build/debug/examples/base64.c
build/debug/examples/base64.c: In function 'init_parser':
build/debug/examples/base64.c:29:38: error: passing argument 1 of 'h_choice' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
const HParser *bsfdig = h_choice(alpha, digit, plus, slash, NULL);
^~~~~
In file included from build/debug/examples/base64.c:12:
build/debug/examples/../src/hammer.h:472:68: note: expected 'HParser *' {aka 'struct HParser_ *'} but argument is of type 'const HParser *' {aka 'const struct HParser_ *'}
HAMMER_FN_DECL_VARARGS_ATTR(H_GCC_ATTRIBUTE((sentinel)), HParser*, h_choice, HParser* p);
^~~~~~~~
build/debug/examples/../src/hammer.h:241:11: note: in definition of macro 'HAMMER_FN_DECL_VARARGS_ATTR'
rtype_t name(__VA_ARGS__, ...) attr; \
^~~~
build/debug/examples/base64.c:36:45: error: passing argument 1 of 'h_sequence' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
const HParser *base64_quad = h_sequence(bsfdig, bsfdig, bsfdig, bsfdig, NULL);
^~~~~~
In file included from build/debug/examples/base64.c:12:
build/debug/examples/../src/hammer.h:463:68: note: expected 'HParser *' {aka 'struct HParser_ *'} but argument is of type 'const HParser *' {aka 'const struct HParser_ *'}
HAMMER_FN_DECL_VARARGS_ATTR(H_GCC_ATTRIBUTE((sentinel)), HParser*, h_sequence, HParser* p);
^~~~~~~~~~
build/debug/examples/../src/hammer.h:241:11: note: in definition of macro 'HAMMER_FN_DECL_VARARGS_ATTR'
rtype_t name(__VA_ARGS__, ...) attr; \
^~~~
build/debug/examples/base64.c:39:42: error: passing argument 1 of 'h_sequence' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
const HParser *base64_2 = h_sequence(bsfdig, bsfdig, bsfdig_4bit, equals, h_end_p(), NULL);
^~~~~~
In file included from build/debug/examples/base64.c:12:
build/debug/examples/../src/hammer.h:463:68: note: expected 'HParser *' {aka 'struct HParser_ *'} but argument is of type 'const HParser *' {aka 'const struct HParser_ *'}
HAMMER_FN_DECL_VARARGS_ATTR(H_GCC_ATTRIBUTE((sentinel)), HParser*, h_sequence, HParser* p);
^~~~~~~~~~
build/debug/examples/../src/hammer.h:241:11: note: in definition of macro 'HAMMER_FN_DECL_VARARGS_ATTR'
rtype_t name(__VA_ARGS__, ...) attr; \
^~~~
build/debug/examples/base64.c:40:42: error: passing argument 1 of 'h_sequence' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
const HParser *base64_1 = h_sequence(bsfdig, bsfdig_2bit, equals, equals, h_end_p(), NULL);
^~~~~~
In file included from build/debug/examples/base64.c:12:
build/debug/examples/../src/hammer.h:463:68: note: expected 'HParser *' {aka 'struct HParser_ *'} but argument is of type 'const HParser *' {aka 'const struct HParser_ *'}
HAMMER_FN_DECL_VARARGS_ATTR(H_GCC_ATTRIBUTE((sentinel)), HParser*, h_sequence, HParser* p);
^~~~~~~~~~
build/debug/examples/../src/hammer.h:241:11: note: in definition of macro 'HAMMER_FN_DECL_VARARGS_ATTR'
rtype_t name(__VA_ARGS__, ...) attr; \
^~~~
build/debug/examples/base64.c:42:40: error: passing argument 1 of 'h_sequence' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
const HParser *base64 = h_sequence(base64_quads, base64_ending, NULL);
^~~~~~~~~~~~
In file included from build/debug/examples/base64.c:12:
build/debug/examples/../src/hammer.h:463:68: note: expected 'HParser *' {aka 'struct HParser_ *'} but argument is of type 'const HParser *' {aka 'const struct HParser_ *'}
HAMMER_FN_DECL_VARARGS_ATTR(H_GCC_ATTRIBUTE((sentinel)), HParser*, h_sequence, HParser* p);
^~~~~~~~~~
build/debug/examples/../src/hammer.h:241:11: note: in definition of macro 'HAMMER_FN_DECL_VARARGS_ATTR'
rtype_t name(__VA_ARGS__, ...) attr; \
^~~~
build/debug/examples/base64.c: In function 'assert_parse':
build/debug/examples/base64.c:66:36: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
fprintf(stderr, "parsed=%lld bytes\n", result->bit_length/8);
~~~^ ~~~~~~~~~~~~~~~~~~~~
%ld
cc1: all warnings being treated as errors
scons: *** [build/debug/examples/base64.o] Error 1
scons: building terminated because of errors.
Using scons --variant=debug --tests
or scons --variant=debug --tests test
works okay though.