diff --git a/regression/cpp-linter/catch-cast/main.cpp b/regression/cpp-linter/catch-cast/main.cpp new file mode 100644 index 0000000000..204d83f935 --- /dev/null +++ b/regression/cpp-linter/catch-cast/main.cpp @@ -0,0 +1,12 @@ +/*******************************************************************\ + +Module: Lint Examples + +Author: Thomas Kiley, thomas@diffblue.com + +\*******************************************************************/ + +static fun() +{ + catch(int) +} diff --git a/regression/cpp-linter/catch-cast/test.desc b/regression/cpp-linter/catch-cast/test.desc new file mode 100644 index 0000000000..63fbf20a5e --- /dev/null +++ b/regression/cpp-linter/catch-cast/test.desc @@ -0,0 +1,6 @@ +CORE +main.cpp + +^EXIT=0$ +^SIGNAL=0$ +-- diff --git a/scripts/cpplint.py b/scripts/cpplint.py index 48f3ef41a4..ac9f687a48 100644 --- a/scripts/cpplint.py +++ b/scripts/cpplint.py @@ -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