Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 22 Jun 2018 12:42:25 +0000 (14:42 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 22 Jun 2018 12:42:25 +0000 (14:42 +0200)
CMakeLists.txt
build_files/cmake/macros.cmake
source/blender/blenkernel/CMakeLists.txt
source/blender/imbuf/CMakeLists.txt

index 06d31e0e143778b54743800218d8d7454ac7f3c1..6c13703116c2bec07544c9b3a0f1d2eb2e523fb6 100644 (file)
@@ -806,7 +806,8 @@ set(C_WARNINGS)
 set(CXX_WARNINGS)
 
 # for gcc -Wno-blah-blah
-set(CC_REMOVE_STRICT_FLAGS)
+set(C_REMOVE_STRICT_FLAGS)
+set(CXX_REMOVE_STRICT_FLAGS)
 
 # libraries to link the binary with passed to target_link_libraries()
 # known as LLIBS to scons
@@ -1415,16 +1416,22 @@ if(CMAKE_COMPILER_IS_GNUCC)
        endif()
 
        # flags to undo strict flags
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION         -Wno-unused-function)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION         -Wno-unused-function)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS             -Wno-type-limits)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT     -Wno-int-in-bool-context)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT                  -Wno-format)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH                  -Wno-switch)
+
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS     -Wno-class-memaccess)
 
        if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
-               ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH    -Wno-implicit-fallthrough)
+               ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH    -Wno-implicit-fallthrough)
        endif()
 
        if(NOT APPLE)
-               ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
+               ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
        endif()
 
 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -1453,23 +1460,23 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
        # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
 
        # flags to undo strict flags
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS    -Wno-unused-macros)
-
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
-       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
-
-       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
-       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
-       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
-       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
-       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS    -Wno-unused-macros)
+
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
+       ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
+
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
 
 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 
index 8cf90d0d22c662ae4686e16b94eae1e6e7edce57..d6fde945173b6ef28ef3973a4d745a91ccc12647 100644 (file)
@@ -1054,13 +1054,19 @@ macro(remove_cc_flag
 
 endmacro()
 
-macro(add_cc_flag
+macro(add_c_flag
        flag)
 
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
 endmacro()
 
+macro(add_cxx_flag
+       flag)
+
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+endmacro()
+
 macro(remove_strict_flags)
 
        if(CMAKE_COMPILER_IS_GNUCC)
@@ -1083,7 +1089,8 @@ macro(remove_strict_flags)
                )
 
                # negate flags implied by '-Wall'
-               add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+               add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+               add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
        endif()
 
        if(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -1095,7 +1102,8 @@ macro(remove_strict_flags)
                )
 
                # negate flags implied by '-Wall'
-               add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+               add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+               add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
        endif()
 
        if(MSVC)
@@ -1125,28 +1133,39 @@ endmacro()
 # note, we can only append flags on a single file so we need to negate the options.
 # at the moment we cant shut up ffmpeg deprecations, so use this, but will
 # probably add more removals here.
-macro(remove_strict_flags_file
+macro(remove_strict_c_flags_file
        filenames)
-
        foreach(_SOURCE ${ARGV})
-
                if(CMAKE_COMPILER_IS_GNUCC OR
                  (CMAKE_C_COMPILER_ID MATCHES "Clang"))
-
                        set_source_files_properties(${_SOURCE}
                                PROPERTIES
-                                       COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
+                                       COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
                        )
                endif()
-
                if(MSVC)
                        # TODO
                endif()
-
        endforeach()
-
        unset(_SOURCE)
+endmacro()
 
+macro(remove_strict_cxx_flags_file
+       filenames)
+       remove_strict_c_flags_file(${filenames} ${ARHV})
+       foreach(_SOURCE ${ARGV})
+               if(CMAKE_COMPILER_IS_GNUCC OR
+                 (CMAKE_C_COMPILER_ID MATCHES "Clang"))
+                       set_source_files_properties(${_SOURCE}
+                               PROPERTIES
+                                       COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
+                       )
+               endif()
+               if(MSVC)
+                       # TODO
+               endif()
+       endforeach()
+       unset(_SOURCE)
 endmacro()
 
 # External libs may need 'signed char' to be default.
index 94d762214f22b8a2ee18bf29102fbb9b49890c24..15ccd660d83f5a86ff8c2b164c69fd95fdf9de20 100644 (file)
@@ -419,7 +419,7 @@ if(WITH_CODEC_FFMPEG)
        )
        add_definitions(-DWITH_FFMPEG)
 
-       remove_strict_flags_file(
+       remove_strict_c_flags_file(
                intern/writeffmpeg.c
        )
 endif()
index 44ff53cc0203cf3996d5484b693f7badaeb800d2..8d932c5e79d8b90b2a3f1f2ef15b6d1e40cdb97b 100644 (file)
@@ -139,7 +139,7 @@ if(WITH_CODEC_FFMPEG)
        )
        add_definitions(-DWITH_FFMPEG)
 
-       remove_strict_flags_file(
+       remove_strict_c_flags_file(
                intern/indexer.c
                intern/util.c
                intern/anim_movie.c