Skip to content

Commit

Permalink
re2: fixes for darwin
Browse files Browse the repository at this point in the history
Probably will break other things.
Thanks to various issue reporters for suggestions.

Fixes issue 59.
Fixes issue 76.
Fixes issue 77.
Fixes issue 81.
Fixes issue 87.
Fixes issue 90.
Fixes issue 92.
Fixes issue 94.

R=rsc
CC=re2-dev
https://codereview.appspot.com/50270044
  • Loading branch information
rsc committed Jan 10, 2014
1 parent bbfe781 commit 59d9612
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
19 changes: 11 additions & 8 deletions Makefile
Expand Up @@ -9,14 +9,14 @@ all: obj/libre2.a obj/so/libre2.so
# CCPCRE=-I/usr/local/include -DUSEPCRE
# LDPCRE=-L/usr/local/lib -lpcre

CXX=g++
CXXFLAGS=-Wall -O3 -g -pthread # can override
RE2_CXXFLAGS=-Wno-sign-compare -c -I. $(CCPCRE) # required
LDFLAGS=-pthread
AR=ar
ARFLAGS=rsc
NM=nm
NMFLAGS=-p
CXX?=g++
CXXFLAGS?=-Wall -O3 -g -pthread # can override
RE2_CXXFLAGS?=-Wno-sign-compare -c -I. $(CCPCRE) # required
LDFLAGS?=
AR?=ar
ARFLAGS?=rsc
NM?=nm
NMFLAGS?=-p

# Variables mandated by GNU, the arbiter of all good taste on the internet.
# http://www.gnu.org/prep/standards/standards.html
Expand Down Expand Up @@ -286,3 +286,6 @@ log:
echo '#' RE2 basic search tests built by make $@ >re2-search.txt
echo '#' $$(date) >>re2-search.txt
obj/test/search_test |grep -v '^PASS$$' >>re2-search.txt

x: x.cc obj/libre2.a
g++ -I. -o x x.cc obj/libre2.a
2 changes: 1 addition & 1 deletion libre2.symbols
Expand Up @@ -10,7 +10,7 @@
_ZlsRSoRKN3re211StringPieceE;
# re2::FilteredRE2*
_ZN3re211FilteredRE2*;
_ZNK3re211FilteredRE2*;
_ZNK3re211FilteredRE210AllMatches*;
local:
*;
};
4 changes: 3 additions & 1 deletion libre2.symbols.darwin
Expand Up @@ -6,6 +6,8 @@ __ZNK3re23RE2*
__ZN3re211StringPiece*
__ZNK3re211StringPiece*
# operator<<(std::ostream&, re2::StringPiece const&)
__ZlsRSoRKN3re211StringPieceE
__ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERKN3re211StringPieceE
# re2::FilteredRE2*
__ZN3re211FilteredRE2*
__ZNK3re211FilteredRE210AllMatches*

8 changes: 4 additions & 4 deletions re2/testing/re2_test.cc
Expand Up @@ -988,14 +988,14 @@ TEST(RE2, UTF8) {
// Check UTF-8 handling
// Three Japanese characters (nihongo)
const char utf8_string[] = {
0xe6, 0x97, 0xa5, // 65e5
0xe6, 0x9c, 0xac, // 627c
0xe8, 0xaa, 0x9e, // 8a9e
(char)0xe6, (char)0x97, (char)0xa5, // 65e5
(char)0xe6, (char)0x9c, (char)0xac, // 627c
(char)0xe8, (char)0xaa, (char)0x9e, // 8a9e
0
};
const char utf8_pattern[] = {
'.',
0xe6, 0x9c, 0xac, // 627c
(char)0xe6, (char)0x9c, (char)0xac, // 627c
'.',
0
};
Expand Down
2 changes: 2 additions & 0 deletions testinstall.cc
Expand Up @@ -14,6 +14,8 @@ int main(void) {
f.Add("a.*b.*c", RE2::DefaultOptions, &id);
vector<string> v;
f.Compile(&v);
vector<int> ids;
f.FirstMatch("abbccc", ids);

if(RE2::FullMatch("axbyc", "a.*b.*c")) {
printf("PASS\n");
Expand Down
2 changes: 1 addition & 1 deletion util/util.h
Expand Up @@ -41,7 +41,7 @@ using std::sort;
using std::swap;
using std::make_pair;

#if defined(__GNUC__) && !defined(USE_CXX0X)
#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION)

#include <tr1/unordered_set>
using std::tr1::unordered_set;
Expand Down
8 changes: 7 additions & 1 deletion util/valgrind.cc
Expand Up @@ -7,8 +7,14 @@

namespace re2 {

#ifndef __has_feature
#define __has_feature(x) 0
#endif

int RunningOnValgrind() {
#ifdef RUNNING_ON_VALGRIND
#if __has_feature(memory_sanitizer)
return true;
#elif defined(RUNNING_ON_VALGRIND)
return RUNNING_ON_VALGRIND;
#else
return 0;
Expand Down

0 comments on commit 59d9612

Please sign in to comment.