mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
build(clint): don't allow INIT() in non-header files (#27407)
This commit is contained in:
@@ -152,8 +152,10 @@ _ERROR_CATEGORIES = [
|
|||||||
'build/endif_comment',
|
'build/endif_comment',
|
||||||
'build/header_guard',
|
'build/header_guard',
|
||||||
'build/include_defs',
|
'build/include_defs',
|
||||||
|
'build/defs_header',
|
||||||
'build/printf_format',
|
'build/printf_format',
|
||||||
'build/storage_class',
|
'build/storage_class',
|
||||||
|
'build/init_macro',
|
||||||
'readability/bool',
|
'readability/bool',
|
||||||
'readability/multiline_comment',
|
'readability/multiline_comment',
|
||||||
'readability/multiline_string',
|
'readability/multiline_string',
|
||||||
@@ -2086,6 +2088,11 @@ def CheckLanguage(filename, clean_lines, linenum, error):
|
|||||||
" named ('k' followed by CamelCase) compile-time constant for"
|
" named ('k' followed by CamelCase) compile-time constant for"
|
||||||
" the size.")
|
" the size.")
|
||||||
|
|
||||||
|
# INIT() macro should only be used in header files.
|
||||||
|
if not filename.endswith('.h') and Search(r' INIT\(', line):
|
||||||
|
error(filename, linenum, 'build/init_macro', 4,
|
||||||
|
'INIT() macro should only be used in header files.')
|
||||||
|
|
||||||
# Detect TRUE and FALSE.
|
# Detect TRUE and FALSE.
|
||||||
match = Search(r'\b(TRUE|FALSE)\b', line)
|
match = Search(r'\b(TRUE|FALSE)\b', line)
|
||||||
if match:
|
if match:
|
||||||
|
@@ -55,8 +55,8 @@
|
|||||||
# include "sign.c.generated.h"
|
# include "sign.c.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PMap(cstr_t) sign_map INIT( = MAP_INIT);
|
static PMap(cstr_t) sign_map = MAP_INIT;
|
||||||
static kvec_t(Integer) sign_ns INIT( = MAP_INIT);
|
static kvec_t(Integer) sign_ns = KV_INITIAL_VALUE;
|
||||||
|
|
||||||
static char *cmds[] = {
|
static char *cmds[] = {
|
||||||
"define",
|
"define",
|
||||||
|
Reference in New Issue
Block a user