OSDN Git Service

enum operator<<() script fails with do { } while cond;
authorBruce Hoult <b.hoult@samsung.com>
Mon, 12 Oct 2015 01:12:00 +0000 (10:12 +0900)
committerrandy.jeong <randy.jeong@samsung.com>
Wed, 21 Oct 2015 10:47:09 +0000 (19:47 +0900)
The script assumes that a line containing a '}' and a ';' will only
and always signal the end of a scope.
Unfortunately, this also matches '} while (myCond);',
thus incorrectly thinking it has reached the end of a scope.

This can result in enums being emitted without scope resolution
(or with insufficient scope resolution), cause compile errors.

Change-Id: I6e1b3453b941bff93ddd0b2a9fd3950182668728
Signed-off-by: randy.jeong <randy.jeong@samsung.com>
tools/generate-operator-out.py

index c74508d..3bd62fe 100755 (executable)
@@ -86,8 +86,10 @@ def ProcessFile(filename):
       if m:
         enclosing_classes.append(m.group(1))
         continue
-      m = re.compile(r'^\s*\}( .*)?;').search(raw_line)
-      if m:
+
+      # End of class/struct -- be careful not to match "do { ... } while" constructs by accident
+      m = re.compile(r'^\s*\}(\s+)?(while)?(.+)?;').search(raw_line)
+      if m and not m.group(2):
         enclosing_classes = enclosing_classes[0:len(enclosing_classes) - 1]
         continue