diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-03-04 08:46:37 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-03-04 08:50:07 +0200 |
commit | f91b19e696794204f2ba05587eb0dc0475c65345 (patch) | |
tree | 5bb5b56639bc4c87c87e12ad30e06dbd722fffd7 /src | |
parent | 90b1ab9fcdbe3b36b09d9adb5d9517686a020ae4 (diff) | |
download | cflow-f91b19e696794204f2ba05587eb0dc0475c65345.tar.gz cflow-f91b19e696794204f2ba05587eb0dc0475c65345.tar.bz2 |
Fix handling of such declarations as "struct x *a, *b";
* src/parser.c (fake_struct)
(parse_variable_declaration): Correctly determine end of type.
* tests/decl01.at: New test case.
* tests/Makefile.am: Add new test.
* tests/testsuite.at (CFLOW_CHECK_PROG): Don't add extra newline
at the end of expout. All uses updated.
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c index 6860828..4126145 100644 --- a/src/parser.c +++ b/src/parser.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* This file is part of GNU cflow | 1 | /* This file is part of GNU cflow |
2 | Copyright (C) 1997, 2005-2007, 2009-2011, 2014-2015 Sergey Poznyakoff | 2 | Copyright (C) 1997, 2005-2007, 2009-2011, 2014-2016 Sergey Poznyakoff |
3 | 3 | ||
4 | GNU cflow is free software; you can redistribute it and/or modify | 4 | GNU cflow is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -670,7 +670,7 @@ fake_struct(Ident *ident) | |||
670 | ident->type_end = -1; | 670 | ident->type_end = -1; |
671 | if (tok.type == STRUCT) { | 671 | if (tok.type == STRUCT) { |
672 | if (nexttoken() == IDENTIFIER) { | 672 | if (nexttoken() == IDENTIFIER) { |
673 | ident->type_end = tos; | 673 | ident->type_end = curs; |
674 | } | 674 | } |
675 | putback(); | 675 | putback(); |
676 | skip_struct(); | 676 | skip_struct(); |
@@ -701,7 +701,7 @@ parse_variable_declaration(Ident *ident, int parm) | |||
701 | ident->type_end = -1; | 701 | ident->type_end = -1; |
702 | if (tok.type == STRUCT || tok.type == UNION) { | 702 | if (tok.type == STRUCT || tok.type == UNION) { |
703 | if (nexttoken() == IDENTIFIER) { | 703 | if (nexttoken() == IDENTIFIER) { |
704 | ident->type_end = tos; | 704 | ident->type_end = curs; |
705 | } | 705 | } |
706 | putback(); | 706 | putback(); |
707 | skip_struct(); | 707 | skip_struct(); |