disassembler: Fix sparse warnings
authorMichael Buesch <mb@bu3sch.de>
Thu, 26 Nov 2009 14:18:15 +0000 (15:18 +0100)
committerMichael Buesch <mb@bu3sch.de>
Thu, 26 Nov 2009 14:18:15 +0000 (15:18 +0100)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
disassembler/Makefile
disassembler/args.c
disassembler/main.h

index 41b3ad99e93810c9dbf1749c802dfeb366a501ea..8944a21449537d95d5ae53991e2855bad443d737 100644 (file)
@@ -16,7 +16,7 @@ endif
 PREFIX         ?= /usr/local
 CFLAGS         ?= -O2 -fomit-frame-pointer
 CFLAGS         += -std=gnu99 -Wall -D_BSD_SOURCE -D_GNU_SOURCE
 PREFIX         ?= /usr/local
 CFLAGS         ?= -O2 -fomit-frame-pointer
 CFLAGS         += -std=gnu99 -Wall -D_BSD_SOURCE -D_GNU_SOURCE
-SPARSEFLAGS    = $(CFLAGS)
+SPARSEFLAGS    = $(CFLAGS) -D__transparent_union__=__unused__ -D_STRING_ARCH_unaligned=1
 LDFLAGS                ?=
 
 BIN = b43-dasm
 LDFLAGS                ?=
 
 BIN = b43-dasm
index d48100e95b1ec9f9a083c1a837d572c1c41ecf32..67ba2fc7a4d7d92706d1b1c2772bfd24345a09e2 100644 (file)
@@ -66,7 +66,7 @@ static int do_cmp_arg(char **argv, int *pos,
                if (param) {
                        /* Skip the parameter on the next iteration. */
                        (*pos)++;
                if (param) {
                        /* Skip the parameter on the next iteration. */
                        (*pos)++;
-                       if (*param == 0) {
+                       if (*param == NULL) {
                                fprintf(stderr, "%s needs a parameter\n", arg);
                                return ARG_ERROR;
                        }
                                fprintf(stderr, "%s needs a parameter\n", arg);
                                return ARG_ERROR;
                        }
@@ -117,14 +117,14 @@ int parse_args(int argc, char **argv)
        outfile_name = NULL;
 
        for (i = 1; i < argc; i++) {
        outfile_name = NULL;
 
        for (i = 1; i < argc; i++) {
-               if ((res = cmp_arg(argv, &i, "--help", "-h", 0)) == ARG_MATCH) {
+               if ((res = cmp_arg(argv, &i, "--help", "-h", NULL)) == ARG_MATCH) {
                        usage(argc, argv);
                        return 1;
                        usage(argc, argv);
                        return 1;
-               } else if ((res = cmp_arg(argv, &i, "--nohdr", 0, 0)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--nohdr", NULL, NULL)) == ARG_MATCH) {
                        cmdargs.no_header = 1;
                        cmdargs.no_header = 1;
-               } else if ((res = cmp_arg(argv, &i, "--paddr", 0, 0)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--paddr", NULL, NULL)) == ARG_MATCH) {
                        cmdargs.print_addresses = 1;
                        cmdargs.print_addresses = 1;
-               } else if ((res = cmp_arg(argv, &i, "--debug", "-d", 0)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--debug", "-d", NULL)) == ARG_MATCH) {
                        _debug++;
                } else if ((res = cmp_arg(argv, &i, "--arch", "-a", &param)) == ARG_MATCH) {
                        unsigned long arch;
                        _debug++;
                } else if ((res = cmp_arg(argv, &i, "--arch", "-a", &param)) == ARG_MATCH) {
                        unsigned long arch;
index 354d00196f574ad9916722eee162f21e7588b3c9..633411a1bbc63378545c6c115828f30b14f3c9c9 100644 (file)
@@ -26,9 +26,9 @@ struct fw_header {
 #define FW_HDR_VER     0x01
 
 
 #define FW_HDR_VER     0x01
 
 
-FILE *infile;
-FILE *outfile;
-const char *infile_name;
-const char *outfile_name;
+extern FILE *infile;
+extern FILE *outfile;
+extern const char *infile_name;
+extern const char *outfile_name;
 
 #endif /* B43_DASM_MAIN_H_ */
 
 #endif /* B43_DASM_MAIN_H_ */