[PATCH v4 10/15] Compile suppression regexes earlier.
Dodji Seketeli
dodji@seketeli.org
Wed May 13 08:07:07 GMT 2020
Giuliano Procida <gprocida@google.com> a écrit:
> Regexes are used in suppression specifications for various things.
> They are currently compiled on first use, rather than on construction
> of the specifications.
>
> This patches changes the suppression specification types to hold
> compiled regexes directly which is a significant simplification and is
> a prerequisite for early error reporting.
[...]
> diff --git a/include/abg-suppression.h b/include/abg-suppression.h
> index 6383b932..8256f9b8 100644
> --- a/include/abg-suppression.h
> +++ b/include/abg-suppression.h
> @@ -26,6 +26,7 @@
> #include "abg-cxx-compat.h"
> #include "abg-ini.h"
> #include "abg-comparison.h"
> +#include "abg-regex.h"
>
> namespace abigail
> {
> @@ -64,8 +65,8 @@ public:
> suppression_base(const string& label);
>
> suppression_base(const string& label,
> - const string& file_name_regex_str,
> - const string& file_name_not_regex_str);
> + const regex::regex_t_sptr& file_name_regex,
> + const regex::regex_t_sptr& file_name_not_regex);
I am not against compiling the regular expressions early.
However, I don't like leaking the regex_t type through the suppression
API. I'd really prefer the compiled regular expression type to stay
internal to the suppression API.
In other words, existing users of the library who created suppressions
just using regular expressions strings (as opposed to compiled regular
expressions) to interact with the API should be able to continue to do
so. This breaks the API compatibility un-necessarily, IMHO. I'd like
to avoid that. And I don't think it's a design flaw to interact with
the API just through strings, as opposed to using it through regex_t,
quite the opposite. It was a design decision that I tried to stick to
throughout the library. The reader interface does't leak the underlying
XML library types. The dwarf reader doesn't leak the types of the
underlying facilities we use, etc. So I'd like this to stay consistent
accross the library.
I am sorry to tell you this this late. I could have saved you a lot of
work; I didn't realize in our discussions that this was what you wanted
to do.
Cheers,
--
Dodji
More information about the Libabigail
mailing list