X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_regex_re2.cpp;h=2f0ee2998b12522227a5060980ef0c8b670d2711;hb=f471083cd0519d47c7c7a09029813ede41994f7b;hp=56d80cd685127ec6c2100fef1b00c2edb0772f70;hpb=b7e793d96131e7813fe42984ec3a04254720ad20;p=user%2Fhenk%2Fcode%2Finspircd.git
diff --git a/src/modules/extra/m_regex_re2.cpp b/src/modules/extra/m_regex_re2.cpp
index 56d80cd68..2f0ee2998 100644
--- a/src/modules/extra/m_regex_re2.cpp
+++ b/src/modules/extra/m_regex_re2.cpp
@@ -17,27 +17,26 @@
* along with this program. If not, see .
*/
+/// $CompilerFlags: find_compiler_flags("re2" "")
+/// $LinkerFlags: find_linker_flags("re2" "-lre2")
+
+/// $PackageInfo: require_system("darwin") pkg-config re2
+/// $PackageInfo: require_system("ubuntu" "15.10") libre2-dev pkg-config
-#if defined __GNUC__
-# pragma GCC diagnostic ignored "-Wshadow"
-#endif
#include "inspircd.h"
#include "modules/regex.h"
-#include
+// Fix warnings about the use of `long long` on C++03 and
+// shadowing on GCC.
+#if defined __clang__
+# pragma clang diagnostic ignored "-Wc++11-long-long"
+#elif defined __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# pragma GCC diagnostic ignored "-Wshadow"
+#endif
-/* $CompileFlags: -std=c++11 */
-/* $LinkerFlags: -lre2 */
-
-class RE2Exception : public ModuleException
-{
- public:
- RE2Exception(const std::string& rx, const std::string& error)
- : ModuleException(std::string("Error in regex ") + rx + ": " + error)
- {
- }
-};
+#include
class RE2Regex : public Regex
{
@@ -48,11 +47,11 @@ class RE2Regex : public Regex
{
if (!regexcl.ok())
{
- throw RE2Exception(rx, regexcl.error());
+ throw RegexException(rx, regexcl.error());
}
}
- bool Matches(const std::string& text)
+ bool Matches(const std::string& text) CXX11_OVERRIDE
{
return RE2::FullMatch(text, regexcl);
}
@@ -62,7 +61,7 @@ class RE2Factory : public RegexFactory
{
public:
RE2Factory(Module* m) : RegexFactory(m, "regex/re2") { }
- Regex* Create(const std::string& expr)
+ Regex* Create(const std::string& expr) CXX11_OVERRIDE
{
return new RE2Regex(expr);
}
@@ -75,7 +74,6 @@ class ModuleRegexRE2 : public Module
public:
ModuleRegexRE2() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE