Skip to content

Commit 166dbbe

Browse files
committed
Fix symbol visibility and add test coverage.
Fixes google#286. Change-Id: I0707b10b948087ca40440c8311157bc6d3cbf87d Reviewed-on: https://code-review.googlesource.com/c/re2/+/58010 Reviewed-by: Paul Wankadia <[email protected]>
1 parent fd2a80f commit 166dbbe

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ obj/dbg/libre2.a: $(DOFILES)
203203
$(AR) $(ARFLAGS) obj/dbg/libre2.a $(DOFILES)
204204

205205
.PRECIOUS: obj/so/libre2.$(SOEXT)
206-
obj/so/libre2.$(SOEXT): $(SOFILES)
206+
obj/so/libre2.$(SOEXT): $(SOFILES) libre2.symbols libre2.symbols.darwin
207207
@mkdir -p obj/so
208208
$(MAKE_SHARED_LIBRARY) -o obj/so/libre2.$(SOEXTVER) $(SOFILES)
209209
ln -sf libre2.$(SOEXTVER) $@

libre2.symbols

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# re2::FilteredRE2*
1212
_ZN3re211FilteredRE2*;
1313
_ZNK3re211FilteredRE2*;
14+
# re2::re2_internal*
15+
_ZN3re212re2_internal*;
16+
_ZNK3re212re2_internal*;
1417
local:
1518
*;
1619
};

libre2.symbols.darwin

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ __ZN3re2ls*
1010
# re2::FilteredRE2*
1111
__ZN3re211FilteredRE2*
1212
__ZNK3re211FilteredRE2*
13+
# re2::re2_internal*
14+
__ZN3re212re2_internal*
15+
__ZNK3re212re2_internal*

testinstall.cc

+19-16
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
#include <re2/re2.h>
6-
#include <re2/filtered_re2.h>
75
#include <stdio.h>
6+
#include <re2/filtered_re2.h>
7+
#include <re2/re2.h>
8+
9+
int main() {
10+
re2::FilteredRE2 f;
11+
int id;
12+
f.Add("a.*b.*c", RE2::DefaultOptions, &id);
13+
std::vector<std::string> v;
14+
f.Compile(&v);
15+
std::vector<int> ids;
16+
f.FirstMatch("abbccc", ids);
817

9-
int main(void) {
10-
re2::FilteredRE2 f;
11-
int id;
12-
f.Add("a.*b.*c", RE2::DefaultOptions, &id);
13-
std::vector<std::string> v;
14-
f.Compile(&v);
15-
std::vector<int> ids;
16-
f.FirstMatch("abbccc", ids);
18+
int n;
19+
if (RE2::FullMatch("axbyc", "a.*b.*c") &&
20+
RE2::PartialMatch("foo123bar", "(\\d+)", &n) && n == 123) {
21+
printf("PASS\n");
22+
return 0;
23+
}
1724

18-
if(RE2::FullMatch("axbyc", "a.*b.*c")) {
19-
printf("PASS\n");
20-
return 0;
21-
}
22-
printf("FAIL\n");
23-
return 2;
25+
printf("FAIL\n");
26+
return 2;
2427
}

0 commit comments

Comments
 (0)