aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Documentation/index.rst6
-rw-r--r--dissect.c19
-rw-r--r--expression.h1
-rw-r--r--options.c6
-rw-r--r--sindex.12
-rw-r--r--sindex.c21
-rw-r--r--sparse.12
-rw-r--r--symbol.h5
-rw-r--r--target-xtensa.c5
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
------------------
diff --git a/dissect.c b/dissect.c
index 1970e46f..582e8fc3 100644
--- a/dissect.c
+++ b/dissect.c
@@ -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;
};
};
};
diff --git a/options.c b/options.c
index a2e15bb7..f7e81b84 100644
--- a/options.c
+++ b/options.c
@@ -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;
}
diff --git a/sindex.1 b/sindex.1
index e3e14ca3..508e2d52 100644
--- a/sindex.1
+++ b/sindex.1
@@ -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
diff --git a/sindex.c b/sindex.c
index 22836a95..bff6d8c4 100644
--- a/sindex.c
+++ b/sindex.c
@@ -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,"
diff --git a/sparse.1 b/sparse.1
index 399a63fa..60203d5a 100644
--- a/sparse.1
+++ b/sparse.1
@@ -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
diff --git a/symbol.h b/symbol.h
index c2b60ce9..3ec68e2e 100644
--- a/symbol.h
+++ b/symbol.h
@@ -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 = {