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 <junyer@google.com>
diff --git a/Makefile b/Makefile
index 18f566f..44cedee 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,7 @@
$(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 8308b64..93b71b4 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 31e8c52..41ac96f 100644
--- a/libre2.symbols.darwin
+++ b/libre2.symbols.darwin
@@ -10,3 +10,6 @@
# re2::FilteredRE2*
__ZN3re211FilteredRE2*
__ZNK3re211FilteredRE2*
+# re2::re2_internal*
+__ZN3re212re2_internal*
+__ZNK3re212re2_internal*
diff --git a/testinstall.cc b/testinstall.cc
index 47db4e6..19cc900 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 <re2/re2.h>
-#include <re2/filtered_re2.h>
#include <stdio.h>
+#include <re2/filtered_re2.h>
+#include <re2/re2.h>
-int main(void) {
- re2::FilteredRE2 f;
- int id;
- f.Add("a.*b.*c", RE2::DefaultOptions, &id);
- std::vector<std::string> v;
- f.Compile(&v);
- std::vector<int> ids;
- f.FirstMatch("abbccc", ids);
+int main() {
+ re2::FilteredRE2 f;
+ int id;
+ f.Add("a.*b.*c", RE2::DefaultOptions, &id);
+ std::vector<std::string> v;
+ f.Compile(&v);
+ std::vector<int> ids;
+ f.FirstMatch("abbccc", ids);
- if(RE2::FullMatch("axbyc", "a.*b.*c")) {
- printf("PASS\n");
- return 0;
- }
- printf("FAIL\n");
- return 2;
+ int n;
+ if (RE2::FullMatch("axbyc", "a.*b.*c") &&
+ RE2::PartialMatch("foo123bar", "(\\d+)", &n) && n == 123) {
+ printf("PASS\n");
+ return 0;
+ }
+
+ printf("FAIL\n");
+ return 2;
}