Remove obsolete GCC version checks

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 6 December 2018 22:01 EST

...after "Bump (Linux) GCC baseline to 7.0.0". (In some cases, those checks now need to check for __clang__, which was implicitly covered in the past by Clang consistently reporting to be GCC 4.2.1.)

Change-Id: I860fef8c4ca41c22a7541f0fb2d34b37d1d69bed Reviewed-on: https://gerrit.libreoffice.org/63952

###

diff --git a/configure.ac b/configure.ac
index 02114bfd17f9..4e55ddbff76e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6258,13 +6258,13 @@ elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then

#if defined SYSTEM_LIBCMIS
// See ucb/source/ucp/cmis/auth_provider.hxx:
- #if __GNUC__ >= 7
+ #if !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
#include
- #if __GNUC__ >= 7
+ #if !defined __clang__
#pragma GCC diagnostic pop
#endif
#endif
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index 9b687f74e8ad..6397831e80dd 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
@@ -444,7 +444,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, co
break;
}

-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
[[fallthrough]];
#else
BOOST_FALLTHROUGH;
diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx
index e73a502333f8..cc310188b105 100644
--- a/cppu/qa/cppumaker/test_cppumaker.cxx
+++ b/cppu/qa/cppumaker/test_cppumaker.cxx
@@ -444,7 +444,7 @@ void Test::testBigStruct() {
CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m23.getLength());

//This is a very platform specific test.
-#if defined __GNUC__ && __GNUC__ >= 3 // see CPPU_GCC3_ALIGN
+#if defined __GNUC__ // see CPPU_GCC3_ALIGN
#if defined(LINUX) && (defined (X86_64) || defined(X86) || defined(PPC))
CPPUNIT_ASSERT_EQUAL(
#if defined X86_64 || defined PPC
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index f145b7ae9c39..84873d9c7c2a 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -33,22 +33,6 @@ $(eval $(call gb_StaticLibrary_add_cxxflags,poppler,\
))
endif

-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
-# can't easily check for 4.8.2 exactly so just apply to GCC 4.8.x
-ifeq ($(COM),GCC)
-ifeq ($(COM_IS_CLANG),)
-ifeq ($(CPUNAME),INTEL)
-ifeq ($(shell expr '$(GCC_VERSION)' '<' 409),1)
-ifeq ($(shell expr '$(GCC_VERSION)' '>=' 408),1)
-$(eval $(call gb_StaticLibrary_add_cxxflags,poppler,\
- -march=i586 \
-))
-endif
-endif
-endif
-endif
-endif
-
$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,poppler,cc))

$(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\
diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx
index 6f879965840c..ae28ca4b6570 100644
--- a/include/o3tl/safeint.hxx
+++ b/include/o3tl/safeint.hxx
@@ -112,7 +112,7 @@ template inline bool checked_sub(T a, T b, T& result)
return !msl::utilities::SafeSubtract(a, b, result);
}

-#elif (defined __GNUC__ && __GNUC__ >= 5) || (__has_builtin(__builtin_mul_overflow) && !(defined ANDROID && defined __clang__) && !(defined(__clang__) && defined(__i386__)))
+#elif (defined __GNUC__ && !defined __clang__) || (__has_builtin(__builtin_mul_overflow) && !(defined ANDROID && defined __clang__) && !(defined(__clang__) && defined(__i386__)))
// 32-bit clang fails with undefined reference to `__mulodi4'

