Fix compute_int() when the value is -1

pull/6216/head
Xavier Claessens 5 years ago committed by Jussi Pakkanen
parent cefdf8dcb0
commit e4e5f981eb
  1. 2
      mesonbuild/compilers/mixins/clike.py
  2. 3
      test cases/common/138 compute int/meson.build

@ -423,7 +423,7 @@ class CLikeCompiler:
cur = maxint
high = cur
else:
low = cur = -1
high = cur = -1
while self._compile_int('%s < %d' % (expression, cur), prefix, env, extra_args, dependencies):
high = cur - 1
if high < minint:

@ -10,6 +10,9 @@ foobar = cc.compute_int('FOOBAR_IN_FOOBAR_H', prefix : '#include "foobar.h"', in
maxint = cc.compute_int('INT_MAX', prefix: '#include <limits.h>')
minint = cc.compute_int('INT_MIN', prefix: '#include <limits.h>')
# Regression test for the special case -1 that used to fail when cross compiling
assert(cc.compute_int('-1') == -1, 'compute_int(-1) failed')
cd = configuration_data()
cd.set('INTSIZE', intsize)
cd.set('FOOBAR', foobar)

Loading…
Cancel
Save