From 15bebb3a53502dbf58fcf785c5c72806d3ed6efb Mon Sep 17 00:00:00 2001 From: Lucas Mirelmann Date: Sun, 22 Jan 2017 14:46:44 +0100 Subject: [PATCH] Add the tokens `signed` and `unsigned` to the definition of a type. --- cpplint/cpplint.py | 3 ++- cpplint/cpplint_unittest.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index 3366b39..df7342f 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -4588,7 +4588,8 @@ def _GetTextInside(text, start_pattern): # > _RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]* _RE_PATTERN_TYPE = ( - r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+)?' + r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+' + r'|signed\s+|unsigned\s+)?' r'(?:\w|' r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|' r'::)+') diff --git a/cpplint/cpplint_unittest.py b/cpplint/cpplint_unittest.py index b8b8319..922a8f2 100755 --- a/cpplint/cpplint_unittest.py +++ b/cpplint/cpplint_unittest.py @@ -2203,6 +2203,9 @@ class CpplintTest(CpplintTestBase): self.TestLint('istringstream& LogFunc(istringstream& s);', '') # Returning a non-const reference from a function is OK. self.TestLint('int& g();', '') + # Passing signed or unsigned const references is OK. + self.TestLint('void foo(const unsigned int& bar);', ''); + self.TestLint('void foo(const signed int& bar);', ''); # Passing a const reference to a struct (using the struct keyword) is OK. self.TestLint('void foo(const struct tm& tm);', '') # Passing a const reference to a typename is OK.