From 166dbbeb3b0ab7e733b278e8f42a84f6882b8a25 Mon Sep 17 00:00:00 2001 From: Paul Wankadia Date: Mon, 26 Oct 2020 03:14:43 -0700 Subject: [PATCH] Fix symbol visibility and add test coverage. Fixes #286. Change-Id: I0707b10b948087ca40440c8311157bc6d3cbf87d Reviewed-on: https://code-review.googlesource.com/c/re2/+/58010 Reviewed-by: Paul Wankadia --- Makefile | 2 +- libre2.symbols | 3 +++ libre2.symbols.darwin | 3 +++ testinstall.cc | 35 +++++++++++++++++++---------------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 18f566f59..44cedeeb5 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ obj/dbg/libre2.a: $(DOFILES) $(AR) $(ARFLAGS) obj/dbg/libre2.a $(DOFILES) .PRECIOUS: obj/so/libre2.$(SOEXT) -obj/so/libre2.$(SOEXT): $(SOFILES) +obj/so/libre2.$(SOEXT): $(SOFILES) libre2.symbols libre2.symbols.darwin @mkdir -p obj/so $(MAKE_SHARED_LIBRARY) -o obj/so/libre2.$(SOEXTVER) $(SOFILES) ln -sf libre2.$(SOEXTVER) $@ diff --git a/libre2.symbols b/libre2.symbols index 8308b6489..93b71b486 100644 --- a/libre2.symbols +++ b/libre2.symbols @@ -11,6 +11,9 @@ # re2::FilteredRE2* _ZN3re211FilteredRE2*; _ZNK3re211FilteredRE2*; + # re2::re2_internal* + _ZN3re212re2_internal*; + _ZNK3re212re2_internal*; local: *; }; diff --git a/libre2.symbols.darwin b/libre2.symbols.darwin index 31e8c5220..41ac96f93 100644 --- a/libre2.symbols.darwin +++ b/libre2.symbols.darwin @@ -10,3 +10,6 @@ __ZN3re2ls* # re2::FilteredRE2* __ZN3re211FilteredRE2* __ZNK3re211FilteredRE2* +# re2::re2_internal* +__ZN3re212re2_internal* +__ZNK3re212re2_internal* diff --git a/testinstall.cc b/testinstall.cc index 47db4e68c..19cc9003b 100644 --- a/testinstall.cc +++ b/testinstall.cc @@ -2,23 +2,26 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#include -#include #include +#include +#include + +int main() { + re2::FilteredRE2 f; + int id; + f.Add("a.*b.*c", RE2::DefaultOptions, &id); + std::vector v; + f.Compile(&v); + std::vector ids; + f.FirstMatch("abbccc", ids); -int main(void) { - re2::FilteredRE2 f; - int id; - f.Add("a.*b.*c", RE2::DefaultOptions, &id); - std::vector v; - f.Compile(&v); - std::vector ids; - f.FirstMatch("abbccc", ids); + int n; + if (RE2::FullMatch("axbyc", "a.*b.*c") && + RE2::PartialMatch("foo123bar", "(\\d+)", &n) && n == 123) { + printf("PASS\n"); + return 0; + } - if(RE2::FullMatch("axbyc", "a.*b.*c")) { - printf("PASS\n"); - return 0; - } - printf("FAIL\n"); - return 2; + printf("FAIL\n"); + return 2; }