Linus,
Consider pulling from:
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/acme/sparse.git/
That is, if you don't get too disgusted with this hack 8)
- Arnaldo
tree 8278311a249229ffbcde8e43afcb12e4b2b6080c
parent 71c2abb492618b099883dd2e625edace98bc9996
author Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> 1123987020 -0300
committer Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> 1123987020 -0300
Make preprocess_only a bit more useful
Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
------------------------------------------------------------------------------
lib.c | 7 +++----
lib.h | 2 +-
test-lexing.c | 11 ++++++++++-
3 files changed, 14 insertions(+), 6 deletions(-)
------------------------------------------------------------------------------
diff --git a/lib.c b/lib.c
--- a/lib.c
+++ b/lib.c
@@ -171,7 +171,7 @@ int Wcontext = 0;
int Wundefined_preprocessor = 0;
int Wptr_subtraction_blows = 0;
int Wtransparent_union = 1;
-int preprocess_only;
+void (*preprocess_only)(struct token *token, const int prec, const char *sep);
char *include;
int include_fd = -1;
@@ -463,11 +463,10 @@ static struct symbol_list *sparse_tokens
if (prec > 4)
prec = 4;
}
- printf("%s%.*s", show_token(token), prec, separator);
+ preprocess_only(token, prec, separator);
token = next;
}
- putchar('\n');
-
+ preprocess_only(NULL, 0, NULL);
return NULL;
}
diff --git a/lib.h b/lib.h
--- a/lib.h
+++ b/lib.h
@@ -73,7 +73,7 @@ extern void add_pre_buffer(const char *f
extern int include_fd;
extern char *include;
-extern int preprocess_only;
+extern void (*preprocess_only)(struct token *token, const int prec, const char
*sep);
extern int Wptr_subtraction_blows;
extern int Wdefault_bitfield_sign;
extern int Wundefined_preprocessor;
diff --git a/test-lexing.c b/test-lexing.c
--- a/test-lexing.c
+++ b/test-lexing.c
@@ -18,9 +18,18 @@
#include "token.h"
#include "symbol.h"
+static void preprocessor(struct token *token,
+ const int prec, const char *separator)
+{
+ if (token)
+ printf("%s%.*s", show_token(token), prec, separator);
+ else
+ putchar('\n');
+}
+
int main(int argc, char **argv)
{
- preprocess_only = 1;
+ preprocess_only = preprocessor;
sparse_initialize(argc, argv);
while (*argv)
sparse(argv);
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html