Bug 121877 - generate-message-receiver.py can't handle nested #ifs
Summary: generate-message-receiver.py can't handle nested #ifs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gergő Balogh
URL:
Keywords:
Depends on:
Blocks: 121818 124147
  Show dependency treegraph
 
Reported: 2013-09-24 16:14 PDT by Csaba Osztrogonác
Modified: 2013-11-14 14:17 PST (History)
10 users (show)

See Also:


Attachments
generated cpp with nested ifdefs (7.55 KB, text/plain)
2013-09-24 16:21 PDT, Csaba Osztrogonác
no flags Details
generated cpp without nested ifdefs (8.01 KB, text/plain)
2013-09-24 16:22 PDT, Csaba Osztrogonác
no flags Details
Patch (1.79 KB, patch)
2013-09-25 02:36 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
workaround (1.70 KB, patch)
2013-09-25 04:53 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
patch (11.78 KB, patch)
2013-10-18 05:39 PDT, Gergő Balogh
no flags Details | Formatted Diff | Diff
patch (11.78 KB, patch)
2013-10-18 05:51 PDT, Gergő Balogh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2013-09-24 16:14:58 PDT
http://trac.webkit.org/changeset/156350 revealed that generate-message-receiver.py 
script can't handle nested ifdefs properly and it broke the non Mac builds.
Comment 1 Csaba Osztrogonác 2013-09-24 16:21:48 PDT
Created attachment 212516 [details]
generated cpp with nested ifdefs
Comment 2 Csaba Osztrogonác 2013-09-24 16:22:23 PDT
Created attachment 212517 [details]
generated cpp without nested ifdefs
Comment 3 Csaba Osztrogonác 2013-09-24 16:23:29 PDT
and the change caused this problem - http://trac.webkit.org/changeset/156350/trunk/Source/WebKit2/UIProcess/WebContext.messages.in
Comment 4 Csaba Osztrogonác 2013-09-25 02:36:08 PDT
Created attachment 212547 [details]
Patch

workaround to avoid adding nested #ifs until proper fix
Comment 5 Peter Gal 2013-09-25 03:41:02 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=212547&action=review

> Source/WebKit2/Scripts/webkit2/parser.py:51
> +                    sys.stderr.write('ERROR: Nested #ifs aren\'t supported, please fix %s\n' % file.name)

You can mix ' and " together then you don't need to escape the ' (use " for the string start and end)

> Source/WebKit2/Scripts/webkit2/parser.py:52
> +                    os._exit(1)

The standard way to exit is sys.exit(n) as dictated by the python documentation.
Comment 6 Csaba Osztrogonác 2013-09-25 04:53:23 PDT
Created attachment 212553 [details]
workaround

updated patch based on Peter's review
Comment 7 Peter Gal 2013-09-25 04:57:15 PDT
(In reply to comment #6)
> Created an attachment (id=212553) [details]
> workaround
> 
> updated patch based on Peter's review

LGTM (BTW: Much better isn't? :))
Comment 8 Csaba Osztrogonác 2013-10-10 10:05:57 PDT
Is there any objection against adding this guard 
to avoid adding nested #ifs until proper fix?
Comment 9 Csaba Osztrogonác 2013-10-10 13:00:44 PDT
Comment on attachment 212553 [details]
workaround

Clearing flags on attachment: 212553

Committed r157243: <http://trac.webkit.org/changeset/157243>
Comment 10 Gergő Balogh 2013-10-18 05:39:16 PDT
Created attachment 214558 [details]
patch
Comment 11 WebKit Commit Bot 2013-10-18 05:41:23 PDT
Attachment 214558 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/Scripts/webkit2/messages_unittest.py', u'Source/WebKit2/Scripts/webkit2/parser.py']" exit_code: 1
Source/WebKit2/ChangeLog:9:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Gergő Balogh 2013-10-18 05:51:13 PDT
Created attachment 214559 [details]
patch
Comment 13 Peter Gal 2013-11-07 00:54:51 PST
(In reply to comment #12)
> Created an attachment (id=214559) [details]
> patch

I think this would be really good to have. I've seen other bug reports where they expected to have nested #if-s
Comment 14 Alexey Proskuryakov 2013-11-07 09:16:05 PST
Certainly a good thing, just needs someone to review the code.
Comment 15 Csaba Osztrogonác 2013-11-12 08:48:39 PST
Is there a brave WK2 owner somewhere for reviewing this patch? :)
Comment 16 WebKit Commit Bot 2013-11-14 14:17:53 PST
Comment on attachment 214559 [details]
patch

Clearing flags on attachment: 214559

Committed r159312: <http://trac.webkit.org/changeset/159312>
Comment 17 WebKit Commit Bot 2013-11-14 14:17:56 PST
All reviewed patches have been landed.  Closing bug.