]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_regex_re2.cpp
Merge pull request #1337 from SaberUK/master+merge
[user/henk/code/inspircd.git] / src / modules / extra / m_regex_re2.cpp
index b97b7ec0fb37b6ebe4ff3825a888597223b7350d..2f0ee2998b12522227a5060980ef0c8b670d2711 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/// $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 <re2/re2.h>
 
+// 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 */
+#include <re2/re2.h>
 
 class RE2Regex : public Regex
 {
@@ -43,7 +51,7 @@ class RE2Regex : public Regex
                }
        }
 
-       bool Matches(const std::string& text)
+       bool Matches(const std::string& text) CXX11_OVERRIDE
        {
                return RE2::FullMatch(text, regexcl);
        }
@@ -53,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);
        }
@@ -66,7 +74,6 @@ class ModuleRegexRE2 : public Module
  public:
        ModuleRegexRE2() : ref(this)
        {
-               ServerInstance->Modules->AddService(ref);
        }
 
        Version GetVersion() CXX11_OVERRIDE