mbox series

[00/21] Simplify regex and suppression parsing.

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

Message

Giuliano Procida April 23, 2020, 3:44 p.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  |   71 +-
 include/abg-sptr-utils.h                      |   66 +-
 include/abg-suppression.h                     |  182 +-
 src/Makefile.am                               |    2 +-
 src/abg-corpus-priv.h                         |   35 +-
 src/abg-corpus.cc                             |    2 +-
 src/abg-dwarf-reader.cc                       |    4 +-
 src/abg-reader.cc                             |    4 +-
 src/abg-regex.cc                              |  134 ++
 src/abg-suppression-priv.h                    |  723 +-------
 src/abg-suppression.cc                        | 1527 +++++++----------
 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, 1017 insertions(+), 1904 deletions(-)
 rename src/abg-sptr-utils.cc => include/abg-regex.h (50%)
 create mode 100644 src/abg-regex.cc

Comments

Giuliano Procida April 23, 2020, 6:11 p.m. UTC | #1
There are some v2s.

0007 - fixed wrong style for function prototypes; added missing export
of regex.cc
0009 - ignore, no change
0019 - added missing #include <iostream>

Regards,
Giuliano.

On Thu, 23 Apr 2020 at 16:45, Giuliano Procida <gprocida@google.com> wrote:
>
> 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  |   71 +-
>  include/abg-sptr-utils.h                      |   66 +-
>  include/abg-suppression.h                     |  182 +-
>  src/Makefile.am                               |    2 +-
>  src/abg-corpus-priv.h                         |   35 +-
>  src/abg-corpus.cc                             |    2 +-
>  src/abg-dwarf-reader.cc                       |    4 +-
>  src/abg-reader.cc                             |    4 +-
>  src/abg-regex.cc                              |  134 ++
>  src/abg-suppression-priv.h                    |  723 +-------
>  src/abg-suppression.cc                        | 1527 +++++++----------
>  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, 1017 insertions(+), 1904 deletions(-)
>  rename src/abg-sptr-utils.cc => include/abg-regex.h (50%)
>  create mode 100644 src/abg-regex.cc
>
> --
> 2.26.1.301.g55bc3eb7cb9-goog
>
Giuliano Procida April 24, 2020, 8:54 a.m. UTC | #2
Hi.

I have a scattering of changes (comments, formatting, one significant
commit message change). I'm going to post a full v3 series.

Please ignore the earlier ones.

Sorry about this.

Giuliano.

On Thu, 23 Apr 2020 at 19:11, Giuliano Procida <gprocida@google.com> wrote:
>
> There are some v2s.
>
> 0007 - fixed wrong style for function prototypes; added missing export
> of regex.cc
> 0009 - ignore, no change
> 0019 - added missing #include <iostream>
>
> Regards,
> Giuliano.
>
> On Thu, 23 Apr 2020 at 16:45, Giuliano Procida <gprocida@google.com> wrote:
> >
> > 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  |   71 +-
> >  include/abg-sptr-utils.h                      |   66 +-
> >  include/abg-suppression.h                     |  182 +-
> >  src/Makefile.am                               |    2 +-
> >  src/abg-corpus-priv.h                         |   35 +-
> >  src/abg-corpus.cc                             |    2 +-
> >  src/abg-dwarf-reader.cc                       |    4 +-
> >  src/abg-reader.cc                             |    4 +-
> >  src/abg-regex.cc                              |  134 ++
> >  src/abg-suppression-priv.h                    |  723 +-------
> >  src/abg-suppression.cc                        | 1527 +++++++----------
> >  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, 1017 insertions(+), 1904 deletions(-)
> >  rename src/abg-sptr-utils.cc => include/abg-regex.h (50%)
> >  create mode 100644 src/abg-regex.cc
> >
> > --
> > 2.26.1.301.g55bc3eb7cb9-goog
> >
Giuliano Procida April 24, 2020, 9:21 a.m. UTC | #3
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