template inline bool checked_multiply(T a, T b, T& result)
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index 7e9ff1cc86fd..6f3e18f9d202 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -229,12 +229,7 @@ struct ConstCharArrayDetector {
{ return literal; }
};
template struct ConstCharArrayDetector<
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8 \
- && !defined __clang__
- OUStringLiteral1_ const,
-#else
OUStringLiteral1,
-#endif
T>
{
using TypeUtf16 = T;
@@ -260,12 +255,7 @@ struct ExceptConstCharArrayDetector< const char[ N ] >
template
struct ExceptConstCharArrayDetector {};
template<> struct ExceptConstCharArrayDetector<
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8 \
- && !defined __clang__
- OUStringLiteral1_ const
-#else
OUStringLiteral1
-#endif
>
{};
#endif
diff --git a/include/sal/types.h b/include/sal/types.h
index 6bf4de970f71..b687490ed949 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -678,7 +678,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
#define __has_attribute(x) 0
#endif

-#if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && __GNUC__ > 4) || (defined __clang__ && __has_attribute(returns_nonnull)))
+#if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && !defined __clang__) || (defined __clang__ && __has_attribute(returns_nonnull)))
#define SAL_RETURNS_NONNULL __attribute__((returns_nonnull))
#else
#define SAL_RETURNS_NONNULL
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 4875759e06e2..1048a1375327 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -100,7 +100,9 @@ gb_CXXFLAGS_COMMON += -ffunction-sections -fdata-sections
gb_LinkTarget_LDFLAGS += -Wl,--gc-sections
endif

-ifeq ($(shell expr '$(GCC_VERSION)' '>=' 600),1)
+ifeq ($(COM_IS_CLANG),TRUE)
+gb_CXXFLAGS_COMMON += -Wimplicit-fallthrough
+else
gb_CFLAGS_COMMON += \
-Wduplicated-cond \
-Wlogical-op \
@@ -119,16 +121,6 @@ gb_CXXFLAGS_COMMON += \
-Wno-cast-function-type
endif

-ifeq ($(COM_IS_CLANG),TRUE)
-gb_CXXFLAGS_COMMON += -Wimplicit-fallthrough
-else
-# GCC 4.8, at least, is confused by boost 1.66 optional assignments
-ifeq ($(shell expr '$(GCC_VERSION)' '<' 409),1)
-gb_CXXFLAGS_COMMON += -Wno-maybe-uninitialized
-endif
-endif
-
-
# If CC or CXX already include -fvisibility=hidden, don't duplicate it
ifeq (,$(filter -fvisibility=hidden,$(CC)))
gb_VISIBILITY_FLAGS := -fvisibility=hidden
diff --git a/ucb/source/ucp/cmis/auth_provider.hxx b/ucb/source/ucp/cmis/auth_provider.hxx
index 90bc9fe584a1..e93ad79a9c66 100644
--- a/ucb/source/ucp/cmis/auth_provider.hxx
+++ b/ucb/source/ucp/cmis/auth_provider.hxx
@@ -9,13 +9,13 @@
#ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_AUTH_PROVIDER_HXX
#define INCLUDED_UCB_SOURCE_UCP_CMIS_AUTH_PROVIDER_HXX

-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
#include
-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic pop
#endif

diff --git a/ucb/source/ucp/cmis/certvalidation_handler.hxx b/ucb/source/ucp/cmis/certvalidation_handler.hxx
index e5d40f0315d6..797dd5368e3f 100644
--- a/ucb/source/ucp/cmis/certvalidation_handler.hxx
+++ b/ucb/source/ucp/cmis/certvalidation_handler.hxx
@@ -12,13 +12,13 @@
#ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_CERTVALIDATION_HANDLER_HXX
#define INCLUDED_UCB_SOURCE_UCP_CMIS_CERTVALIDATION_HANDLER_HXX

-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
#include
-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic pop
#endif

diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 6445091462f9..de6260005543 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -24,13 +24,13 @@
#include
#include

-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
#include
-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic pop
#endif

diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index 170c00cf9088..71e69b938d6f 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -7,13 +7,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
#include
-#if defined __GNUC__ && __GNUC__ >= 7
+#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic pop
#endif

d7b46ef1cf69 Remove obsolete GCC version checks
configure.ac | 4 ++--
.../source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 2 +-
cppu/qa/cppumaker/test_cppumaker.cxx | 2 +-
external/poppler/StaticLibrary_poppler.mk | 16 ----------------
include/o3tl/safeint.hxx | 2 +-
include/rtl/stringutils.hxx | 10 ----------
include/sal/types.h | 2 +-
solenv/gbuild/platform/com_GCC_defs.mk | 14 +++-----------
ucb/source/ucp/cmis/auth_provider.hxx | 4 ++--
ucb/source/ucp/cmis/certvalidation_handler.hxx | 4 ++--
ucb/source/ucp/cmis/cmis_content.hxx | 4 ++--
ucb/source/ucp/cmis/cmis_url.cxx | 4 ++--
12 files changed, 17 insertions(+), 51 deletions(-)

Upstream: cgit.freedesktop.org


  • Share