diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-10-27 15:31:43 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-11-05 02:09:19 +0100 |
commit | b5e4b66490d507f5a4631800d4f2d378167389cd (patch) | |
tree | 3412d6f400d21891a20b6708ae7e18c8426e9169 | |
parent | 8ab81af8985237432393894e814bb0ae1d7a1799 (diff) | |
download | sparse-b5e4b66490d507f5a4631800d4f2d378167389cd.tar.gz |
show-type: add a test program to test do_show_type() & friends
Add another small client doing nothing but display the type
of the toplevel symbols.
This will help to test further changes in do_show_type().
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | test-show-type.c | 28 |
3 files changed, 30 insertions, 0 deletions
@@ -20,6 +20,7 @@ compile graph test-dissect test-linearize +test-show-type example test-unssa ctags @@ -80,6 +80,7 @@ PROGRAMS += test-dissect PROGRAMS += test-lexing PROGRAMS += test-linearize PROGRAMS += test-parsing +PROGRAMS += test-show-type PROGRAMS += test-unssa INST_PROGRAMS=sparse cgcc diff --git a/test-show-type.c b/test-show-type.c new file mode 100644 index 00000000..8396fdcf --- /dev/null +++ b/test-show-type.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + +#include <stdio.h> +#include "lib.h" +#include "symbol.h" + +static void show_symbols(struct symbol_list *list) +{ + struct symbol *sym; + + FOR_EACH_PTR(list, sym) { + printf("%s;\n", show_typename(sym)); + } END_FOR_EACH_PTR(sym); +} + +int main(int argc, char **argv) +{ + struct string_list *filelist = NULL; + char *file; + + sparse_initialize(argc, argv, &filelist); + Wdecl = 0; + FOR_EACH_PTR(filelist, file) { + show_symbols(sparse(file)); + } END_FOR_EACH_PTR(file); + + return has_error; +} |