mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Add the tokens signed
and unsigned
to the definition of a type.
This commit is contained in:
parent
b282a74fea
commit
15bebb3a53
3
cpplint/cpplint.py
vendored
3
cpplint/cpplint.py
vendored
|
@ -4588,7 +4588,8 @@ def _GetTextInside(text, start_pattern):
|
||||||
# >
|
# >
|
||||||
_RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]*
|
_RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]*
|
||||||
_RE_PATTERN_TYPE = (
|
_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'(?:\w|'
|
||||||
r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|'
|
r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|'
|
||||||
r'::)+')
|
r'::)+')
|
||||||
|
|
|
@ -2203,6 +2203,9 @@ class CpplintTest(CpplintTestBase):
|
||||||
self.TestLint('istringstream& LogFunc(istringstream& s);', '')
|
self.TestLint('istringstream& LogFunc(istringstream& s);', '')
|
||||||
# Returning a non-const reference from a function is OK.
|
# Returning a non-const reference from a function is OK.
|
||||||
self.TestLint('int& g();', '')
|
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.
|
# Passing a const reference to a struct (using the struct keyword) is OK.
|
||||||
self.TestLint('void foo(const struct tm& tm);', '')
|
self.TestLint('void foo(const struct tm& tm);', '')
|
||||||
# Passing a const reference to a typename is OK.
|
# Passing a const reference to a typename is OK.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user