Bug 83212

Summary: [CSS] Make makevalues.pl and makeprop.pl ignore '#'s.
Product: WebKit Reporter: Raphael Kubo da Costa (:rakuco) <rakuco>
Component: Tools / TestsAssignee: Raphael Kubo da Costa (:rakuco) <rakuco>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, darin, eric, macpherson, menard, rniwa, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Raphael Kubo da Costa (:rakuco) 2012-04-04 13:58:43 PDT
[CSS] Make makevalues.pl and makeprop.pl ignore '#'s.
Comment 1 Raphael Kubo da Costa (:rakuco) 2012-04-04 14:03:29 PDT
Created attachment 135673 [details]
Patch
Comment 2 Tony Chang 2012-04-04 14:21:21 PDT
By this point, haven't we already run the .in files through the preprocessor and the preprocessor already handled the lines beginning with # (e.g., #if/#endif).  What's an example of a line starting with # that makes it through the preprocessor?
Comment 3 Raphael Kubo da Costa (:rakuco) 2012-04-04 14:26:53 PDT
(In reply to comment #2)
> What's an example of a line starting with # that makes it through the preprocessor?

The ones produced by the preprocessor when -P is not passed to it:

# 1 "/home/rakuco/dev/webkit/WebKit/Source/WebCore/html/HTMLTagNames.in"
# 1 "<command-line>"
# 1 "/home/rakuco/dev/webkit/WebKit/Source/WebCore/html/HTMLTagNames.in"

etc
Comment 4 Raphael Kubo da Costa (:rakuco) 2012-04-04 14:38:42 PDT
Just in case I wasn't clear enough: this patch is a side-effect of my intentions to make the CMake-based ports work with GCC 4.7 without changing the parameters currently passed to the preprocessor. "-P" is always being passed to the preprocessor, but this breaks dom/make_names.pl due to GCC not outputting empty lines with "-P" anymore; if I switch to never passing "-P" (my aim), the CSS scripts currently break because of the additional lines output by the preprocessor.
Comment 5 Tony Chang 2012-04-04 14:43:54 PDT
I see, your plan is to remove -P in preprocessor.pm because -P causes you to lose empty lines which are needed by make_names.pl and InFilesParser.pm.  This wasn't clear to me in the ChangeLog description.

Would it be possible to have applyPreprocessor take a flag for whether it wants -P or not?  Or more generally, maybe applyPreprocessor can take an optional argument that is flags to pass to gcc.  If the argument is omitted, it adds "-E -P -x c++".
Comment 6 Raphael Kubo da Costa (:rakuco) 2012-04-04 14:46:44 PDT
(In reply to comment #5)
> I see, your plan is to remove -P in preprocessor.pm because -P causes you to lose empty lines which are needed by make_names.pl and InFilesParser.pm.  This wasn't clear to me in the ChangeLog description.
> 
> Would it be possible to have applyPreprocessor take a flag for whether it wants -P or not?  Or more generally, maybe applyPreprocessor can take an optional argument that is flags to pass to gcc.  If the argument is omitted, it adds "-E -P -x c++".

Actually, my plan is to remote -P from Source/cmake/OptionsCommon.cmake; the CMake-based ports always pass --preprocessor to the scripts, so the defaults aren't used.
Comment 7 Raphael Kubo da Costa (:rakuco) 2012-04-04 14:46:52 PDT
s/remote/remove/
Comment 8 Tony Chang 2012-04-04 14:56:03 PDT
Comment on attachment 135673 [details]
Patch

Ok, seems fine.  I would rewrite the ChangeLog to be what you said in comment #4.
Comment 9 Raphael Kubo da Costa (:rakuco) 2012-04-04 15:04:33 PDT
Created attachment 135692 [details]
Patch for landing
Comment 10 Raphael Kubo da Costa (:rakuco) 2012-04-04 15:06:51 PDT
Committed r113244: <http://trac.webkit.org/changeset/113244>