Add the tokens signed and unsigned to the definition of a type.

This commit is contained in:
Lucas Mirelmann 2017-01-22 14:46:44 +01:00
parent b282a74fea
commit 15bebb3a53
2 changed files with 5 additions and 1 deletions

3
cpplint/cpplint.py vendored
View File

@ -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'::)+')

View File

@ -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.