{
"lapi.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 25,
"message": "Function-like macro 'api_incr_top' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 25,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 25,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 45,
"message": "Function-like macro 'adjustresults' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 45,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 45,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: ({ if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \\\n\tL->ci->top.p = L->top.p; })"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 45,
"message": "Multistatement macro 'adjustresults' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 45,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 51,
"message": "Function-like macro 'api_checknelems' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 51,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 51,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (api_check(L, (n) < (L->top.p - L->ci->func.p), \\\n \"not enough elements in the stack\"))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 51,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 60,
"message": "Function-like macro 'api_checkpop' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 60,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 60,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (api_check(L, (n) < L->top.p - L->ci->func.p && \\\n L->tbclist.p < L->top.p - (n), \\\n\t\t\t \"not enough free elements in the stack\"))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.h",
"line": 60,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
}
],
"lcode.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lcode.h",
"line": 60,
"message": "Function-like macro 'luaK_jumpto' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lcode.h",
"line": 60,
"message": "Macro evaluates parameter 'fs' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lcode.h",
"line": 102,
"message": "Variadic function declaration should use proper header",
"rule_id": "EXP37-C",
"severity": "Medium",
"suggestion": "Include proper header instead of declaring variadic function"
}
],
"lctype.c": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.c",
"line": 28,
"message": "Variable-length array with runtime-sized allocation; use malloc instead",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Use malloc/calloc for dynamic allocation"
}
],
"lctype.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 58,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 71,
"message": "Function-like macro 'ltolower' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 71,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \\\n (c) | ('A' ^ 'a')))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 71,
"message": "Macro evaluates parameter 'c' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 77,
"message": "Declaration is missing an explicit type specifier",
"rule_id": "DCL31-C",
"severity": "Low",
"suggestion": "Add an explicit type specifier to the declaration"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 77,
"message": "Fixed-size buffer may be used with environment variable",
"rule_id": "ENV01-C",
"severity": "High",
"suggestion": "Use dynamic allocation based on strlen() of getenv() result"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 77,
"message": "Variable-length array with runtime-sized allocation; use malloc instead",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Use malloc/calloc for dynamic allocation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 89,
"message": "Function-like macro 'lislalpha' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 89,
"message": "Macro evaluates parameter 'c' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 90,
"message": "Function-like macro 'lislalnum' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lctype.h",
"line": 90,
"message": "Macro evaluates parameter 'c' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
}
],
"ldebug.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldebug.h",
"line": 21,
"message": "Function-like macro 'resethookcount' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldebug.h",
"line": 21,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldebug.h",
"line": 21,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldebug.h",
"line": 57,
"message": "Variadic function declaration should use proper header",
"rule_id": "EXP37-C",
"severity": "Medium",
"suggestion": "Include proper header instead of declaring variadic function"
},
{
"column": 59,
"file": "/home/brandon/toolchain/lua/ldebug.h",
"line": 59,
"message": "Pointer parameter 'src' should likely be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Consider declaring parameter as 'const <type> *src'"
}
],
"ldo.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 31,
"message": "Function-like macro 'condmovestack' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 31,
"message": "Macro parameter 'pre' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'pre' in parentheses: (pre) instead of pre"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 31,
"message": "Macro parameter 'pos' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'pos' in parentheses: (pos) instead of pos"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 31,
"message": "Multistatement macro 'condmovestack' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 31,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Function-like macro 'luaD_checkstackaux' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Macro parameter 'pre' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'pre' in parentheses: (pre) instead of pre"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Macro parameter 'pos' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'pos' in parentheses: (pos) instead of pos"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \\\n\t { pre; luaD_growstack(L, n, 1); pos; } \\\n\telse { condmovestack(L,pre,pos); })"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Multistatement macro 'luaD_checkstackaux' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 35,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 45,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 46,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ldo.h",
"line": 46,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (cast(StkId, cast_charp(L->stack.p) + (n)))"
}
],
"lfunc.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 22,
"message": "Function-like macro 'isintwups' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 22,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 22,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 32,
"message": "Function-like macro 'upisopen' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 32,
"message": "Macro evaluates parameter 'up' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 35,
"message": "Function-like macro 'uplevel' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lfunc.h",
"line": 35,
"message": "Macro evaluates parameter 'up' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
}
],
"linit.c": [
{
"column": 23,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 28,
"message": "Array declaration 'stdlibs[]' has implicit bounds; specify explicit size",
"rule_id": "ARR02-C",
"severity": "Medium",
"suggestion": "Explicitly specify array bounds even when using an initializer"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 46,
"message": "Function 'luaL_openselectedlibs' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 46,
"message": "Function 'luaL_openselectedlibs' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUALIB_API luaL_openselectedlibs"
},
{
"column": 16,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 51,
"message": "Bitwise operator '&' used on signed operand 'mask' of type 'int'. Use unsigned types for bitwise operations",
"rule_id": "INT13-C",
"severity": "Medium",
"suggestion": "Change 'mask' to an unsigned type (e.g., 'unsigned int' instead of 'int')"
},
{
"column": 24,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 55,
"message": "Bitwise operator '&' used on signed operand 'mask' of type 'int'. Use unsigned types for bitwise operations",
"rule_id": "INT13-C",
"severity": "Medium",
"suggestion": "Change 'mask' to an unsigned type (e.g., 'unsigned int' instead of 'int')"
},
{
"column": 15,
"file": "/home/brandon/toolchain/lua/linit.c",
"line": 60,
"message": "Bitwise operator '>>' used on signed operand 'mask' of type 'int'. Use unsigned types for bitwise operations",
"rule_id": "INT13-C",
"severity": "Medium",
"suggestion": "Change 'mask' to an unsigned type (e.g., 'unsigned int' instead of 'int')"
}
],
"ljumptab.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 1,
"message": "Header file missing include guard",
"rule_id": "PRE06-C",
"severity": "Low",
"suggestion": "Add #ifndef HEADER_H / #define HEADER_H / #endif guard"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 12,
"message": "Macro parameter 'x' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'x' in parentheses: (x) instead of x"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 12,
"message": "Macro 'vmdispatch' definition ends with a semicolon. This can cause unexpected behavior when the macro is used.",
"rule_id": "PRE11-C",
"severity": "Medium",
"suggestion": "Remove the trailing semicolon from the macro definition. The semicolon should be added by the macro user, not in the definition."
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 14,
"message": "Macro 'vmcase' uses token concatenation operator (##) which prevents parameter expansion - consider using two-level macro indirection for proper expansion",
"rule_id": "PRE05-C",
"severity": "Low",
"suggestion": "Use two-level indirection: define a wrapper macro that calls another macro with ##, allowing parameters to expand first"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 16,
"message": "Multistatement macro 'vmbreak' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ljumptab.h",
"line": 16,
"message": "Macro 'vmbreak' definition ends with a semicolon. This can cause unexpected behavior when the macro is used.",
"rule_id": "PRE11-C",
"severity": "Medium",
"suggestion": "Remove the trailing semicolon from the macro definition. The semicolon should be added by the macro user, not in the definition."
}
],
"llex.h": [
{
"column": 39,
"file": "/home/brandon/toolchain/lua/llex.h",
"line": 85,
"message": "Pointer parameter 'source' should likely be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Consider declaring parameter as 'const <type> *source'"
},
{
"column": 61,
"file": "/home/brandon/toolchain/lua/llex.h",
"line": 86,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
}
],
"lmem.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 31,
"message": "Function-like macro 'luaM_testsize' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 31,
"message": "Macro evaluates parameter 'n' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 44,
"message": "Function-like macro 'luaM_limitN' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 44,
"message": "Macro evaluates parameter 'n' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 56,
"message": "Function-like macro 'luaM_free' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 56,
"message": "Macro evaluates parameter 'b' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 57,
"message": "Function-like macro 'luaM_freearray' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 57,
"message": "Macro evaluates parameter 'b' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 59,
"message": "Function-like macro 'luaM_new' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 59,
"message": "Macro parameter 't' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 't' in parentheses: (t) instead of t"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 59,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 60,
"message": "Function-like macro 'luaM_newvector' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 60,
"message": "Macro parameter 't' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 't' in parentheses: (t) instead of t"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 60,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 62,
"message": "Function-like macro 'luaM_newvectorchecked' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 62,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 69,
"message": "Function-like macro 'luaM_growvector' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 69,
"message": "Macro parameter 't' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 't' in parentheses: (t) instead of t"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 69,
"message": "Macro evaluates parameter 'v' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 73,
"message": "Function-like macro 'luaM_reallocvector' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 73,
"message": "Macro parameter 't' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 't' in parentheses: (t) instead of t"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 73,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 77,
"message": "Function-like macro 'luaM_shrinkvector' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 77,
"message": "Macro parameter 't' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 't' in parentheses: (t) instead of t"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 77,
"message": "Macro evaluates parameter 'v' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 51,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 83,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 55,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 85,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 47,
"file": "/home/brandon/toolchain/lua/lmem.h",
"line": 87,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
}
],
"lopcodes.c": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lopcodes.c",
"line": 22,
"message": "Variable 'luaP_opmodes' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lopcodes.c",
"line": 22,
"message": "File-scope variable should have minimal scope. Consider making it static within a function or limiting its scope.",
"rule_id": "DCL19-C",
"severity": "Low",
"suggestion": "Move variable to the smallest scope where it's used, or make it static inside a function"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lopcodes.c",
"line": 112,
"message": "Macro parameter 'm' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'm' in parentheses: (m) instead of m"
}
],
"lopnames.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lopnames.h",
"line": 1,
"message": "Header file missing include guard",
"rule_id": "PRE06-C",
"severity": "Low",
"suggestion": "Add #ifndef HEADER_H / #define HEADER_H / #endif guard"
},
{
"column": 26,
"file": "/home/brandon/toolchain/lua/lopnames.h",
"line": 15,
"message": "Array declaration 'opnames[]' has implicit bounds; specify explicit size",
"rule_id": "ARR02-C",
"severity": "Medium",
"suggestion": "Explicitly specify array bounds even when using an initializer"
}
],
"lprefix.h": [
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lprefix.h",
"line": 17,
"message": "Reserved identifier '_XOPEN_SOURCE' should not be used as a macro name",
"rule_id": "DCL37-C",
"severity": "Medium",
"suggestion": "Use a non-reserved macro name"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lprefix.h",
"line": 26,
"message": "Reserved identifier '_LARGEFILE_SOURCE' should not be used as a macro name",
"rule_id": "DCL37-C",
"severity": "Medium",
"suggestion": "Use a non-reserved macro name"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lprefix.h",
"line": 27,
"message": "Reserved identifier '_FILE_OFFSET_BITS' should not be used as a macro name",
"rule_id": "DCL37-C",
"severity": "Medium",
"suggestion": "Use a non-reserved macro name"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lprefix.h",
"line": 39,
"message": "Reserved identifier '_CRT_SECURE_NO_WARNINGS' should not be used as a macro name",
"rule_id": "DCL37-C",
"severity": "Medium",
"suggestion": "Use a non-reserved macro name"
}
],
"lstring.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 41,
"message": "Function-like macro 'luaS_newliteral' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 41,
"message": "Macro evaluates parameter 's' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 48,
"message": "Function-like macro 'isreserved' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 48,
"message": "Macro evaluates parameter 's' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 54,
"message": "Function-like macro 'eqshrstr' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 54,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 54,
"message": "Macro evaluates parameter 'a' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 59,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 65,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 14,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 69,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 53,
"file": "/home/brandon/toolchain/lua/lstring.h",
"line": 69,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
}
],
"ltm.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 54,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (cast_byte(~(~0u << (TM_EQ + 1))))"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 63,
"message": "Function-like macro 'checknoTM' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 63,
"message": "Macro evaluates parameter 'mt' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 65,
"message": "Function-like macro 'gfasttm' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 65,
"message": "Macro parameter 'e' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'e' in parentheses: (e) instead of e"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 65,
"message": "Macro evaluates parameter 'mt' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 70,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (luaT_typenames_[(x) + 1])"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/ltm.h",
"line": 72,
"message": "Declaration is missing an explicit type specifier",
"rule_id": "DCL31-C",
"severity": "Low",
"suggestion": "Add an explicit type specifier to the declaration"
}
],
"lualib.h": [],
"lundump.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lundump.h",
"line": 20,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (-0x5678)"
}
],
"lvm.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 51,
"message": "Function-like macro 'tonumber' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 51,
"message": "Macro evaluates parameter 'o' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 56,
"message": "Function-like macro 'tonumberns' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 56,
"message": "Macro evaluates parameter 'o' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 62,
"message": "Macro 'tointeger' reverses parameter order, creating inconsistent interface",
"rule_id": "API03-C",
"severity": "Medium",
"suggestion": "Avoid macros that reorder parameters. Maintain consistent parameter ordering across related functions"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 62,
"message": "Function-like macro 'tointeger' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 62,
"message": "Macro evaluates parameter 'o' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 68,
"message": "Macro 'tointegerns' reverses parameter order, creating inconsistent interface",
"rule_id": "API03-C",
"severity": "Medium",
"suggestion": "Avoid macros that reorder parameters. Maintain consistent parameter ordering across related functions"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 68,
"message": "Function-like macro 'tointegerns' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 68,
"message": "Macro evaluates parameter 'o' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 73,
"message": "Macro parameter 'op' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'op' in parentheses: (op) instead of op"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 81,
"message": "Function-like macro 'luaV_fastget' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 81,
"message": "Macro parameter 'f' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'f' in parentheses: (f) instead of f"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 81,
"message": "Macro parameter 'tag' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'tag' in parentheses: (tag) instead of tag"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 81,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 89,
"message": "Function-like macro 'luaV_fastgeti' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 89,
"message": "Macro parameter 'tag' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'tag' in parentheses: (tag) instead of tag"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 89,
"message": "Multistatement macro 'luaV_fastgeti' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 89,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 94,
"message": "Function-like macro 'luaV_fastset' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 94,
"message": "Macro parameter 'hres' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'hres' in parentheses: (hres) instead of hres"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 94,
"message": "Macro parameter 'f' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'f' in parentheses: (f) instead of f"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 94,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 97,
"message": "Function-like macro 'luaV_fastseti' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 97,
"message": "Macro parameter 'hres' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'hres' in parentheses: (hres) instead of hres"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 97,
"message": "Multistatement macro 'luaV_fastseti' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lvm.h",
"line": 97,
"message": "Macro evaluates parameter 't' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
}
],
"lzio.c": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 39,
"message": "Function 'luaZ_init' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 39,
"message": "Function 'luaZ_init' does not validate pointer parameter 'z' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'z' at the start of the function, e.g., 'if (!z) { return error_code; }'"
},
{
"column": 27,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 39,
"message": "Pointer parameter 'L' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *L'"
},
{
"column": 63,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 39,
"message": "Pointer parameter 'data' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *data'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 63,
"message": "Function 'luaZ_read' does not validate pointer parameter 'z' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'z' at the start of the function, e.g., 'if (!z) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 63,
"message": "Function 'luaZ_read' does not validate pointer parameter 'b' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'b' at the start of the function, e.g., 'if (!b) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 63,
"message": "Function 'luaZ_read' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 32,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 63,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 66,
"message": "Implicit boolean test on 'checkbuffer(z)'. May be unclear what constitutes success or failure.",
"rule_id": "EXP20-C",
"severity": "Medium",
"suggestion": "Use explicit test: checkbuffer(z) == 0 or checkbuffer(z) != 0 depending on success convention"
},
{
"column": 7,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 81,
"message": "Implicit boolean test on 'checkbuffer(z)'. May be unclear what constitutes success or failure.",
"rule_id": "EXP20-C",
"severity": "Medium",
"suggestion": "Use explicit test: checkbuffer(z) == 0 or checkbuffer(z) != 0 depending on success convention"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lzio.c",
"line": 88,
"message": "Function returns pointer to local variable 'res' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
}
],
"lzio.h": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 20,
"message": "Function-like macro 'zgetc' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 20,
"message": "Macro evaluates parameter 'z' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 29,
"message": "Function-like macro 'luaZ_initbuffer' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 29,
"message": "Macro evaluates parameter 'buff' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 39,
"message": "Function-like macro 'luaZ_resizebuffer' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 39,
"message": "Macro evaluates parameter 'buff' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 42,
"file": "/home/brandon/toolchain/lua/lzio.h",
"line": 49,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
}
]
}