Esteemed tinycc maintainers - One of my hobbies is turning up the C compiler warning level in projects I'm interested in, and seeing what lint shows up. Tinycc is really pretty clean.
Using gcc's -Wextra, I found 17 "unused parameter", which could be addressed by bloating the source code a bit (casting to void), and with no consequence on the binary. If anyone else thought that would be an improvement, I'd be happy to write and submit a patch. Using gcc's -Wextra, I found 23 "missing initializer for field", all generated by macros in x86_64-asm.h. I would not be able to test any attempt to improve that situation, so I'll leave it alone. Using gcc's -Wwrite-strings, I found one simple lack-of-const in tcctools.c, patch attached. The patch has zero effect on the code's functionality. That patch also adds "undef strict-prototypes write-strings" to the list of warning flags that will be used if present. I'm a fan of using the writer/editor paradigm, so I won't actually commit this to mob myself. I encourage someone in-tune with community values to put on their editor's hat, double-check that my patch makes sense and doesn't break anything, and then commit it or suggest changes. - Larry
diff --git a/configure b/configure index 4182f9a..2327929 100755 --- a/configure +++ b/configure @@ -374,7 +374,7 @@ fi # a final configuration tuning $cc -v --help > cc_help.txt 2>&1 -W_OPTIONS="declaration-after-statement" +W_OPTIONS="declaration-after-statement undef strict-prototypes write-strings" for i in $W_OPTIONS; do O_PRESENT="$(grep -- -W$i cc_help.txt)" if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -W$i"; fi diff --git a/tcctools.c b/tcctools.c index 21aa2a7..ac6850c 100644 --- a/tcctools.c +++ b/tcctools.c @@ -101,7 +101,7 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv) char tfile[260], stmp[20]; char *file, *name; int ret = 2; - char *ops_conflict = "habdioptxN"; // unsupported but destructive if ignored. + const char *ops_conflict = "habdioptxN"; // unsupported but destructive if ignored. int verbose = 0; i_lib = 0; i_obj = 0; // will hold the index of the lib and first obj
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel