Title: [160161] trunk/Source/WebKit2
Revision
160161
Author
commit-qu...@webkit.org
Date
2013-12-04 23:41:26 -0800 (Wed, 04 Dec 2013)

Log Message

Report error when #else is used in message receiver generator's input.
https://bugs.webkit.org/show_bug.cgi?id=124147

Patch by Gergo Balogh <gery...@inf.u-szeged.hu> on 2013-12-04
Reviewed by Csaba Osztrogonác.

* Scripts/webkit2/messages_unittest.py:
(UnsupportedPrecompilerDirectiveTest):
(UnsupportedPrecompilerDirectiveTest.test_error_at_else):
(UnsupportedPrecompilerDirectiveTest.test_error_at_elif):
* Scripts/webkit2/parser.py:
(parse):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (160160 => 160161)


--- trunk/Source/WebKit2/ChangeLog	2013-12-05 06:44:39 UTC (rev 160160)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-05 07:41:26 UTC (rev 160161)
@@ -1,3 +1,17 @@
+2013-12-04  Gergo Balogh  <gery...@inf.u-szeged.hu>
+
+        Report error when #else is used in message receiver generator's input.
+        https://bugs.webkit.org/show_bug.cgi?id=124147
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Scripts/webkit2/messages_unittest.py:
+        (UnsupportedPrecompilerDirectiveTest):
+        (UnsupportedPrecompilerDirectiveTest.test_error_at_else):
+        (UnsupportedPrecompilerDirectiveTest.test_error_at_elif):
+        * Scripts/webkit2/parser.py:
+        (parse):
+
 2013-12-04  Sam Weinig  <s...@webkit.org>
 
         [Cocoa] Make WKConnection work with WKObject wrapping

Modified: trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py (160160 => 160161)


--- trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py	2013-12-05 06:44:39 UTC (rev 160160)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py	2013-12-05 07:41:26 UTC (rev 160161)
@@ -1126,5 +1126,15 @@
         self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_implementation)
 
 
+class UnsupportedPrecompilerDirectiveTest(unittest.TestCase):
+    def test_error_at_else(self):
+        with self.assertRaisesRegexp(Exception, r"ERROR: '#else.*' is not supported in the \*\.in files"):
+            messages.generate_message_handler(StringIO("asd\n#else bla\nfoo"))
+
+    def test_error_at_elif(self):
+        with self.assertRaisesRegexp(Exception, r"ERROR: '#elif.*' is not supported in the \*\.in files"):
+            messages.generate_message_handler(StringIO("asd\n#elif bla\nfoo"))
+
+
 if __name__ == '__main__':
     unittest.main()

Modified: trunk/Source/WebKit2/Scripts/webkit2/parser.py (160160 => 160161)


--- trunk/Source/WebKit2/Scripts/webkit2/parser.py	2013-12-05 06:44:39 UTC (rev 160160)
+++ trunk/Source/WebKit2/Scripts/webkit2/parser.py	2013-12-05 07:41:26 UTC (rev 160161)
@@ -59,10 +59,13 @@
             destination = match.group('destination')
             continue
         if line.startswith('#'):
+            trimmed = line.rstrip()
             if line.startswith('#if '):
-                conditions.append(line.rstrip()[4:])
+                conditions.append(trimmed[4:])
             elif line.startswith('#endif') and conditions:
                 conditions.pop()
+            elif line.startswith('#else') or line.startswith('#elif'):
+                raise Exception("ERROR: '%s' is not supported in the *.in files" % trimmed)
             continue
         match = re.search(r'([A-Za-z_0-9]+)\((.*?)\)(?:(?:\s+->\s+)\((.*?)\))?(?:\s+(.*))?', line)
         if match:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to