Add BLI_compiler_compat.h to help with portability
This commit is contained in:
@@ -63,10 +63,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
# include "BLI_alloca.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* number of layers to add when growing a CustomData object */
|
/* number of layers to add when growing a CustomData object */
|
||||||
#define CUSTOMDATA_GROW 5
|
#define CUSTOMDATA_GROW 5
|
||||||
|
|
||||||
|
@@ -28,9 +28,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* BLI_array_alloca / alloca */
|
/* BLI_array_alloca / alloca */
|
||||||
#ifdef _MSC_VER
|
|
||||||
# define alloca _alloca
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
# include <malloc.h> /* mingw needs for alloca() */
|
# include <malloc.h> /* mingw needs for alloca() */
|
||||||
|
35
source/blender/blenlib/BLI_compiler_compat.h
Normal file
35
source/blender/blenlib/BLI_compiler_compat.h
Normal file
@@ -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__ */
|
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
/* avoid many includes for now */
|
/* avoid many includes for now */
|
||||||
#include "BLI_sys_types.h"
|
#include "BLI_sys_types.h"
|
||||||
|
#include "BLI_compiler_compat.h"
|
||||||
|
|
||||||
#ifndef NDEBUG /* for BLI_assert */
|
#ifndef NDEBUG /* for BLI_assert */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -386,16 +387,9 @@
|
|||||||
#define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0)
|
#define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0)
|
||||||
|
|
||||||
#define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0)
|
#define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0)
|
||||||
|
|
||||||
|
|
||||||
/* useful for debugging */
|
/* useful for debugging */
|
||||||
#define AT __FILE__ ":" STRINGIFY(__LINE__)
|
#define AT __FILE__ ":" STRINGIFY(__LINE__)
|
||||||
|
|
||||||
/* so we can use __func__ everywhere */
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
# define __func__ __FUNCTION__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* UNUSED macro, for function argument */
|
/* UNUSED macro, for function argument */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@@ -116,6 +116,7 @@ set(SRC
|
|||||||
BLI_buffer.h
|
BLI_buffer.h
|
||||||
BLI_callbacks.h
|
BLI_callbacks.h
|
||||||
BLI_compiler_attrs.h
|
BLI_compiler_attrs.h
|
||||||
|
BLI_compiler_compat.h
|
||||||
BLI_convexhull2d.h
|
BLI_convexhull2d.h
|
||||||
BLI_dlrbTree.h
|
BLI_dlrbTree.h
|
||||||
BLI_dynlib.h
|
BLI_dynlib.h
|
||||||
|
@@ -56,10 +56,6 @@
|
|||||||
|
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
# include "BLI_alloca.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "BLI_smallhash.h"
|
#include "BLI_smallhash.h"
|
||||||
|
|
||||||
#include "BLI_strict_flags.h"
|
#include "BLI_strict_flags.h"
|
||||||
|
@@ -40,10 +40,6 @@
|
|||||||
#include "BKE_editmesh.h"
|
#include "BKE_editmesh.h"
|
||||||
#include "BKE_multires.h"
|
#include "BKE_multires.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
# include "BLI_alloca.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "intern/bmesh_private.h"
|
#include "intern/bmesh_private.h"
|
||||||
|
|
||||||
/* used as an extern, defined in bmesh.h */
|
/* used as an extern, defined in bmesh.h */
|
||||||
|
@@ -68,10 +68,6 @@
|
|||||||
|
|
||||||
#include "screen_intern.h"
|
#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 */
|
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 */
|
/* general area and region code */
|
||||||
|
Reference in New Issue
Block a user