Switch DXX_HAVE_POISON to 0/1 instead of undef/defined
This commit is contained in:
parent
1d09ca32ad
commit
03dbc96103
|
@ -495,6 +495,8 @@ struct %(N)s_derived : %(N)s_base {
|
||||||
""".format(macro_name=macro_name, macro_value=macro_value, test=test), **kwargs)
|
""".format(macro_name=macro_name, macro_value=macro_value, test=test), **kwargs)
|
||||||
if not r:
|
if not r:
|
||||||
macro_value = _comment_not_supported
|
macro_value = _comment_not_supported
|
||||||
|
self._define_macro(context, macro_name, macro_value)
|
||||||
|
def _define_macro(self,context,macro_name,macro_value):
|
||||||
context.sconf.Define(macro_name, macro_value)
|
context.sconf.Define(macro_name, macro_value)
|
||||||
self.__defined_macros += '#define %s %s\n' % (macro_name, macro_value)
|
self.__defined_macros += '#define %s %s\n' % (macro_name, macro_value)
|
||||||
implicit_tests.append(_implicit_test.RecordedTest('check_ccache_distcc_ld_works', "assume ccache, distcc, C++ compiler, and C++ linker work"))
|
implicit_tests.append(_implicit_test.RecordedTest('check_ccache_distcc_ld_works', "assume ccache, distcc, C++ compiler, and C++ linker work"))
|
||||||
|
@ -1063,7 +1065,7 @@ int main(int argc,char**argv){(void)argc;(void)argv;
|
||||||
context.Display('%s: checking whether to use %s...%s\n' % (self.msgprefix, mixer, 'yes' if user_settings.sdlmixer else 'no'))
|
context.Display('%s: checking whether to use %s...%s\n' % (self.msgprefix, mixer, 'yes' if user_settings.sdlmixer else 'no'))
|
||||||
# SDL_mixer support?
|
# SDL_mixer support?
|
||||||
use_sdlmixer = user_settings.sdlmixer
|
use_sdlmixer = user_settings.sdlmixer
|
||||||
context.sconf.Define('DXX_USE_SDLMIXER', int(use_sdlmixer))
|
self._define_macro(context, 'DXX_USE_SDLMIXER', int(use_sdlmixer))
|
||||||
if not use_sdlmixer:
|
if not use_sdlmixer:
|
||||||
return
|
return
|
||||||
successflags = self.pkgconfig.merge(context, self.msgprefix, user_settings, mixer, mixer, guess_flags)
|
successflags = self.pkgconfig.merge(context, self.msgprefix, user_settings, mixer, mixer, guess_flags)
|
||||||
|
@ -1838,6 +1840,7 @@ help:add Valgrind annotations; wipe certain freed memory when running under Valg
|
||||||
if not r:
|
if not r:
|
||||||
return
|
return
|
||||||
text = '''
|
text = '''
|
||||||
|
#define DXX_HAVE_POISON 1
|
||||||
#include "poison.h"
|
#include "poison.h"
|
||||||
'''
|
'''
|
||||||
main = '''
|
main = '''
|
||||||
|
@ -1868,8 +1871,7 @@ help:always wipe certain freed memory
|
||||||
for f in _methods:
|
for f in _methods:
|
||||||
if f(self, context):
|
if f(self, context):
|
||||||
poison = True
|
poison = True
|
||||||
if poison:
|
self._define_macro(context, 'DXX_HAVE_POISON', int(poison))
|
||||||
context.sconf.Define('DXX_HAVE_POISON')
|
|
||||||
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_size', "assume size_t is formatted as `size_t`"))
|
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_size', "assume size_t is formatted as `size_t`"))
|
||||||
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_long', "assume size_t is formatted as `unsigned long`"))
|
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_long', "assume size_t is formatted as `unsigned long`"))
|
||||||
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_int', "assume size_t is formatted as `unsigned int`"))
|
implicit_tests.append(_implicit_test.RecordedTest('check_size_type_int', "assume size_t is formatted as `unsigned int`"))
|
||||||
|
|
|
@ -238,7 +238,7 @@ struct PHYSFSX_gets_line_t
|
||||||
PHYSFSX_gets_line_t(PHYSFSX_gets_line_t &&) = default;
|
PHYSFSX_gets_line_t(PHYSFSX_gets_line_t &&) = default;
|
||||||
PHYSFSX_gets_line_t &operator=(PHYSFSX_gets_line_t &&) = default;
|
PHYSFSX_gets_line_t &operator=(PHYSFSX_gets_line_t &&) = default;
|
||||||
typedef array<char, N> line_t;
|
typedef array<char, N> line_t;
|
||||||
#ifdef DXX_HAVE_POISON
|
#if DXX_HAVE_POISON
|
||||||
/* Force onto heap to improve checker accuracy */
|
/* Force onto heap to improve checker accuracy */
|
||||||
std::unique_ptr<line_t> m_line;
|
std::unique_ptr<line_t> m_line;
|
||||||
const line_t &line() const { return *m_line.get(); }
|
const line_t &line() const { return *m_line.get(); }
|
||||||
|
@ -274,7 +274,7 @@ struct PHYSFSX_gets_line_t<0>
|
||||||
std::unique_ptr<char[]> m_line;
|
std::unique_ptr<char[]> m_line;
|
||||||
std::size_t m_length;
|
std::size_t m_length;
|
||||||
PHYSFSX_gets_line_t(std::size_t n) :
|
PHYSFSX_gets_line_t(std::size_t n) :
|
||||||
#ifndef DXX_HAVE_POISON
|
#if !DXX_HAVE_POISON
|
||||||
m_line(DXX_ALLOCATE_PHYSFS_LINE(n)),
|
m_line(DXX_ALLOCATE_PHYSFS_LINE(n)),
|
||||||
#endif
|
#endif
|
||||||
m_length(n)
|
m_length(n)
|
||||||
|
@ -284,7 +284,7 @@ struct PHYSFSX_gets_line_t<0>
|
||||||
const char *line() const { return m_line.get(); }
|
const char *line() const { return m_line.get(); }
|
||||||
char *next()
|
char *next()
|
||||||
{
|
{
|
||||||
#ifdef DXX_HAVE_POISON
|
#if DXX_HAVE_POISON
|
||||||
/* Reallocate to tell checker to undefine the buffer */
|
/* Reallocate to tell checker to undefine the buffer */
|
||||||
m_line = DXX_ALLOCATE_PHYSFS_LINE(m_length);
|
m_line = DXX_ALLOCATE_PHYSFS_LINE(m_length);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ static inline void DXX_MAKE_VAR_UNDEFINED(T &b)
|
||||||
template <typename T, typename V>
|
template <typename T, typename V>
|
||||||
static inline void _DXX_POISON_MEMORY_RANGE(T b, T e, const V &v)
|
static inline void _DXX_POISON_MEMORY_RANGE(T b, T e, const V &v)
|
||||||
{
|
{
|
||||||
#ifdef DXX_HAVE_POISON
|
#if DXX_HAVE_POISON
|
||||||
int store = 0;
|
int store = 0;
|
||||||
#ifdef DXX_HAVE_POISON_OVERWRITE
|
#ifdef DXX_HAVE_POISON_OVERWRITE
|
||||||
store |= 1;
|
store |= 1;
|
||||||
|
|
|
@ -735,7 +735,7 @@ void compute_average_rgb(grs_bitmap *bm, array<fix, 3> &rgb)
|
||||||
auto sbits = &bm->get_bitmap_data()[4 + (bm->bm_h * data_offset)];
|
auto sbits = &bm->get_bitmap_data()[4 + (bm->bm_h * data_offset)];
|
||||||
for (uint_fast32_t i = 0; i != bm_h; ++i)
|
for (uint_fast32_t i = 0; i != bm_h; ++i)
|
||||||
{
|
{
|
||||||
#ifdef DXX_HAVE_POISON
|
#if DXX_HAVE_POISON
|
||||||
/* Reallocate to undefine buffer */
|
/* Reallocate to undefine buffer */
|
||||||
buf = make_unique<uint8_t[]>(bm_w);
|
buf = make_unique<uint8_t[]>(bm_w);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue