diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-10-09 17:18:11 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-10-09 17:24:00 +0300 |
commit | 1fdfe0ec055c5e8c080dd1427d98730885ac8bd4 (patch) | |
tree | d6c496e08fbd85f3e4aa60a52c82f4db19c8b6c6 | |
parent | 404a540341683e29cbdbc6a958a762d9f8c5d6bd (diff) | |
download | cflow-1fdfe0ec055c5e8c080dd1427d98730885ac8bd4.tar.gz cflow-1fdfe0ec055c5e8c080dd1427d98730885ac8bd4.tar.bz2 |
Allow for wrappers following the structure definition.
* src/c.l (get_token): do not call yylex if previous call returned
EOF.
(source): Clear EOF indicator.
* src/linked-list.c: Placate gcc warnings.
* src/output.c: Likewise.
* src/parser.c (skip_balanced): New function.
(skip_struct): Allow for a wrapper after closing brace.
* tests/struct00.at: New testcase.
* tests/struct01.at: New testcase.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.
* NEWS, configure.ac: Set version 1.4
* THANKS: Update.
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | THANKS | 12 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/c.l | 17 | ||||
-rw-r--r-- | src/linked-list.c | 4 | ||||
-rw-r--r-- | src/output.c | 4 | ||||
-rw-r--r-- | src/parser.c | 29 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/struct00.at | 32 | ||||
-rw-r--r-- | tests/struct01.at | 35 | ||||
-rw-r--r-- | tests/testsuite.at | 4 |
11 files changed, 140 insertions, 17 deletions
@@ -1,14 +1,16 @@ -GNU cflow NEWS -- history of user-visible changes. 2009-11-09 -Copyright (C) 2005, 2006, 2007, 2009, 2010 Sergey Poznyakoff +GNU cflow NEWS -- history of user-visible changes. 2011-10-09 +Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011 Sergey Poznyakoff See the end of file for copying conditions. Please send cflow bug reports to <bug-cflow@gnu.org>. -Version 1.3.1 (Git) +Version 1.4 (Git) * Speed up recursive call detection. * Fix parsing of typedefs after `struct'. +* Fix the output of branch marks in tree mode. +* Fix processing of static inline functions (RH bug 650716). Version 1.3, 2009-07-11 @@ -71,7 +73,7 @@ Initial version restored from 1997 snapshots. ---------------------------------------------------------------------- * Copyright information: -Copyright (C) 2005, 2006, 2007, 2009 Sergey Poznyakoff +Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the @@ -1,9 +1,19 @@ GNU cflow THANKS file. +Many people further contributed to GNU cflow by reporting problems, +suggesting various improvements or submitting actual code. Here is a list +of these people in alphabetical order. Help us keep it complete and exempt +of errors. + Jerry St.Clair <jds.2005@verizon.net> Laurent Fournie <lfournie@rockwellcollins.com> Louis Bertrand <louis@bertrandtech.ca> Nelson H. F. Beebe <beebe@math.utah.edu> Robert E. Michael <rmichael2@nc.rr.com> Shigio YAMAGUCHI <shigio@tamacom.com> -Terje Rosten <terje.rosten@ntnu.no> +Terje Røsten <terje.rosten@ntnu.no> + + +;;;; Local Variables: +;;;; coding: utf-8 +;;;; End: diff --git a/configure.ac b/configure.ac index 0a8a203..859d6de 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # This file is part of GNU cflow -# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc. # # Written by Sergey Poznyakoff # @@ -19,10 +19,10 @@ # 02110-1301 USA. AC_PREREQ(2.61) -AC_INIT([GNU cflow], [1.3.1], [bug-cflow@gnu.org]) +AC_INIT([GNU cflow], [1.4], [bug-cflow@gnu.org]) AC_CONFIG_SRCDIR([src/cflow.h]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-lzma dist-xz std-options +AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options silent-rules]) AC_CONFIG_HEADER([config.h]) @@ -342,11 +342,21 @@ yywrap() return 1; } +static int hit_eof; + int get_token() { - int tok = yylex(); - prev_token = tok; + int tok; + + if (hit_eof) + tok = 0; + else { + tok = yylex(); + prev_token = tok; + if (!tok) + hit_eof = 1; + } return tok; } @@ -371,7 +381,8 @@ source(char *name) canonical_filename = filename; line_num = 1; input_file_count++; - + hit_eof = 0; + yyrestart(fp); return 0; } diff --git a/src/linked-list.c b/src/linked-list.c index 9b71276..e81fd1c 100644 --- a/src/linked-list.c +++ b/src/linked-list.c @@ -100,12 +100,12 @@ linked_list_unlink(struct linked_list *list, struct linked_list_entry *ent) { struct linked_list_entry *p; - if (p = ent->prev) + if ((p = ent->prev)) p->next = ent->next; else list->head = ent->next; - if (p = ent->next) + if ((p = ent->next)) p->prev = ent->prev; else list->tail = ent->prev; diff --git a/src/output.c b/src/output.c index bef37fd..519a332 100644 --- a/src/output.c +++ b/src/output.c @@ -144,6 +144,7 @@ separator() output_driver[driver_index].handler_data); } +#if 0 static void print_text(char *buf) { @@ -152,6 +153,7 @@ print_text(char *buf) buf, output_driver[driver_index].handler_data); } +#endif static int print_symbol (int direct, int level, int last, Symbol *sym) @@ -288,7 +290,7 @@ is_printable(struct linked_list_entry *p) static int is_last(struct linked_list_entry *p) { - while (p = p->next) + while ((p = p->next)) if (is_printable(p)) return 0; return 1; diff --git a/src/parser.c b/src/parser.c index cdfea4e..af0d0ab 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,5 +1,5 @@ /* This file is part of GNU cflow - Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010 Sergey Poznyakoff + Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010, 2011 Sergey Poznyakoff GNU cflow is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -305,6 +305,28 @@ skip_to(int c) } int +skip_balanced(int open_tok, int close_tok, int level) +{ + if (level == 0) { + if (nexttoken() != open_tok) { + putback(); + return 1; + } + } + while (nexttoken()) { + if (tok.type == open_tok) + level++; + else if (tok.type == close_tok) { + if (level-- == 0) { + nexttoken(); + return 0; + } + } + } + return -1; +} + +int yyparse() { Ident identifier; @@ -644,6 +666,11 @@ skip_struct() nexttoken(); } while (lev); } + + while (tok.type == PARM_WRAPPER) { + if (skip_balanced('(', ')', 0) == -1) + file_error(_("unexpected end of file in struct"), 0); + } } void diff --git a/tests/Makefile.am b/tests/Makefile.am index 2fe8734..d31aa35 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,5 @@ # Makefile for GNU cflow regression tests. -# Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff +# Copyright (C) 2005, 2007, 2010, 2011 Sergey Poznyakoff # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -59,6 +59,8 @@ TESTSUITE_AT = \ reverse.at\ ssblock.at\ static.at\ + struct00.at\ + struct01.at\ testsuite.at\ version.at diff --git a/tests/struct00.at b/tests/struct00.at new file mode 100644 index 0000000..b2d2787 --- /dev/null +++ b/tests/struct00.at @@ -0,0 +1,32 @@ +# This file is part of GNU cflow testsuite. -*- Autotest -*- +# Copyright (C) 2011 Sergey Poznyakoff +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([struct definition followed by attribute]) +AT_KEYWORDS([struct struct-attr attribute]) + +CFLOW_CHECK( +[struct bar { + struct foo *dummy; +} __attribute__((aligned(8))); + +int +main(int argc, char **argv) +{ +} +], +[main() <int main (int argc,char **argv) at prog:6>]) + +AT_CLEANUP diff --git a/tests/struct01.at b/tests/struct01.at new file mode 100644 index 0000000..9a7699f --- /dev/null +++ b/tests/struct01.at @@ -0,0 +1,35 @@ +# This file is part of GNU cflow testsuite. -*- Autotest -*- +# Copyright (C) 2011 Sergey Poznyakoff +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([struct definition followed by wrapper]) +AT_KEYWORDS([struct struct01 struct-wrapper wrapper]) + +CFLOW_OPT([--symbol __attribute__:wrapper],[ +CFLOW_CHECK( +[struct bar { + struct foo *dummy; +} __attribute__((aligned(8))); + +int +main(int argc, char **argv) +{ +} +], +[main() <int main (int argc,char **argv) at prog:6>]) +]) + +AT_CLEANUP + diff --git a/tests/testsuite.at b/tests/testsuite.at index f15980c..33e907b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,5 +1,5 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- -# Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff +# Copyright (C) 2005, 2007, 2010, 2011 Sergey Poznyakoff # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -68,5 +68,7 @@ m4_include([nfarg.at]) m4_include([hiding.at]) m4_include([multi.at]) m4_include([bartest.at]) +m4_include([struct00.at]) +m4_include([struct01.at]) # End of testsuite.at |