diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-01 04:46:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-01 04:46:04 +0400 |
commit | 2924a02a3561eed7899d5087f2a7a6c31529e18f (patch) | |
tree | f7e30878a3492cd0e91e2eaa5c8010ff6f0b930a /source/blender/blenlib | |
parent | ce326e20c85bc91471e681fa77f71be528302af3 (diff) |
move strict compiler checks into a header so its easier to manage in one place (pragmas were copied around).
also enable more strict warnings for BLF (which had some incorrect casts).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_strict_flags.h | 38 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_memarena.c | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 15 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 9 |
7 files changed, 47 insertions, 52 deletions
diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h new file mode 100644 index 00000000000..0f41c95a035 --- /dev/null +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -0,0 +1,38 @@ +/* + * ***** 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_STRICT_FLAGS_H__ +#define __BLI_STRICT_FLAGS_H__ + +/** \file BLI_strict_flags.h + * \ingroup bli + * \brief Strict compiler flags for areas of code we want + * to ensure don't do conversions without us knowing about it. + */ + +#ifdef __GNUC__ +# pragma GCC diagnostic error "-Wsign-conversion" +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" +# endif +#endif + +#endif /* __BLI_STRICT_FLAGS_H__ */ diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 58c4133fd61..750202c509d 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -43,16 +43,8 @@ #include "BLI_utildefines.h" #include "BLI_mempool.h" #include "BLI_ghash.h" +#include "BLI_strict_flags.h" -/***/ - -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif const unsigned int hashsizes[] = { 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 0aaa3e13b3f..45bdeeedcf9 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -34,14 +34,7 @@ #include "BLI_utildefines.h" #include "BLI_memarena.h" #include "BLI_heap.h" - -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif +#include "BLI_strict_flags.h" /***/ diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index 7fe5607a24e..747c2f0c2b7 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -36,14 +36,7 @@ #include "BLI_memarena.h" #include "BLI_linklist.h" - -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif +#include "BLI_strict_flags.h" struct MemArena { unsigned char *curbuf; diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index a4cb335b778..0aeb0896893 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -31,8 +31,12 @@ * Simple, fast memory allocator for allocating many elements of the same size. */ +#include <string.h> +#include <stdlib.h> + #include "BLI_utildefines.h" #include "BLI_listbase.h" +#include "BLI_strict_flags.h" #include "BLI_mempool.h" /* own include */ @@ -40,17 +44,6 @@ #include "MEM_guardedalloc.h" -#include <string.h> -#include <stdlib.h> - -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif - /* note: copied from BLO_blend_defs.h, don't use here because we're in BLI */ #ifdef __BIG_ENDIAN__ /* Big Endian */ diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 54ae0d385ef..967b59cf25d 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -38,14 +38,7 @@ #include "BLI_utildefines.h" #include "BLI_edgehash.h" #include "BLI_mempool.h" - -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif +#include "BLI_strict_flags.h" /**************inlined code************/ static const unsigned int _ehash_hashsizes[] = { diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 525bb37ae40..7bb0747daaa 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -31,6 +31,7 @@ #include "BLI_utildefines.h" #include "BLI_smallhash.h" +#include "BLI_strict_flags.h" /* SMHASH_CELL_UNUSED means this cell is inside a key series, * while SMHASH_CELL_FREE means this cell terminates a key series. @@ -43,14 +44,6 @@ #define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF) #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# pragma GCC diagnostic error "-Wconversion" -# endif -#endif - /* typically this re-assigns 'h' */ #define SMHASH_NEXT(h, hoff) ( \ CHECK_TYPE_INLINE(&(h), unsigned int *), \ |