]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implement and use detection of compiler support for c++11 override keyword
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 26 Aug 2015 14:20:57 +0000 (16:20 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 26 Aug 2015 14:20:57 +0000 (16:20 +0200)
acinclude/ax_cxx_0x_types.m4
compat/types.h
configure.ac
src/acl/Tree.h

index 270d378e2f1e3bdc753864a567aec0a5a476e265..f58b119274d070f130fb5dee8db8f23ceb07a142 100644 (file)
@@ -80,3 +80,26 @@ AC_DEFUN([AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS],[
 
   AC_LANG_POP
 ])
+
+AC_DEFUN([AX_CXX11_SUPPORTS_OVERRIDE_KEYWORD],[
+  AC_REQUIRE([AC_PROG_CXX])
+  AC_LANG_PUSH([C++])
+  AC_CACHE_CHECK([whether the c++11 compiler supports the override keyword],
+    [squid_cv_cxx11_supports_override],[
+      AC_TRY_COMPILE([],[
+class Base {
+  public:
+    virtual void method() {}
+};
+class Derived : public Base {
+  public:
+    virtual void method() override {}
+};
+Derived d; d.method();
+      ],[squid_cv_cxx11_supports_override=yes],[squid_cv_cxx11_supports_override=no])
+      ])
+  AC_LANG_POP
+  SQUID_DEFINE_BOOL([HAVE_CXX11_OVERRIDE_KEYWORD],[$squid_cv_cxx11_supports_override],
+    [Define if the c++11 compiler supports c++ override keyword for class methods])
+])
+   
index c04777d9a47e900f4123a82d95fe6e4e7da0e260..f0418d759274422b6aefd68d807cc108261e484d 100644 (file)
@@ -181,5 +181,12 @@ typedef long mtyp_t;
 #define xuniform_real_distribution std::tr1::uniform_real
 #endif
 
+#if HAVE_CXX11_OVERRIDE_KEYWORD
+///use in place of c++11 "override" keyword, will expand to keyword if compiler supports
+#define OVERRIDE override
+#else
+#define OVERRIDE
+#endif
+
 #endif /* SQUID_TYPES_H */
 
index d0c55fed2b1b94687e0c37e4e22e6cd6ce22db36..323afbdd4e773351bdeaeb3f8d771f7745181bad 100644 (file)
@@ -2939,6 +2939,7 @@ dnl Some C++11 types we try to use
 AX_CXX_TYPE_NULLPTR
 AX_CXX_TYPE_UNIQUE_PTR
 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
+AX_CXX11_SUPPORTS_OVERRIDE_KEYWORD
 
 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
 dnl that is incompatible with the updated Solaris header files.
index c13e7afdfbfd9f9ee4379ab14a1f2fe18811666f..0bddc9d3c9b386ed3f5c97c90077b55f7a2ae5d1 100644 (file)
@@ -41,7 +41,7 @@ public:
 
 protected:
     /// Acl::OrNode API
-    virtual bool bannedAction(ACLChecklist *, Nodes::const_iterator) const override;
+    virtual bool bannedAction(ACLChecklist *, Nodes::const_iterator) const OVERRIDE;
     allow_t actionAt(const Nodes::size_type pos) const;
 
     /// if not empty, contains actions corresponding to InnerNode::nodes