From 0fd839682765307c49f9aa67b5c168e3d30bc356 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Wed, 28 Sep 2011 18:32:59 +0000 Subject: [PATCH] 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). --- scripts/gmock_doctor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/gmock_doctor.py b/scripts/gmock_doctor.py index ea930a38..4cfd1493 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.*):(?P\d+):\s+' +_GCC_FILE_LINE_RE = r'(?P.*):(?P\d+):(\d+:)?\s+' _CLANG_FILE_LINE_RE = r'(?P.*):(?P\d+):(?P\d+):\s+' _CLANG_NON_GMOCK_FILE_LINE_RE = ( r'(?P.*[/\\^](?!gmock-)[^/\\]+):(?P\d+):(?P\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: