cake
cake copied to clipboard
Fixes to build on Ubuntu 18.04 with gcc-9.4
I don't have experiencing with merging/conflicts in git. I will do the changes manually.
This is the output (after some updates) in my machine inside vscode (build) I have some warning but not errors.
The ouput is part from GCC and part from cake.
gcc
Building tools-------------------------------------------
Maketest
205 test functions generated at unit_test.c
Amalgamated file lib.c generated.
parser.c: In function ‘member_declaration_list’:
parser.c:3315:64: warning: passing argument 2 of ‘member_declaration’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
3315 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from parser.c:9:
parser.h:845:79: note: expected ‘struct struct_or_union_specifier *’ but argument is of type ‘const struct struct_or_union_specifier *’
845 | r_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parser.c:3323:72: warning: passing argument 2 of ‘member_declaration’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
3323 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from parser.c:9:
parser.h:845:79: note: expected ‘struct struct_or_union_specifier *’ but argument is of type ‘const struct struct_or_union_specifier *’
845 | r_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parser.c: In function ‘GetEnvironmentVariableA’:
parser.c:6534:1: warning: control reaches end of non-void function [-Wreturn-type]
6534 | }
| ^
At top level:
parser.c:189:13: warning: ‘check_func_close_brace_style’ defined but not used [-Wunused-function]
189 | static void check_func_close_brace_style(struct parser_ctx* ctx, struct token* token)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow_visit.c: In function ‘flow_visit_for_statement’:
flow_visit.c:1848:20: warning: unused variable ‘p_object_compared_with_not_null’ [-Wunused-variable]
1848 | struct object* p_object_compared_with_not_null = NULL;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cake 0.7.4
/home/tra/cake/src/console.h
/home/tra/cake/src/tokenizer.h
/home/tra/cake/src/parser.h
/home/tra/cake/src/error.h
/home/tra/cake/src/fs.h
/home/tra/cake/src/hash.h
/home/tra/cake/src/object.h
/home/tra/cake/src/hashmap.h
/home/tra/cake/src/osstream.h
/home/tra/cake/src/options.h
/home/tra/cake/src/token.h
/home/tra/cake/src/type.h
/home/tra/cake/src/pre_expressions.h
/home/tra/cake/src/expressions.h
/home/tra/cake/src/visit.h
/home/tra/cake/src/format_visit.h
/home/tra/cake/src/token.c
/home/tra/cake/src/hash.c
/home/tra/cake/src/hashmap.c
/home/tra/cake/src/console.c
/home/tra/cake/src/tokenizer.c
/home/tra/cake/src/osstream.c
/home/tra/cake/src/fs.c
/home/tra/cake/src/options.c
/home/tra/cake/src/expressions.c
/home/tra/cake/src/pre_expressions.c
/home/tra/cake/src/type.c
/home/tra/cake/src/object.c
/home/tra/cake/src/parser.c
/home/tra/cake/src/visit.c
/home/tra/cake/src/flow_visit.c
/home/tra/cake/src/flow_visit.c:1489:24: warning: declaration of 't' hides previous declaration [-Whide-declarator]
1489 | const bool _Bool t = ctx->is_size_of_expression;
| ^
/home/tra/cake/src/flow_visit.c:1381:21: note: previous declaration is here
1381 | struct type t = { 0 };
| ^
/home/tra/cake/src/flow_visit.c:1533:21: warning: declaration of 't' hides previous declaration [-Whide-declarator]
1533 | struct type t = { 0 };
| ^
/home/tra/cake/src/flow_visit.c:1381:21: note: previous declaration is here
1381 | struct type t = { 0 };
| ^
/home/tra/cake/src/flow_visit.c:1534:22: warning: declaration of 'p_object' hides previous declaration [-Whide-declarator]
1534 | struct object* p_object = expression_get_object(p_expression->right, &t);
| ^
/home/tra/cake/src/flow_visit.c:1382:22: note: previous declaration is here
1382 | struct object* p_object = expression_get_object(p_expression->left, &t);
| ^
/home/tra/cake/src/error.c
/home/tra/cake/src/format_visit.c
/home/tra/cake/src/tests.c
34 files in 0.73 seconds
0 errors 3 warnings 3 notes
Do you have errors?
Thank you for reply ! Here is my output with your latest changes:
Maketest
205 test functions generated at unit_test.c
Amalgamated file lib.c generated.
parser.c: In function ‘member_declaration_list’:
parser.c:3315:50: warning: passing argument 2 of ‘member_declaration’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
3315 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from parser.c:9:
parser.h:845:34: note: expected ‘struct struct_or_union_specifier *’ but argument is of type ‘const struct struct_or_union_specifier *’
845 | struct member_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^~~~~~~~~~~~~~~~~~
parser.c:3323:51: warning: passing argument 2 of ‘member_declaration’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
3323 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from parser.c:9:
parser.h:845:34: note: expected ‘struct struct_or_union_specifier *’ but argument is of type ‘const struct struct_or_union_specifier *’
845 | struct member_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^~~~~~~~~~~~~~~~~~
parser.c: In function ‘GetEnvironmentVariableA’:
parser.c:6534:1: warning: control reaches end of non-void function [-Wreturn-type]
6534 | }
| ^
At top level:
parser.c:189:13: warning: ‘check_func_close_brace_style’ defined but not used [-Wunused-function]
189 | static void check_func_close_brace_style(struct parser_ctx* ctx, struct token* token)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cake 0.7.4
cake-dad/src/console.h
cake-dad/src/tokenizer.h
cake-dad/src/parser.h
cake-dad/src/error.h
cake-dad/src/fs.h
cake-dad/src/hash.h
cake-dad/src/object.h
cake-dad/src/hashmap.h
cake-dad/src/osstream.h
cake-dad/src/options.h
cake-dad/src/token.h
cake-dad/src/type.h
cake-dad/src/pre_expressions.h
cake-dad/src/expressions.h
cake-dad/src/visit.h
cake-dad/src/format_visit.h
cake-dad/src/token.c
cake-dad/src/hash.c
cake-dad/src/hashmap.c
cake-dad/src/console.c
cake-dad/src/tokenizer.c
cake-dad/src/osstream.c
cake-dad/src/fs.c
cake-dad/src/options.c
cake-dad/src/expressions.c
cake-dad/src/pre_expressions.c
cake-dad/src/type.c
cake-dad/src/object.c
cake-dad/src/parser.c
cake-dad/src/visit.c
cake-dad/src/flow_visit.c
cake-dad/src/flow_visit.c:1533:21: warning: declaration of 't' hides previous declaration [ -Whide-declarator ]
1533 | struct type t = { 0 };
| ^
cake-dad/src/flow_visit.c:1381:21: note: previous declaration is here
1381 | struct type t = { 0 };
| ^
cake-dad/src/flow_visit.c:1534:22: warning: declaration of 'p_object' hides previous declaration [ -Whide-declarator ]
1534 | struct object* p_object = expression_get_object(p_expression->right, &t);
| ^
cake-dad/src/flow_visit.c:1382:22: note: previous declaration is here
1382 | struct object* p_object = expression_get_object(p_expression->left, &t);
| ^
cake-dad/src/error.c
cake-dad/src/format_visit.c
cake-dad/src/tests.c
34 files in 1.00 seconds
0 errors 2 warnings 2 notes
gcc
Building tools-------------------------------------------
emsdk-env emcc -Wno-multichar -DMOCKFILES "lib.c" -o "web\cake.js" -s WASM=0 -s EXPORTED_FUNCTIONS=_CompileText -s EXPORTED_RUNTIME_METHODS=ccall,cwrap
lib.c:3491:8: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
3491 | free(textfile);
| ^~~~~~~~
emsdk-git/upstream/emscripten/cache/sysroot/include/stdlib.h:43:18: note: passing argument to parameter here
43 | void free (void *);
| ^
lib.c:6819:10: warning: 21 enumeration values not handled in switch: 'TK_PRAGMA', 'TK_CHAR_CONSTANT', 'TK_KEYWORD_ASSERT'... [-Wswitch]
6819 | switch (tk)
| ^~
lib.c:8751:19: error: call to undeclared function 'mkdir'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
8751 | int errcode = mkdir(to, 0700);
| ^
lib.c:9517:13: warning: 67 enumeration values not handled in switch: 'C_SUCCESS', 'C_UNEXPECTED', 'C_TOO_MANY_ARGUMENTS'... [-Wswitch]
9517 | switch (e)
| ^
lib.c:11880:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11880 | switch (a->type)
| ^~~~~~~
lib.c:11899:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11899 | switch (a->type)
| ^~~~~~~
lib.c:11916:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11916 | switch (a->type)
| ^~~~~~~
lib.c:11927:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11927 | switch (a->type)
| ^~~~~~~
lib.c:11938:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11938 | switch (a->type)
| ^~~~~~~
lib.c:15736:13: warning: 49 enumeration values not handled in switch: 'PRIMARY_IDENTIFIER', 'PRIMARY_EXPRESSION_ENUMERATOR', 'PRIMARY_EXPRESSION_DECLARATOR'... [-Wswitch]
15736 | switch (expression->expression_type)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib.c:24302:10: warning: 129 enumeration values not handled in switch: 'TK_NONE', 'TK_NEWLINE', 'TK_WHITE_SPACE'... [-Wswitch]
24302 | switch (ctx->current->type)
| ^~~~~~~~~~~~~~~~~~
lib.c:24765:50: warning: passing 'const struct struct_or_union_specifier *' to parameter of type 'struct struct_or_union_specifier *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
24765 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib.c:11367:110: note: passing argument to parameter here
11367 | struct member_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^
lib.c:24773:51: warning: passing 'const struct struct_or_union_specifier *' to parameter of type 'struct struct_or_union_specifier *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
24773 | p_member_declaration = member_declaration(ctx, p_struct_or_union_specifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib.c:11367:110: note: passing argument to parameter here
11367 | struct member_declaration* owner member_declaration(struct parser_ctx* ctx, struct struct_or_union_specifier*);
| ^
lib.c:25394:10: warning: 138 enumeration values not handled in switch: 'TK_NONE', 'TK_NEWLINE', 'TK_WHITE_SPACE'... [-Wswitch]
25394 | switch (ctx->current->type)
| ^~~~~~~~~~~~~~~~~~
lib.c:28344:12: error: call to undeclared function 'mkdir'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
28344 | int er = mkdir(temp, 0777);
| ^
13 warnings and 2 errors generated.
emcc: error: ' emsdk-git/upstream/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot= emsdk-git/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Wno-multichar -DMOCKFILES lib.c -c -o /tmp/emscripten_temp_qnp_u452/lib_0.o' failed (returned 1)
After some more small fixes on top of your latest changes (see here https://github.com/mingodad/cake/tree/fix-ubuntu-18):
Maketest
205 test functions generated at unit_test.c
Amalgamated file lib.c generated.
gcc
Building tools-------------------------------------------
./cake -D__x86_64__ -I/usr/lib/gcc/x86_64-linux-gnu/11/include/ -I/usr/local/include/ -I/usr/include/x86_64-linux-gnu/ -I/usr/include/ console.h tokenizer.h parser.h error.h fs.h hash.h object.h hashmap.h osstream.h options.h token.h type.h pre_expressions.h expressions.h visit.h format_visit.h token.c hash.c hashmap.c console.c tokenizer.c osstream.c fs.c options.c expressions.c pre_expressions.c type.c object.c parser.c visit.c flow_visit.c error.c format_visit.c tests.c
Cake 0.7.4
cake-dad2/src/console.h
cake-dad2/src/tokenizer.h
cake-dad2/src/parser.h
cake-dad2/src/error.h
cake-dad2/src/fs.h
cake-dad2/src/hash.h
cake-dad2/src/object.h
cake-dad2/src/hashmap.h
cake-dad2/src/osstream.h
cake-dad2/src/options.h
cake-dad2/src/token.h
cake-dad2/src/type.h
cake-dad2/src/pre_expressions.h
cake-dad2/src/expressions.h
cake-dad2/src/visit.h
cake-dad2/src/format_visit.h
cake-dad2/src/token.c
cake-dad2/src/hash.c
cake-dad2/src/hashmap.c
cake-dad2/src/console.c
cake-dad2/src/tokenizer.c
cake-dad2/src/osstream.c
cake-dad2/src/fs.c
cake-dad2/src/options.c
cake-dad2/src/expressions.c
cake-dad2/src/pre_expressions.c
cake-dad2/src/type.c
cake-dad2/src/object.c
cake-dad2/src/parser.c
cake-dad2/src/visit.c
cake-dad2/src/flow_visit.c
cake-dad2/src/error.c
cake-dad2/src/format_visit.c
cake-dad2/src/tests.c
34 files in 1.01 seconds
0 errors 0 warnings 0 notes
lib.c:3484:8: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
3484 | free(textfile);
| ^~~~~~~~
emsdk-git/upstream/emscripten/cache/sysroot/include/stdlib.h:43:18: note: passing argument to parameter here
43 | void free (void *);
| ^
lib.c:6814:10: warning: 21 enumeration values not handled in switch: 'TK_PRAGMA', 'TK_CHAR_CONSTANT', 'TK_KEYWORD_ASSERT'... [-Wswitch]
6814 | switch (tk)
| ^~
lib.c:9524:13: warning: 67 enumeration values not handled in switch: 'C_SUCCESS', 'C_UNEXPECTED', 'C_TOO_MANY_ARGUMENTS'... [-Wswitch]
9524 | switch (e)
| ^
lib.c:11897:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11897 | switch (a->type)
| ^~~~~~~
lib.c:11916:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11916 | switch (a->type)
| ^~~~~~~
lib.c:11933:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11933 | switch (a->type)
| ^~~~~~~
lib.c:11944:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11944 | switch (a->type)
| ^~~~~~~
lib.c:11955:13: warning: enumeration values 'TYPE_NOT_CONSTANT' and 'TYPE_EMPTY' not handled in switch [-Wswitch]
11955 | switch (a->type)
| ^~~~~~~
lib.c:15753:13: warning: 49 enumeration values not handled in switch: 'PRIMARY_IDENTIFIER', 'PRIMARY_EXPRESSION_ENUMERATOR', 'PRIMARY_EXPRESSION_DECLARATOR'... [-Wswitch]
15753 | switch (expression->expression_type)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib.c:24334:10: warning: 129 enumeration values not handled in switch: 'TK_NONE', 'TK_NEWLINE', 'TK_WHITE_SPACE'... [-Wswitch]
24334 | switch (ctx->current->type)
| ^~~~~~~~~~~~~~~~~~
lib.c:25426:10: warning: 138 enumeration values not handled in switch: 'TK_NONE', 'TK_NEWLINE', 'TK_WHITE_SPACE'... [-Wswitch]
25426 | switch (ctx->current->type)
| ^~~~~~~~~~~~~~~~~~
11 warnings generated.