Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt17
-rw-r--r--SConstruct7
-rw-r--r--build_files/scons/config/darwin-config.py2
-rw-r--r--build_files/scons/config/linux-config.py2
-rw-r--r--build_files/scons/config/win32-mingw-config.py2
-rw-r--r--build_files/scons/config/win64-mingw-config.py2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c2
8 files changed, 23 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14eb2af58a4..b5317ccb724 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1189,12 +1189,6 @@ if(UNIX AND NOT APPLE)
if(CMAKE_COMPILER_IS_GNUCC)
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
- if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "5.0")
- # GCC5 uses gnu11, until we update, force c89
- # though some c11 features can still be used.
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
- endif()
-
# use ld.gold linker if available, could make optional
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
@@ -2577,9 +2571,9 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
- ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
+ ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_VLA -Werror=vla)
# system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
@@ -2624,7 +2618,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type)
- ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
@@ -2661,7 +2654,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# strange, clang complains these are not supported, but then yses them.
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
- ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
@@ -2776,6 +2768,13 @@ if(WITH_CPP11)
endif()
endif()
+if(MSVC)
+ # Visual Studio has all standards it supports available by default
+else()
+ # Use C99 + GNU extensions, works with GCC, Clang, ICC
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+endif()
+
# Include warnings first, so its possible to disable them with user defined flags
# eg: -Wno-uninitialized
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
diff --git a/SConstruct b/SConstruct
index ebd9cd1ec90..29f539236c2 100644
--- a/SConstruct
+++ b/SConstruct
@@ -498,6 +498,13 @@ if env['WITH_BF_CPP11']:
else:
env['CXXFLAGS'].append('-std=c++11')
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ # Visual Studio has all standards it supports available by default
+ pass
+else:
+ # Use C99 + GNU extensions, works with GCC, Clang, ICC
+ env['CFLAGS'].append('-std=gnu99')
+
#check for additional debug libnames
if env.has_key('BF_DEBUG_LIBS'):
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 0bf03a46bd2..16ba3ec4133 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -248,7 +248,7 @@ REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
CC_WARN = ['-Wall']
-C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
+C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wvla', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
##FIX_STUBS_WARNINGS = -Wno-unused
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index ff8ecf0aa72..1990d6ece0a 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -254,7 +254,7 @@ REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
-C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
+C_WARN = ['-Wno-char-subscripts', '-Wvla', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=vla', '-Werror=implicit-function-declaration', '-Werror=return-type']
CC_WARN = ['-Wall']
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index 552a1a5cec3..f4b709dda81 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -202,7 +202,7 @@ REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
-C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
+C_WARN = ['-Wno-char-subscripts', '-Wvla', '-Wstrict-prototypes']
CC_WARN = [ '-Wall' ]
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 87a9b5e4eac..6106f2ac631 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -197,7 +197,7 @@ REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2', '-ftree-vectorize']
# NOTE: C_WARN seems to get ignored - at least -Wno-char-subscripts doesn't work!
-C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
+C_WARN = ['-Wno-char-subscripts', '-Wvla', '-Wstrict-prototypes']
CC_WARN = [ '-Wall', '-Wno-char-subscripts' ]
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index b7742d82991..57e37c0190d 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -30,6 +30,9 @@
*/
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wvla"
+# endif
# define USE_DYNSIZE
#endif
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 7ad20d41bf1..71288871104 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -2055,7 +2055,7 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
static Py_hash_t Matrix_hash(MatrixObject *self)
{
- float mat[SQUARE(MATRIX_MAX_DIM)];
+ float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
if (BaseMath_ReadCallback(self) == -1)
return -1;