aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-01-27 22:28:45 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-01-27 22:28:45 +0000
commit5b95fa7b16023c1e1ab0b00f7ce73a2d46a95911 (patch)
treeacd069ab567d32a1b08eb798d0d491d9a85246f7 /scripts
parent6a896b5ec607a54d86bbd2efdbc0248754b042e1 (diff)
downloadgoogletest-5b95fa7b16023c1e1ab0b00f7ce73a2d46a95911.tar.gz
googletest-5b95fa7b16023c1e1ab0b00f7ce73a2d46a95911.tar.bz2
googletest-5b95fa7b16023c1e1ab0b00f7ce73a2d46a95911.zip
Improves error messages for undefined return value (by Sverre Sundsdal); improves gmock_doctor.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gmock_doctor.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/gmock_doctor.py b/scripts/gmock_doctor.py
index ce8ec498..ca7935ca 100755
--- a/scripts/gmock_doctor.py
+++ b/scripts/gmock_doctor.py
@@ -55,6 +55,7 @@ _COMMON_GMOCK_SYMBOLS = [
'Ge',
'Gt',
'HasSubstr',
+ 'IsInitializedProto',
'Le',
'Lt',
'MatcherCast',
@@ -63,6 +64,7 @@ _COMMON_GMOCK_SYMBOLS = [
'Not',
'NotNull',
'Pointee',
+ 'PointeeIsInitializedProto',
'Property',
'Ref',
'StartsWith',
@@ -307,12 +309,29 @@ Did you forget to write
yield ('NUS', 'Need to Use Symbol', diagnosis % m.groupdict())
+def _NeedToUseReturnNullDiagnoser(msg):
+ """Diagnoses the NRNULL disease, given the error messages by gcc."""
+
+ regex = (r'(?P<file>.*):(?P<line>\d+):\s+instantiated from here\n'
+ r'.*gmock-actions\.h.*error: invalid conversion from '
+ r'\'long int\' to \'(?P<type>.+\*)')
+
+ diagnosis = """%(file)s:%(line)s:
+You are probably calling Return(NULL) and the compiler isn't sure how to turn
+NULL into a %(type)s*. Use ReturnNull() instead.
+Note: the line number may be off; please fix all instances of Return(NULL)."""
+ return _GenericDiagnoser('NRNULL', 'Need to use ReturnNull',
+ regex, diagnosis, msg)
+
+
+
_DIAGNOSERS = [
_IncompleteByReferenceArgumentDiagnoser,
_MockObjectPointerDiagnoser,
_NeedToReturnNothingDiagnoser,
_NeedToReturnReferenceDiagnoser,
_NeedToReturnSomethingDiagnoser,
+ _NeedToUseReturnNullDiagnoser,
_NeedToUseSymbolDiagnoser,
_OverloadedFunctionActionDiagnoser,
_OverloadedFunctionMatcherDiagnoser,