cppcheck/test/cfg/lua.c

32 lines
770 B
C

// Test library configuration for lua.cfg
//
// Usage:
// $ cppcheck --check-library --library=lua --enable=information --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem test/cfg/lua.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
#include <lua.h>
#include <stdio.h>
void validCode(lua_State *L)
{
int a = lua_gettop(L);
printf("%d", a);
lua_pushnil(L);
lua_pop(L, 1);
}
void ignoredReturnValue(lua_State *L)
{
// cppcheck-suppress ignoredReturnValue
lua_tonumber(L, 1);
// cppcheck-suppress ignoredReturnValue
lua_tostring(L, 1);
// cppcheck-suppress ignoredReturnValue
lua_isboolean(L, 1);
// cppcheck-suppress ignoredReturnValue
lua_isnil(L, 1);
}