Skip to content

Commit

Permalink
Fix symbol visibility and add test coverage.
Browse files Browse the repository at this point in the history
Fixes #286.

Change-Id: I0707b10b948087ca40440c8311157bc6d3cbf87d
Reviewed-on: https://code-review.googlesource.com/c/re2/+/58010
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed Oct 26, 2020
1 parent fd2a80f commit 166dbbe
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) $@
Expand Down
3 changes: 3 additions & 0 deletions libre2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# re2::FilteredRE2*
_ZN3re211FilteredRE2*;
_ZNK3re211FilteredRE2*;
# re2::re2_internal*
_ZN3re212re2_internal*;
_ZNK3re212re2_internal*;
local:
*;
};
3 changes: 3 additions & 0 deletions libre2.symbols.darwin
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ __ZN3re2ls*
# re2::FilteredRE2*
__ZN3re211FilteredRE2*
__ZNK3re211FilteredRE2*
# re2::re2_internal*
__ZN3re212re2_internal*
__ZNK3re212re2_internal*
35 changes: 19 additions & 16 deletions testinstall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
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(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 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;
}

0 comments on commit 166dbbe

Please sign in to comment.