Change in core[master]: Introduce SAL_OVERRIDE

Miklos Vajna (via Code Review) gerrit at gerrit.libreoffice.org
Wed Jan 30 09:39:39 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1928

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/28/1928/1

Introduce SAL_OVERRIDE

Change-Id: I3675b627d5e9ca19b2c4fb69fef12d0dabf94a43
---
M config/config_global.h.in
M configure.ac
M oox/inc/oox/vml/vmlshape.hxx
M sal/inc/sal/types.h
4 files changed, 49 insertions(+), 2 deletions(-)



diff --git a/config/config_global.h.in b/config/config_global.h.in
index 7080a69..0f85b59 100644
--- a/config/config_global.h.in
+++ b/config/config_global.h.in
@@ -13,6 +13,7 @@
 #define CONFIG_GLOBAL_H
 
 #undef HAVE_CXX11_DELETE
+#undef HAVE_CXX11_OVERRIDE
 #undef HAVE_GCC_BUILTIN_ATOMIC
 #undef HAVE_SFINAE_ANONYMOUS_BROKEN
 #undef HAVE_THREADSAFE_STATICS
diff --git a/configure.ac b/configure.ac
index eb0a434..10897a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5642,6 +5642,39 @@
     AC_MSG_RESULT([no (C++11 disabled)])
 fi
 
+dnl ==================================
+dnl Check for C++11 "override" support
+dnl ==================================
+
+AC_MSG_CHECKING([whether $CXX supports C++11 override syntax])
+if test "$HAVE_CXX0X" = "TRUE"; then
+    save_CXXFLAGS=$CXXFLAGS
+    CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+struct A
+{
+        virtual void test();
+};
+
+struct B : A
+{
+        virtual void test() override;
+};
+]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
+
+    AC_LANG_POP([C++])
+    CXXFLAGS=$save_CXXFLAGS
+    if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
+        AC_MSG_RESULT([yes])
+        AC_DEFINE([HAVE_CXX11_OVERRIDE])
+    else
+        AC_MSG_RESULT([no])
+    fi
+else
+    AC_MSG_RESULT([no (C++11 disabled)])
+fi
+
 dnl ===================================================================
 dnl system stl sanity tests
 dnl ===================================================================
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 8373d4f..f1a9652 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -340,9 +340,9 @@
 
 protected:
     /** Returns the absolute shape rectangle. */
-    virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const;
+    virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const SAL_OVERRIDE;
     /** Returns the rectangle relative to the parent coordinate system. */
-    virtual ::com::sun::star::awt::Rectangle getRelRectangle() const;
+    virtual ::com::sun::star::awt::Rectangle getRelRectangle() const SAL_OVERRIDE;
 };
 
 /** Bezier shape object that supports to, from, control1 and control2
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 8ada6d7..117de03 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -416,6 +416,19 @@
 #define SAL_DELETED_FUNCTION
 #endif
 
+/** C++11 "override" feature.
+
+    With HAVE_CXX11_OVERRIDE, force the method to override a existing method in
+    parent, error out if the method with the correct signature does not exist.
+
+    @since LibreOffice 4.1
+*/
+#if defined HAVE_CXX11_OVERRIDE
+#define SAL_OVERRIDE override
+#else
+#define SAL_OVERRIDE
+#endif
+
 #endif /* __cplusplus */
 
 #ifdef __cplusplus

-- 
To view, visit https://gerrit.libreoffice.org/1928
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3675b627d5e9ca19b2c4fb69fef12d0dabf94a43
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>


More information about the LibreOffice mailing list