aboutsummaryrefslogtreecommitdiff
path: root/src/parser.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-02-10 14:21:03 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-02-10 14:21:03 +0200
commitb4038ea16c1709367f5c84939919785686481b55 (patch)
tree118e2ebaf20bc82d04c4b7ec49dc0030aa1a1ac8 /src/parser.h
parenta80f1c42bd5f63f79aa562cde5467aaf6ca54d89 (diff)
downloadcflow-b4038ea16c1709367f5c84939919785686481b55.tar.gz
cflow-b4038ea16c1709367f5c84939919785686481b55.tar.bz2
Fix processing of typedef struct and struct declarations. Fix --xref mode.
Some constucts were processed incorrectly (see typedef.at for examples). Unit-local types were not displayed in xref mode. * src/cflow.h (symbol_temp): Rename to symbol_temp. All uses changed. * src/output.c (tree_output): In all_functions mode: print all functions without explicit caller. * src/parser.c (save_token): Process curly braces. (fake_struct): Don't restore stack upon encountering identifier or modifier. See typedef.at for testcases. (parse_variable_declaration): restore stack only if type_end is -1 (no tag encountered). See struct06 in struct.at (skip_struct): Minor change. * src/parser.h: Redefine token types as enum. * src/symbol.c (unit_local_list): New static. (static_free): Preserve unit-local symbols in unit_local_list in xref mode. (collect_symbols): Consider symbols from unit_local_list. * tests/Makefile.am: Add new testcases. * tests/testsuite.at (CFLOW_TEST): New macro. Include new testcases. * tests/struct.at: New file. * tests/typedef.at: New file. * tests/struct01.at: Remove. * tests/struct02.at: Remove. * tests/struct03.at: Remove. * tests/struct04.at: Remove. * .gitignore: Update.
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/parser.h b/src/parser.h
index 24434b1..6415d5b 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -15,25 +15,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* tokens */
-#define WORD 257
-#define LBRACE0 258
-#define RBRACE0 259
-#define IDENTIFIER 260
-#define EXTERN 261
-#define STATIC 262
-#define TYPEDEF 263
-#define STRUCT 264
-#define MODIFIER 265
-#define OP 266
-#define UNION 267
-#define ENUM 268
-#define LBRACE '{'
-#define RBRACE '}'
-#define MEMBER_OF 269
-#define TYPE 270
-#define STRING 271
-#define PARM_WRAPPER 272
-#define QUALIFIER 273
+enum {
+ LBRACE = '{',
+ RBRACE = '}',
+ WORD = 257,
+ LBRACE0,
+ RBRACE0,
+ IDENTIFIER,
+ EXTERN,
+ STATIC,
+ TYPEDEF,
+ STRUCT,
+ MODIFIER,
+ OP,
+ UNION,
+ ENUM,
+ MEMBER_OF,
+ TYPE,
+ STRING,
+ PARM_WRAPPER,
+ QUALIFIER
+};
typedef struct {
char *str;

Return to:

Send suggestions and report system problems to the System administrator.