summaryrefslogtreecommitdiff
path: root/scripts/gmock_doctor.py
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
commit615abee9a19479b8893398b51b18fb27ef53a11b (patch)
treeacd069ab567d32a1b08eb798d0d491d9a85246f7 /scripts/gmock_doctor.py
parentfcc494cff0ae711df8c7209ef1fadda243ed81e8 (diff)
downloadgooglemock-615abee9a19479b8893398b51b18fb27ef53a11b.tar.gz
Improves error messages for undefined return value (by Sverre Sundsdal); improves gmock_doctor.
git-svn-id: http://googlemock.googlecode.com/svn/trunk@88 8415998a-534a-0410-bf83-d39667b30386
Diffstat (limited to 'scripts/gmock_doctor.py')
-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 ce8ec49..ca7935c 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,