Skip to content

Commit 2f5dba3

Browse files
build: added compilation warns and flags
1 parent ce250df commit 2f5dba3

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

src/meson.build

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,53 @@ lua_src = [
4444
'lua.c'
4545
]
4646

47+
lua_warns = [
48+
'-fmax-errors=5',
49+
'-Wextra',
50+
'-Wshadow',
51+
'-Wsign-compare',
52+
'-Wundef',
53+
'-Wwrite-strings',
54+
'-Wredundant-decls',
55+
'-Wdisabled-optimization',
56+
'-Wdouble-promotion',
57+
'-Wlogical-op',
58+
'-Wno-aggressive-loop-optimizations',
59+
'-Wdeclaration-after-statement',
60+
'-Wmissing-prototypes',
61+
'-Wnested-externs',
62+
'-Wstrict-prototypes',
63+
'-Wc++-compat',
64+
'-Wold-style-definition',
65+
## the next warnings might be useful sometimes,
66+
## but usually they generate too much noise
67+
# '-Werror',
68+
# '-pedantic', # warns if we use jump tables
69+
# '-Wconversion ',
70+
# '-Wsign-conversion',
71+
# '-Wstrict-overflow=2',
72+
# '-Wformat=2',
73+
# '-Wcast-qual'
74+
]
75+
76+
lua_flags = [
77+
'-Wall',
78+
'-O2',
79+
'-fno-stack-protector',
80+
'-fno-common',
81+
'-march=native'
82+
]
83+
4784
if get_option('library_type') == 'static'
4885
liblua = static_library('liblua',
86+
c_args: [lua_warns, lua_flags],
4987
dependencies: [m_dep],
5088
sources: [luacore_src, liblua_src, luaaux_src],
5189
include_directories: lua_inc,
5290
install: true)
5391
else
5492
liblua = shared_library('liblua',
93+
c_args: [lua_warns, lua_flags],
5594
dependencies: [m_dep],
5695
sources: [luacore_src, liblua_src, luaaux_src],
5796
include_directories: lua_inc,

0 commit comments

Comments
 (0)