[Libreoffice-commits] core.git: config_host/config_global.h.in configure.ac include/sal

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 17:36:32 UTC 2020


 config_host/config_global.h.in |    2 --
 configure.ac                   |    8 ++++----
 include/sal/types.h            |    2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 6171812c5520b80dabd007c709143fbf43b527fb
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jan 28 14:05:12 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jan 28 18:35:49 2020 +0100

    HAVE_GCC_ATTRIBUTE_WARN_UNUSED should always be true now for Clang/GCC
    
    ...but for safety, leave the configure.ac check in for some longer.
    
    Change-Id: I90cba5812492ba85d7723ff71aba75b7721b9622
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87621
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index f7672d211647..aa5863f73b6a 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -18,8 +18,6 @@ Any change in this header will cause a rebuild of almost everything.
 #define HAVE_GCC_PRAGMA_OPERATOR 0
 #define HAVE_GCC_DEPRECATED_MESSAGE 0
 #define HAVE_SYSLOG_H 0
-/* Compiler supports __attribute__((warn_unused)). */
-#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED 0
 
 /* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */
 #define HAVE_CPP_GUARANTEED_COPY_ELISION 0
diff --git a/configure.ac b/configure.ac
index 4b25ed9bf662..d16b49a69c83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6445,17 +6445,17 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
         ], [AC_MSG_RESULT([no])])
     AC_LANG_POP([C++])
 
-    dnl Available in GCC 4.9 and at least since Clang 3.4:
-    AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
+    dnl Available in GCC 4.9 and at least since Clang 3.4; this check can eventually be removed
+    dnl completely (e.g., aftger libreoffice-6-5 branch off):
+    AC_MSG_CHECKING([that $CXX_BASE supports __attribute__((warn_unused))])
     AC_LANG_PUSH([C++])
     save_CXXFLAGS=$CXXFLAGS
     CXXFLAGS="$CXXFLAGS -Werror"
     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
             struct __attribute__((warn_unused)) dummy {};
         ])], [
-            AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
             AC_MSG_RESULT([yes])
-        ], [AC_MSG_RESULT([no])])
+        ], [AC_MSG_ERROR([no])])
     CXXFLAGS=$save_CXXFLAGS
 AC_LANG_POP([C++])
 fi
diff --git a/include/sal/types.h b/include/sal/types.h
index 1a8ba255b4b7..53cbd687497a 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -572,7 +572,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
 
 */
 
-#if HAVE_GCC_ATTRIBUTE_WARN_UNUSED
+#if defined LIBO_INTERNAL_ONLY && (defined __GNUC__ || defined __clang__)
 #define SAL_WARN_UNUSED __attribute__((warn_unused))
 #else
 #define SAL_WARN_UNUSED


More information about the Libreoffice-commits mailing list