diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-01 19:14:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-01 19:14:15 +0400 |
commit | 95b93b5d46b7fb8b98295a1368bc44a3f63fe8c7 (patch) | |
tree | b8354da5645d51d98d010fce61d86d163d2b4b2c | |
parent | 35ca2091529cc7817f52ecc36b09f27713f474c1 (diff) |
Add BLI_compiler_compat.h to help with portability
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_alloca.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_compiler_compat.h | 35 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 4 |
8 files changed, 37 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 57758acf864..fd4350123b4 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -63,10 +63,6 @@ #include <math.h> #include <string.h> -#ifdef WIN32 -# include "BLI_alloca.h" -#endif - /* number of layers to add when growing a CustomData object */ #define CUSTOMDATA_GROW 5 diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h index 06c3e8d8996..fd814940624 100644 --- a/source/blender/blenlib/BLI_alloca.h +++ b/source/blender/blenlib/BLI_alloca.h @@ -28,9 +28,6 @@ */ /* BLI_array_alloca / alloca */ -#ifdef _MSC_VER -# define alloca _alloca -#endif #if defined(__MINGW32__) # include <malloc.h> /* mingw needs for alloca() */ diff --git a/source/blender/blenlib/BLI_compiler_compat.h b/source/blender/blenlib/BLI_compiler_compat.h new file mode 100644 index 00000000000..60a7d8dbd02 --- /dev/null +++ b/source/blender/blenlib/BLI_compiler_compat.h @@ -0,0 +1,35 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BLI_COMPILER_COMPAT_H__ +#define __BLI_COMPILER_COMPAT_H__ + +/** \file BLI_compiler_compat.h + * \ingroup bli + * + * Use to help with cross platform portability. + */ + +#if defined(_MSC_VER) +# define __func__ __FUNCTION__ +# define alloca _alloca +#endif + +#endif /* __BLI_COMPILER_COMPAT_H__ */ diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index ea3701f804a..8c67c76bccd 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -34,6 +34,7 @@ /* avoid many includes for now */ #include "BLI_sys_types.h" +#include "BLI_compiler_compat.h" #ifndef NDEBUG /* for BLI_assert */ #include <stdio.h> @@ -386,16 +387,9 @@ #define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0) #define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0) - - /* useful for debugging */ #define AT __FILE__ ":" STRINGIFY(__LINE__) -/* so we can use __func__ everywhere */ -#if defined(_MSC_VER) -# define __func__ __FUNCTION__ -#endif - /* UNUSED macro, for function argument */ #ifdef __GNUC__ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 1575f8eb087..9e360741b23 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -116,6 +116,7 @@ set(SRC BLI_buffer.h BLI_callbacks.h BLI_compiler_attrs.h + BLI_compiler_compat.h BLI_convexhull2d.h BLI_dlrbTree.h BLI_dynlib.h diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index e8e3387f72e..d6b2383bd47 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -56,10 +56,6 @@ #include "BLI_utildefines.h" -#ifdef WIN32 -# include "BLI_alloca.h" -#endif - #include "BLI_smallhash.h" #include "BLI_strict_flags.h" diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 6b040ef5f35..e9d3c36eb1a 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -40,10 +40,6 @@ #include "BKE_editmesh.h" #include "BKE_multires.h" -#ifdef WIN32 -# include "BLI_alloca.h" -#endif - #include "intern/bmesh_private.h" /* used as an extern, defined in bmesh.h */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 05659f60578..151764dab6a 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -68,10 +68,6 @@ #include "screen_intern.h" -#ifdef WIN32 -# include "BLI_alloca.h" -#endif - extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */ /* general area and region code */ |