File: lua.c

package info (click to toggle)
cppcheck 2.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,688 kB
  • sloc: cpp: 272,455; python: 22,408; ansic: 8,088; sh: 1,059; makefile: 1,041; xml: 987; cs: 291
file content (31 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

// Test library configuration for lua.cfg
//
// Usage:
// $ cppcheck --check-library --library=lua --enable=style,information --inconclusive --error-exitcode=1 --inline-suppr 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);
}