cmark-gfm
cmark-gfm copied to clipboard
Improve code quality / enable C flags during the build
Try to build your code base with the following flags:
-Wall -Werror -pedantic -Wstrict-prototypes -Werror=incompatible-pointer-types
Output log:
[build] [10/43 20% :: 1.371] Building C object lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/utf8.c.o
[build] FAILED: lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/utf8.c.o
[build] /bin/x86_64-linux-gnu-gcc-9 -I../lib/commonmarker/src/. -Ilib/commonmarker/src -Iextensions -I../lib/commonmarker/src -Wall -Werror -pedantic -Wstrict-prototypes -Werror=incompatible-pointer-types -g -Wall -fvisibility=hidden -std=c99 -MD -MT lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/utf8.c.o -MF lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/utf8.c.o.d -o lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/utf8.c.o -c ../lib/commonmarker/src/utf8.c
[build] In file included from ../lib/commonmarker/src/buffer.h:10,
[build] from ../lib/commonmarker/src/utf8.h:5,
[build] from ../lib/commonmarker/src/utf8.c:6:
[build] ../lib/commonmarker/src/cmark-gfm.h:114:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
[build] 114 | cmark_mem *cmark_get_default_mem_allocator();
[build] | ^~~~~~~~~
[build] ../lib/commonmarker/src/cmark-gfm.h:120:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
[build] 120 | cmark_mem *cmark_get_arena_mem_allocator();
[build] | ^~~~~~~~~
[build] cc1: all warnings being treated as errors
[build] [10/43 23% :: 1.458] Building C object lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/scanners.c.o
[build] FAILED: lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/scanners.c.o
[build] /bin/x86_64-linux-gnu-gcc-9 -I../lib/commonmarker/src/. -Ilib/commonmarker/src -Iextensions -I../lib/commonmarker/src -Wall -Werror -pedantic -Wstrict-prototypes -Werror=incompatible-pointer-types -g -Wall -fvisibility=hidden -std=c99 -MD -MT lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/scanners.c.o -MF lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/scanners.c.o.d -o lib/commonmarker/src/CMakeFiles/LibCommonMarker.dir/scanners.c.o -c ../lib/commonmarker/src/scanners.c
[build] In file included from ../lib/commonmarker/src/chunk.h:7,
[build] from ../lib/commonmarker/src/scanners.c:3:
[build] ../lib/commonmarker/src/cmark-gfm.h:114:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
[build] 114 | cmark_mem *cmark_get_default_mem_allocator();
[build] | ^~~~~~~~~
[build] ../lib/commonmarker/src/cmark-gfm.h:120:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
[build] 120 | cmark_mem *cmark_get_arena_mem_allocator();
[build] | ^~~~~~~~~
Just like the upstream project of Commonmark / cmark is using: https://github.com/nwellnhof/cmark/blob/3a4165c6d9c3b392be05bd2e88d0e1ad70a73d02/CMakeLists.txt#L47