[v3,00/21] Simplify regex and suppression parsing.

Message ID 20200424092132.150547-1-gprocida@google.com
Headers
Series Simplify regex and suppression parsing. |

Message

Giuliano Procida April 24, 2020, 9:21 a.m. UTC
  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
  

Comments

Giuliano Procida May 4, 2020, 12:34 p.m. UTC | #1
Patches 01/15 and 02/15 reflect review comments from patches 01/21 and
03/21 of the original series, respectively.

Patches 03/15 to 15/15 correspond to 04/21 to 16/21 of the original
series.

Patches 17/21 to 21/21 of the original series have been dropped as the
refactoring wasn't ideal. They have been reworked and will be reposted
as part of a new series.

Regards,
Giuliano.

Giuliano Procida (15):
  Tidy #includes in a few files.
  Document ^_^ regex in generate_from_strings.
  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 type priv class methods.
  abg-suppression.cc: More consistent regex matching.
  abg-tools-utils.cc: Assert generated regexes OK.

 include/abg-regex.h                           |   16 +
 include/abg-suppression.h                     |  180 +--
 src/abg-corpus-priv.h                         |   28 +-
 src/abg-corpus.cc                             |   12 +-
 src/abg-dwarf-reader.cc                       |    4 +-
 src/abg-reader.cc                             |    4 +-
 src/abg-regex.cc                              |   72 +-
 src/abg-suppression-priv.h                    |  684 +---------
 src/abg-suppression.cc                        | 1187 ++++++++---------
 src/abg-tools-utils.cc                        |   19 +-
 .../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                   |   60 +-
 15 files changed, 897 insertions(+), 1420 deletions(-)