Skip to content

Commit 5f634bd

Browse files
author
Daniel Kolesa
committed
build: b_ndebug to if-release by default, add CI for ndebug builds
1 parent c1e0c49 commit 5f634bd

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ matrix:
5757
arch: amd64
5858
compiler: gcc
5959
env: LUA_VERSION=5.4.0 LUA_SRC=1 CC=gcc CXX=g++
60+
- os: linux
61+
arch: amd64
62+
compiler: gcc
63+
env: LUA_VERSION=5.4.0 LUA_SRC=1 BUILDTYPE=release CC=gcc CXX=g++
6064
- os: linux
6165
arch: amd64
6266
compiler: clang
@@ -248,28 +252,29 @@ script:
248252
for lua_ver in ${LUA_VERSION}; do
249253
local lua_maj=${lua_ver:0:3}
250254
lua_maj=${lua_maj/./}
255+
local margs="--buildtype=${BUILDTYPE:-debugoptimized}"
251256
mkdir build${lua_maj} && cd build${lua_maj}
252257
if [ "$FFI_TOOLCHAIN" == "msvc" ]; then
253258
cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&' \
254-
meson .. -Dlua_version=vendor -Dlibffi=vendor -Ddeps_dir=deps${lua_maj} '&&' \
259+
meson .. -Dlua_version=vendor -Dlibffi=vendor -Ddeps_dir=deps${lua_maj} ${margs} '&&' \
255260
ninja all '&&' ninja test || exit 1
256261
elif [ "$FFI_TOOLCHAIN" = "msys2" ]; then
257262
meson .. -Dlua_version="${LUA_VERSION}" \
258263
-Dlua_path="/C/tools/msys64/mingw64/bin/lua.exe" \
259264
-Dshared_libffi=true \
260-
-Ddeps_dir=deps${lua_maj} || exit 1
265+
-Ddeps_dir=deps${lua_maj} ${margs} || exit 1
261266
ninja all && ninja test || exit 1
262267
else
263268
if [ -n "$LIBFFI_SRC" ]; then
264269
meson .. -Dlua_version=vendor -Dlibffi=vendor \
265-
-Ddeps_dir=deps${lua_maj} || exit 1
270+
-Ddeps_dir=deps${lua_maj} ${margs} || exit 1
266271
elif [ -n "$LUA_SRC" ]; then
267272
meson .. -Dlua_version=vendor -Dshared_libffi=true \
268-
-Ddeps_dir=deps${lua_maj} || exit 1
273+
-Ddeps_dir=deps${lua_maj} ${margs} || exit 1
269274
else
270275
meson .. -Dlua_version="${LUA_VERSION}" \
271276
-Dshared_libffi=true \
272-
-Ddeps_dir=deps${lua_maj} || exit 1
277+
-Ddeps_dir=deps${lua_maj} ${margs} || exit 1
273278
fi
274279
ninja all && ninja test || exit 1
275280
fi

meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
project('cffi-lua', ['cpp'],
44
version: '0.2.0',
55
default_options: [
6-
'buildtype=debugoptimized', 'cpp_std=c++14', 'warning_level=3',
7-
'cpp_rtti=false', 'cpp_eh=none'
6+
'buildtype=debugoptimized', 'b_ndebug=if-release', 'cpp_std=c++14',
7+
'warning_level=3', 'cpp_rtti=false', 'cpp_eh=none'
88
],
99
meson_version: '>=0.50'
1010
)

src/ast.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ void c_record::set_fields(util::vector<field> fields) {
12201220
auto ret = ffi_prep_cif(
12211221
&cif, FFI_DEFAULT_ABI, 0, &p_ffi_type, nullptr
12221222
);
1223+
static_cast<void>(ret); /* silence NDEBUG warnings */
12231224
/* this should always succeed */
12241225
assert(ret == FFI_OK);
12251226

src/parser.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,7 @@ static ast::c_record const *parse_record(lex_state &ls, bool *newst) {
22772277
} else {
22782278
char buf[32];
22792279
auto wn = ls.request_name(buf, sizeof(buf));
2280+
static_cast<void>(wn); /* silence NDEBUG warnings */
22802281
assert(wn < sizeof(buf));
22812282
sname.append(buf);
22822283
}
@@ -2411,6 +2412,7 @@ static ast::c_enum const *parse_enum(lex_state &ls) {
24112412
} else {
24122413
char buf[32];
24132414
auto wn = ls.request_name(buf, sizeof(buf));
2415+
static_cast<void>(wn); /* silence NDEBUG warnings */
24142416
assert(wn < sizeof(buf));
24152417
ename.append(buf);
24162418
}

0 commit comments

Comments
 (0)