Module: check_mk
Branch: master
Commit: 6ff7961f6b11d302d900acdeb8270eebc86955ce
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ff7961f6b11d3…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Feb 9 13:49:16 2018 +0100
Test usage of RE2 (if available).
Change-Id: I1844f3719725f8eac12d74fb1d951c2f9d02588a
---
livestatus/src/.clang_complete | 1 +
livestatus/src/Makefile.am | 6 +++---
livestatus/src/RegExp.cc | 9 +++++++++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/livestatus/src/.clang_complete b/livestatus/src/.clang_complete
index ec64bce..eadb606 100644
--- a/livestatus/src/.clang_complete
+++ b/livestatus/src/.clang_complete
@@ -1,6 +1,7 @@
-I.
-I../..
-I..
+-I../../omd/packages/re2/destdir/include
-DHAVE_CONFIG_H
-std=c++17
-Wall
diff --git a/livestatus/src/Makefile.am b/livestatus/src/Makefile.am
index 8e8ca3d..6a854b2 100644
--- a/livestatus/src/Makefile.am
+++ b/livestatus/src/Makefile.am
@@ -160,15 +160,15 @@ liblivestatus_a_SOURCES = \
.PHONY: tidy iwyu cppcheck cppcheck-xml documentation
-liblivestatus_a_CPPFLAGS = -I.. @BOOST_CPPFLAGS@
+liblivestatus_a_CPPFLAGS = -I.. @BOOST_CPPFLAGS@ @RE2_CPPFLAGS@
liblivestatus_a_CXXFLAGS = -fPIC
livestatus.o: $(liblivestatus_a_OBJECTS)
# Note: libstdc++fs is only available as a static library, so we are lucky
- $(CXXLINK) -shared $^ -lstdc++fs -lpthread -static-libstdc++ @BOOST_LDFLAGS@
@BOOST_ASIO_LIB@
+ $(CXXLINK) -shared $^ -lstdc++fs -lpthread -static-libstdc++ @BOOST_LDFLAGS@
@BOOST_ASIO_LIB@ @RE2_LDFLAGS@ @RE2_LIBS@
# To make sure we can dlopen() our NEB later
$(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) -c NagiosMockup.cc -o NagiosMockup.o
- $(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) NagiosMockup.o $@ -o NagiosMockup
+ $(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) NagiosMockup.o $@ -o NagiosMockup
@RE2_LDFLAGS@ @RE2_LIBS@
$(RM) NagiosMockup
compile_commands.json: Makefile $(wildcard *.cc *.h)
diff --git a/livestatus/src/RegExp.cc b/livestatus/src/RegExp.cc
index 6d05276..02cf401 100644
--- a/livestatus/src/RegExp.cc
+++ b/livestatus/src/RegExp.cc
@@ -23,6 +23,12 @@
// Boston, MA 02110-1301 USA.
#include "RegExp.h"
+
+// Currently just for testing purposes, the real stuff will follow soon...
+#ifdef HAVE_RE2
+#include <re2/re2.h>
+#endif
+
#include <regex>
class RegExp::Impl {
@@ -65,6 +71,9 @@ RegExp &RegExp::operator=(RegExp &&rhs) noexcept = default;
std::string RegExp::replace(const std::string &str,
const std::string &replacement) const {
+#ifdef HAVE_RE2
+ RE2 dummyRegExpJustForTesting{".*"};
+#endif
return _impl->replace(str, replacement);
}