Fixed linter bug where was thinking catch was a C style cast
The linter script has exceptions to exclude incorrect detection of C style casts. Added the keyword catch to this list. Added a regression test to verify this.
This commit is contained in:
parent
ddd871cf63
commit
50eac162ad
|
@ -0,0 +1,12 @@
|
|||
/*******************************************************************\
|
||||
|
||||
Module: Lint Examples
|
||||
|
||||
Author: Thomas Kiley, thomas@diffblue.com
|
||||
|
||||
\*******************************************************************/
|
||||
|
||||
static fun()
|
||||
{
|
||||
catch(int)
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
CORE
|
||||
main.cpp
|
||||
|
||||
^EXIT=0$
|
||||
^SIGNAL=0$
|
||||
--
|
|
@ -5270,7 +5270,7 @@ def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error):
|
|||
|
||||
# Exclude lines with keywords that tend to look like casts
|
||||
context = line[0:match.start(1) - 1]
|
||||
if Match(r'.*\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\s*$', context):
|
||||
if Match(r'.*\b(?:sizeof|alignof|alignas|catch|[_A-Z][_A-Z0-9]*)\s*$', context):
|
||||
return False
|
||||
|
||||
# Try expanding current context to see if we one level of
|
||||
|
|
Loading…
Reference in New Issue