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

index c10acf510cabe94ba04dd70dc6182c125af6e537..6d3a712714cd87a823fa2f05a2c865eef4f23cfa 100644 (file)
@@ -20,14 +20,15 @@ endif
 PREFIX         ?= /usr/local
 CFLAGS         ?= -O2 -fomit-frame-pointer -D_BSD_SOURCE -D_GNU_SOURCE
 CFLAGS         += -std=c99 -Wall -D_BSD_SOURCE -D_GNU_SOURCE
 PREFIX         ?= /usr/local
 CFLAGS         ?= -O2 -fomit-frame-pointer -D_BSD_SOURCE -D_GNU_SOURCE
 CFLAGS         += -std=c99 -Wall -D_BSD_SOURCE -D_GNU_SOURCE
-SPARSEFLAGS    = $(CFLAGS)
+SPARSEFLAGS    = $(CFLAGS) -D__transparent_union__=__unused__ -D_STRING_ARCH_unaligned=1 \
+                 -D__builtin_stpcpy=stpcpy
 LDFLAGS                += -lfl
 
 BIN            = b43-asm.bin
 SRCS           = parser.c scanner.c main.c initvals.c util.c args.c
 
 # YACC related CFLAGS
 LDFLAGS                += -lfl
 
 BIN            = b43-asm.bin
 SRCS           = parser.c scanner.c main.c initvals.c util.c args.c
 
 # YACC related CFLAGS
-CFLAGS         += -DYYSTYPE="void *" -DYYERROR_VERBOSE -DYYDEBUG -Wno-unused
+CFLAGS         += -DYYSTYPE="void *" -DYYERROR_VERBOSE -DYYDEBUG -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Wno-unused
 
 .SUFFIXES:
 .PHONY: all install clean distclean
 
 .SUFFIXES:
 .PHONY: all install clean distclean
index a6736543be537260748be9834ede60147ef49bd5..b2a8ddf1dd7df94eca42c86921eeee8123c687c9 100644 (file)
@@ -25,7 +25,7 @@
 int _debug;
 bool arg_print_sizes;
 const char *initvals_fn_extension = ".initvals";
 int _debug;
 bool arg_print_sizes;
 const char *initvals_fn_extension = ".initvals";
-const char *real_infile_name;
+static const char *real_infile_name;
 
 
 #define ARG_MATCH              0
 
 
 #define ARG_MATCH              0
@@ -64,7 +64,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;
                        }
@@ -115,16 +115,16 @@ int parse_args(int argc, char **argv)
        outfile_name = argv[2];
 
        for (i = 3; i < argc; i++) {
        outfile_name = argv[2];
 
        for (i = 3; 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, "--debug", "-d", 0)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--debug", "-d", NULL)) == ARG_MATCH) {
                        _debug++;
                        _debug++;
-               } else if ((res = cmp_arg(argv, &i, "--psize", "-s", 0)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--psize", "-s", NULL)) == ARG_MATCH) {
                        arg_print_sizes = 1;
                } else if ((res = cmp_arg(argv, &i, "--ivalext", "-e", &initvals_fn_extension)) == ARG_MATCH) {
                        /* initvals_fn_extension is set to the extension. */
                        arg_print_sizes = 1;
                } else if ((res = cmp_arg(argv, &i, "--ivalext", "-e", &initvals_fn_extension)) == ARG_MATCH) {
                        /* initvals_fn_extension is set to the extension. */
-               } else if ((res = cmp_arg(argv, &i, "--__real_infile", 0, &real_infile_name)) == ARG_MATCH) {
+               } else if ((res = cmp_arg(argv, &i, "--__real_infile", NULL, &real_infile_name)) == ARG_MATCH) {
                        /* real_infile_name is set. */
                } else {
                        fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
                        /* real_infile_name is set. */
                } else {
                        fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);