diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/sal/types.h | 10 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_class.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_defs.mk | 18 |
4 files changed, 27 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 32ecfcc72aa5..f45af613bef9 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 7638eaeed139..86c7c730c073 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 93645a145638..e7b5f5cbb049 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 dbe46b69419d..5a3c0433779d 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 |