tools/nxstyle: skip mixed case check for particular headers

Add header keywords into whitelist, skip the warning if the
particular headers will contain the functions with mixed case

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-04-11 13:27:14 +08:00 committed by Petro Karashchenko
parent e9b5c25baf
commit 743d13c2b0

View File

@ -127,6 +127,7 @@ static int g_rangenumber = 0;
static int g_rangestart[RANGE_NUMBER];
static int g_rangecount[RANGE_NUMBER];
static char g_file_name[PATH_MAX];
static bool g_skipmixedcase;
static const struct file_section_s g_section_info[] =
{
@ -540,6 +541,12 @@ static const char *g_white_list[] =
NULL
};
static const char *g_white_headers[] =
{
"windows.h",
NULL
};
/********************************************************************************
* Private Functions
********************************************************************************/
@ -918,6 +925,16 @@ static bool white_list(const char *ident, int lineno)
}
}
for (pptr = g_white_headers;
(str = *pptr) != NULL;
pptr++)
{
if (strstr(ident, str) != NULL)
{
return true;
}
}
len2 = strlen(ident);
while (!isalnum(ident[len2 - 1]))
{
@ -1487,6 +1504,10 @@ int main(int argc, char **argv, char **envp)
"section",
lineno, ii);
}
else if (white_list(&line[ii], lineno))
{
g_skipmixedcase = true;
}
}
else if (strncmp(&line[ii], "if", 2) == 0)
{
@ -2023,7 +2044,8 @@ int main(int argc, char **argv, char **envp)
{
/* Ignore symbols that begin with white-listed prefixes */
if (white_list(&line[ident_index], lineno))
if (g_skipmixedcase ||
white_list(&line[ident_index], lineno))
{
/* No error */
}