[Libreoffice-commits] core.git: configure.ac include/sal solenv/gbuild

Stephan Bergmann sbergman at redhat.com
Fri Mar 4 16:08:36 UTC 2016


 configure.ac                            |    2 +-
 include/sal/types.h                     |   10 ++++++----
 solenv/gbuild/platform/com_MSC_class.mk |    4 ++--
 solenv/gbuild/platform/com_MSC_defs.mk  |   18 ++++++++++++++++++
 4 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit 9055fb48402eaeb9ba876b7893e2f9a39fea06b1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Mar 4 17:08:08 2016 +0100

    clang-cl: Enable more warnings etc. (like in the Clang/GCC case)
    
    Change-Id: Ia1fb09b89d3ccc3c7f4a11799f0d8eac99c6c7a9

diff --git a/configure.ac b/configure.ac
index 32ecfcc..f45af61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5990,7 +5990,7 @@ AC_SUBST(HAVE_THREADSAFE_STATICS)
 dnl ===================================================================
 dnl visibility and other gcc features
 dnl ===================================================================
-if test "$GCC" = "yes"; then
+if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
     save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
diff --git a/include/sal/types.h b/include/sal/types.h
index 7638eae..86c7c73 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -317,7 +317,9 @@ typedef void *                   sal_Handle;
     Compilers that support a construct of this nature will emit a compile
     time warning on unchecked return value.
 */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
+#if (defined __GNUC__ \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))) \
+    || defined __clang__
 #   define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
 #else
 #   define SAL_WARN_UNUSED_RESULT
@@ -491,7 +493,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
 
 #if HAVE_GCC_DEPRECATED_MESSAGE
 #    define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
-#elif (__GNUC__)
+#elif defined __GNUC__ || defined __clang__
 #    define SAL_DEPRECATED(message) __attribute__((deprecated))
 #elif defined(_MSC_VER)
 #    define SAL_DEPRECATED(message) __declspec(deprecated(message))
@@ -585,7 +587,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
     @since LibreOffice 3.6
  */
 #if defined __cplusplus
-#if defined __GNUC__
+#if defined __GNUC__ || defined __clang__
 #define SAL_UNUSED_PARAMETER __attribute__ ((unused))
 #else
 #define SAL_UNUSED_PARAMETER
@@ -614,7 +616,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
 
 /// @cond INTERNAL
 
-#if defined(__GNUC__)
+#if defined __GNUC__ || defined __clang__
 // Macro to try to catch and warn on assignments inside expr.
 #    define SAL_DETAIL_BOOLEAN_EXPR(expr)   \
         __extension__ ({                    \
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 93645a1..e7b5f5c 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -42,9 +42,9 @@ $(call gb_Helper_abbreviate_dirs,\
 	$(if $(filter YES,$(CXXOBJECT_X64)), $(CXX_X64_BINARY), \
 		$(if $(filter %.c,$(3)), $(gb_CC), $(gb_CXX))) \
 		$(DEFS) \
-		$(if $(EXTERNAL_CODE),,$(gb_DEFS_INTERNAL)) \
 		$(gb_LTOFLAGS) \
 		$(2) \
+		$(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \
 		$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
 		-Fd$(PDBFILE) \
 		$(PCHFLAGS) \
@@ -79,7 +79,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	unset INCLUDE && \
 	$(gb_CXX) \
 		$(4) $(5) -Fd$(PDBFILE) \
-		$(if $(EXTERNAL_CODE),,$(gb_DEFS_INTERNAL)) \
+		$(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \
 		$(gb_LTOFLAGS) \
 		$(gb_COMPILERDEPFLAGS) \
 		-I$(dir $(3)) \
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index dbe46b6..5a3c043 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -166,6 +166,17 @@ gb_CFLAGS := \
 	-Zc:wchar_t- \
 	$(if $(filter-out 120,$(VCVER)), -Wv:18) \
 
+ifeq ($(COM_IS_CLANG),TRUE)
+gb_CFLAGS += \
+	-Wdeclaration-after-statement \
+	-Wendif-labels \
+	-Wshadow \
+	-Wstrict-prototypes \
+	-Wundef \
+	-Wunused-macros \
+
+endif
+
 gb_CXXFLAGS := \
 	-Gd \
 	-GR \
@@ -215,7 +226,14 @@ endif
 
 ifeq ($(COM_IS_CLANG),TRUE)
 gb_CXXFLAGS += \
+	-Wendif-labels \
+	-Wno-missing-braces \
 	-Wno-missing-braces \
+	-Wnon-virtual-dtor \
+	-Woverloaded-virtual \
+	-Wshadow \
+	-Wundef \
+	-Wunused-macros \
 
 endif
 


More information about the Libreoffice-commits mailing list