From patchwork Fri Apr 24 09:21:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39152 From: gprocida@google.com (Giuliano Procida) Date: Fri, 24 Apr 2020 10:21:11 +0100 Subject: [PATCH v3 00/21]Simplify regex and suppression parsing. In-Reply-To: <20200423154441.170531-1-gprocida@google.com> References: <20200423154441.170531-1-gprocida@google.com> Message-ID: <20200424092132.150547-1-gprocida@google.com> This patch series takes the suppression parsing very close to where it can be translated into a table-driven format. It is mostly a series of simplifications which are useful in their own right. I have tried to keep each commit doing exactly one thing, to make reviewing easier. These changes are not pure refactorings: Escape names used in symbol whitelisting regex. diff suppression: Fix handling of change kinds abg-tools-utils.cc: Assert generated regexes OK. Warn if user-supplied regexes fail to compile. The rest should be. Regards, Giuliano. Giuliano Procida (21): Move regex definitions to own files. Move libxml bits out of abg-sptr-utils.h. Simplify generation of symbol whitelist regex. Escape names used in symbol whitelisting regex. abg-suppression.cc: More uniform variable naming. diff suppression: Fix handling of change kinds. Add POSIX regex wrapper functions. Use regex::compile wrapper instead of regcomp. Use regex::match wrapper instead of regexec. Refactor read_parameter_spec_from_string logic. Compile suppression regexes earlier. Reduce direct access to suppression priv_ members. Move match methods from priv to suppression_base. Remove suppression types' priv class methods. abg-suppression.cc: More consistent regex matching. abg-tools-utils.cc: Assert generated regexes OK. Refactor suppression property string parsing. Refactor suppression property regex parsing. Warn if user-supplied regexes fail to compile. Default construct suppression types. Remove unused suppression type priv constructors. include/Makefile.am | 3 +- include/abg-libxml-utils.h | 21 +- src/abg-sptr-utils.cc => include/abg-regex.h | 73 +- include/abg-sptr-utils.h | 66 +- include/abg-suppression.h | 182 +- src/Makefile.am | 2 +- src/abg-corpus-priv.h | 37 +- src/abg-corpus.cc | 2 +- src/abg-dwarf-reader.cc | 4 +- src/abg-reader.cc | 4 +- src/abg-regex.cc | 147 ++ src/abg-suppression-priv.h | 723 +------- src/abg-suppression.cc | 1608 +++++++---------- src/abg-tools-utils.cc | 26 +- .../test15-suppr-added-fn-report-5.txt | 6 +- .../test16-suppr-removed-fn-report-5.txt | 15 +- .../test17-suppr-added-var-report-5.txt | 15 +- .../test18-suppr-removed-var-report-5.txt | 15 +- tests/test-kmi-whitelist.cc | 70 +- 19 files changed, 1065 insertions(+), 1954 deletions(-) rename src/abg-sptr-utils.cc => include/abg-regex.h (51%) create mode 100644 src/abg-regex.cc