summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2011-09-28 18:32:59 +0000
committervladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2011-09-28 18:32:59 +0000
commit3733f7a9ea309924aa49c071ec8c268c9042dc2c (patch)
tree210bd9368ad31d1c528a80a019fee8a86e9e2ea6
parent0f1f241801c34cdb535e50b3f6b343f288e38e4d (diff)
downloadgooglemock-3733f7a9ea309924aa49c071ec8c268c9042dc2c.tar.gz
Modifies gmock_doctor.py to work with GCC output that contains file:line:char positions and left and right quote characters (U+2018 and U+2019) instead of apostrophes (U+0027).
git-svn-id: http://googlemock.googlecode.com/svn/trunk@399 8415998a-534a-0410-bf83-d39667b30386
-rwxr-xr-xscripts/gmock_doctor.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/gmock_doctor.py b/scripts/gmock_doctor.py
index ea930a3..4cfd149 100755
--- a/scripts/gmock_doctor.py
+++ b/scripts/gmock_doctor.py
@@ -128,7 +128,7 @@ _COMMON_GMOCK_SYMBOLS = [
]
# Regex for matching source file path and line number in the compiler's errors.
-_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):\s+'
+_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(\d+:)?\s+'
_CLANG_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(?P<column>\d+):\s+'
_CLANG_NON_GMOCK_FILE_LINE_RE = (
r'(?P<file>.*[/\\^](?!gmock-)[^/\\]+):(?P<line>\d+):(?P<column>\d+):\s+')
@@ -559,6 +559,9 @@ def Diagnose(msg):
"""Generates all possible diagnoses given the compiler error message."""
msg = re.sub(r'\x1b\[[^m]*m', '', msg) # Strips all color formatting.
+ # Assuming the string is using the UTF-8 encoding, replaces the left and
+ # the right single quote characters with apostrophes.
+ msg = re.sub(r'(\xe2\x80\x98|\xe2\x80\x99)', "'", msg)
diagnoses = []
for diagnoser in _DIAGNOSERS: