diff options
-rw-r--r-- | Documentation/index.rst | 6 | ||||
-rw-r--r-- | dissect.c | 19 | ||||
-rw-r--r-- | expression.h | 1 | ||||
-rw-r--r-- | options.c | 6 | ||||
-rw-r--r-- | sindex.1 | 2 | ||||
-rw-r--r-- | sindex.c | 21 | ||||
-rw-r--r-- | sparse.1 | 2 | ||||
-rw-r--r-- | symbol.h | 5 | ||||
-rw-r--r-- | target-xtensa.c | 5 |
9 files changed, 46 insertions, 21 deletions
diff --git a/Documentation/index.rst b/Documentation/index.rst index 737f4423..50afa558 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -26,7 +26,7 @@ Getting Sparse -------------- You can find tarballs of released versions of Sparse at -http://www.kernel.org/pub/software/devel/sparse/dist/. +https://www.kernel.org/pub/software/devel/sparse/dist/. The most recent version can be obtained directly from the Git repository with the command:: @@ -60,8 +60,8 @@ archives at https://marc.info/?l=linux-sparse. To subscribe to the list, send an email with ``subscribe linux-sparse`` in the body to ``majordomo@vger.kernel.org``. -Bugs can also be reported and tracked via the Linux kernel's bugzilla: -http://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools. +Bugs can also be reported and tracked via the `Linux kernel's bugzilla for sparse +<https://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools>`_. User documentation ------------------ @@ -204,9 +204,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent) struct ident *name = node->ident; struct symbol *base, *dctx; - if (node->examined) + if (node->visited) return; - node->examined = 1; + node->visited = 1; node->kind = 'v'; while ((base = node->ctype.base_type) != NULL) @@ -228,9 +228,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent) break; case SYM_STRUCT: case SYM_UNION: //case SYM_ENUM: - if (base->evaluated) + if (base->inspected) return; - base->evaluated = 1; + base->inspected = 1; base->kind = 's'; if (!base->symbol_list) @@ -471,6 +471,17 @@ again: } while ((expr = expr->down)); } + break; case EXPR_GENERIC: { + struct type_expression *map; + + do_expression(U_VOID, expr->control); + + for (map = expr->map; map; map = map->next) + ret = do_expression(mode, map->expr); + if (expr->def) + ret = do_expression(mode, expr->def); + } + break; case EXPR_SYMBOL: ret = report_symbol(mode, expr); } diff --git a/expression.h b/expression.h index 07fe8502..3e9e9d85 100644 --- a/expression.h +++ b/expression.h @@ -261,7 +261,6 @@ struct expression { struct expression *control; struct expression *def; struct type_expression *map; - struct expression *result; }; }; }; @@ -782,6 +782,12 @@ static char **handle_switch_s(const char *arg, char **next) static char **handle_switch_U(char *arg, char **next) { const char *name = arg + 1; + + if (*name == '\0') { + name = *++next; + if (!name) + die("argument to `-U' is missing"); + } add_pre_buffer("#undef %s\n", name); return next; } @@ -144,7 +144,7 @@ read and write .BR sparse (1) . .SH HOMEPAGE -http://www.kernel.org/pub/software/devel/sparse/ +https://sparse.docs.kernel.org . .SH MAILING LIST linux-sparse@vger.kernel.org @@ -101,11 +101,13 @@ static void show_help(int ret) "\n" "Options:\n" " -D, --database=FILE Specify database file (default: %2$s);\n" + " -B, --basedir=DIR Define project top directory (default is the current directory);\n" " -v, --verbose Show information about what is being done;\n" " -h, --help Show this text and exit.\n" "\n" "Environment:\n" " SINDEX_DATABASE Database file location.\n" + " SINDEX_BASEDIR Project top directory.\n" "\n" "Report bugs to authors.\n" "\n", @@ -125,9 +127,6 @@ static void show_help_add(int ret) " -v, --verbose Show information about what is being done;\n" " -h, --help Show this text and exit.\n" "\n" - "Environment:\n" - " SINDEX_BASEDIRE Project top directory.\n" - "\n" "Report bugs to authors.\n" "\n", progname); @@ -251,21 +250,26 @@ static void parse_cmdline(int argc, char **argv) { static const struct option long_options[] = { { "database", required_argument, NULL, 'D' }, + { "basedir", required_argument, NULL, 'B' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { NULL } }; int c; + char *basedir = getenv("SINDEX_BASEDIR"); char *env; if ((env = getenv("SINDEX_DATABASE")) != NULL) sindex_dbfile = env; - while ((c = getopt_long(argc, argv, "+D:vh", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "+B:D:vh", long_options, NULL)) != -1) { switch (c) { case 'D': sindex_dbfile = optarg; break; + case 'B': + basedir = optarg; + break; case 'v': sindex_verbose++; break; @@ -278,6 +282,12 @@ static void parse_cmdline(int argc, char **argv) message("command required"); show_usage(); } + + if (basedir) { + if (!realpath(basedir, cwd)) + sindex_error(1, errno, "unable to get project base directory"); + n_cwd = strlen(cwd); + } } static void parse_cmdline_add(int argc, char **argv) @@ -1016,6 +1026,9 @@ static void command_search(int argc, char **argv) char *dberr = NULL; sqlite3_str *query = sqlite3_str_new(sindex_db); + if (chdir(cwd) < 0) + sindex_error(1, errno, "unable to change directory: %s", cwd); + if (query_appendf(query, "SELECT" " file.name," @@ -513,7 +513,7 @@ By default chars are signed. .BR cgcc (1) . .SH HOMEPAGE -http://www.kernel.org/pub/software/devel/sparse/ +https://sparse.docs.kernel.org . .SH MAILING LIST linux-sparse@vger.kernel.org @@ -206,9 +206,10 @@ struct symbol { union /* backend */ { struct basic_block *bb_target; /* label */ void *aux; /* Auxiliary info, e.g. backend information */ - struct { /* sparse ctags */ - char kind; + struct { + char kind; /* used by ctags & dissect */ unsigned char visited:1; + unsigned char inspected:1; }; }; pseudo_t pseudo; diff --git a/target-xtensa.c b/target-xtensa.c index 26bda47f..3620b4a3 100644 --- a/target-xtensa.c +++ b/target-xtensa.c @@ -17,11 +17,6 @@ static void predefine_xtensa(const struct target *self) { predefine("__XTENSA__", 1, "1"); predefine("__xtensa__", 1, "1"); - - if (arch_big_endian) - predefine("__XTENSA_EB__", 1, "1"); - else - predefine("__XTENSA_EL__", 1, "1"); } const struct target target_xtensa = { |