translate unicode quotes to ascii ones so we can keep our regex simple
authorMike Frysinger <vapier@gentoo.org>
Sun, 28 Jan 2007 10:53:37 +0000 (10:53 -0000)
committerMike Frysinger <vapier@gentoo.org>
Sun, 28 Jan 2007 10:53:37 +0000 (10:53 -0000)
svn path=/main/trunk/; revision=5804

bin/check-implicit-pointer-usage.py

index 948bc675e2b015732f5fe855aeacd0627599f6c4..1648dc53d59c3c558dc3f63e9380bc6cdcbf66bf 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-# coding: iso-8859-15
 
 # Ripped from HP and updated from Debian
 # Update by Gentoo to support unicode output
@@ -18,14 +17,14 @@ import re
 import sys
 
 implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
-                              + "of function [`'‘]+([^'‘]*)['‘]")
+                              + "of function `([^']*)'")
 pointer_pattern = re.compile(
     "([^:]*):(\d+): warning: "
     + "("
     +  "(assignment"
     +  "|initialization"
     +  "|return"
-    +  "|passing arg \d+ of [`'‘][^'‘]*['‘]"
+    +  "|passing arg \d+ of `[^']*'"
     +  "|passing arg \d+ of pointer to function"
     +  ") makes pointer from integer without a cast"
     + "|"
@@ -38,6 +37,8 @@ while True:
     line = sys.stdin.readline()
     if line == '':
         break
+    # translate unicode open/close quotes to ascii ones
+    line = line.replace("\xE2\x80\x98", "`").replace("\xE2\x80\x99", "'")
     m = implicit_pattern.match(line)
     if m:
         last_implicit_filename = m.group(1)