mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
tools/nxstyle.c: Ignore inttypes.h constants.
Eliminate warnings. Ignore mixed case identifies beginning with PRIx. These most likely come from inttypes.h and we nxstyle must tolerate those definitions even though they do not follow the coding style.
This commit is contained in:
parent
5f7a797e89
commit
2483b65bfb
1 changed files with 23 additions and 12 deletions
|
|
@ -1265,27 +1265,38 @@ int main(int argc, char **argv, char **envp)
|
|||
|
||||
if (have_upper && have_lower)
|
||||
{
|
||||
/* REVISIT: Although pre-processor definitions are
|
||||
* supposed to be all upper-case, there are exceptions
|
||||
* such as using 'p' for a decimal point or 'MHz'.
|
||||
* Those will be reported here, but probably should be
|
||||
* considered false alarms.
|
||||
*/
|
||||
|
||||
/* Ignore inttype.h strings beginning with PRIx */
|
||||
|
||||
if (ident_index >= 4 &&
|
||||
(strncmp(&line[ident_index], "PRIx", 4) == 0))
|
||||
{
|
||||
/* No error */
|
||||
}
|
||||
|
||||
/* Special case hex constants. These will look like
|
||||
* identifiers starting with 'x' or 'X' but preceded
|
||||
* with '0'
|
||||
*/
|
||||
|
||||
if (ident_index < 1 ||
|
||||
(line[ident_index] != 'x' && line[ident_index] != 'X') ||
|
||||
line[ident_index - 1] != '0')
|
||||
else if (ident_index < 1 ||
|
||||
(line[ident_index] != 'x' &&
|
||||
line[ident_index] != 'X') ||
|
||||
line[ident_index - 1] != '0')
|
||||
{
|
||||
/* REVISIT: Although pre-processor definitions are
|
||||
* supposed to be all upper-case, there are exceptions
|
||||
* such as using 'p' for a decimal point or 'MHz'.
|
||||
* Those will be reported here, but probably should be
|
||||
* considered false alarms.
|
||||
*/
|
||||
|
||||
ERROR("Mixed case identifier found", lineno, ident_index);
|
||||
ERROR("Mixed case identifier found",
|
||||
lineno, ident_index);
|
||||
}
|
||||
else if (have_upper)
|
||||
{
|
||||
ERROR("Upper case hex constant found", lineno, ident_index);
|
||||
ERROR("Upper case hex constant found",
|
||||
lineno, ident_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue