From: Nathan Wagner Date: Sat, 4 Mar 2017 17:34:19 +0000 (-0600) Subject: add warnings to compile flags and fix X-Git-Tag: v0.1.6~146 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=3fbafae81dbc483ba0e37bd66e269702cd666af2 add warnings to compile flags and fix --- diff --git a/Makefile b/Makefile index 4685b57..ffb3f5b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS=-Wall -std=c99 -Ilib -Ielf -I. -Ilzma/api +CFLAGS=-Wall -W -Wextra -Werror -std=c99 -Ilib -Ielf -I. -Ilzma/api LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4 @@ -60,7 +60,7 @@ newdb.c: db.sql echo ", 0};" >> $@ lib/sqlite3.o: lib/sqlite3.c lib/config.h - $(CC) $(CFLAGS) -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $< + $(CC) -Wall -std=c99 -Ilib -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $< $(LZMAOBJ): $(CC) $(CFLAGS) $(LZMAFLAGS) -c -o $@ $*.c diff --git a/elf/soname.c b/elf/soname.c index 8b6c451..06e5662 100644 --- a/elf/soname.c +++ b/elf/soname.c @@ -23,6 +23,11 @@ int main(int ac, char **av) { char *name, *dynname; Elf64_Dyn *dent; + if (ac < 2) { + fprintf(stderr, "usage: soname \n"); + exit(EXIT_FAILURE); + } + if (lstat(av[1], &sbuf) == -1) { exit(1); } @@ -42,7 +47,7 @@ int main(int ac, char **av) { exit(1); } /* not at least the size of the elf header? */ - if (sbuf.st_size < sizeof(Elf64_Ehdr)) { + if ((size_t)sbuf.st_size < sizeof(Elf64_Ehdr)) { exit(1); } diff --git a/lib/db.c b/lib/db.c index 98608b3..9b19b74 100644 --- a/lib/db.c +++ b/lib/db.c @@ -16,6 +16,7 @@ static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; + NotUsed = 0; /* suppress warning */ for(i=0; i