Changeset 90717 in webkit


Ignore:
Timestamp:
Jul 10, 2011 10:19:51 PM (13 years ago)
Author:
Patrick Gansterer
Message:

Generate conditional include statements in CodeGeneratorJS
https://bugs.webkit.org/show_bug.cgi?id=64231

Reviewed by Brent Fulgham.

Suround headers with a correspondig #if ENABLE() line.
This allows us to generate bindings only of required IDL files.

Changing the current preprocessor statements to the Conditional attribute
in a next step helps in getting rid of calls to the preprocessor,
which causes so much pain on a natvie Windows environment.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):
(WriteData):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90709 r90717  
     12011-07-10  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Generate conditional include statements in CodeGeneratorJS
     4        https://bugs.webkit.org/show_bug.cgi?id=64231
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Suround headers with a correspondig #if ENABLE() line.
     9        This allows us to generate bindings only of required IDL files.
     10
     11        Changing the current preprocessor statements to the Conditional attribute
     12        in a next step helps in getting rid of calls to the preprocessor,
     13        which causes so much pain on a natvie Windows environment.
     14
     15        * bindings/scripts/CodeGeneratorJS.pm:
     16        (GenerateImplementation):
     17        (WriteData):
     18
    1192011-07-10  Patrick Gansterer  <paroga@webkit.org>
    220
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r90709 r90717  
    88# Copyright (C) Research In Motion Limited 2010. All rights reserved.
    99# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
     10# Copyright (C) 2011 Patrick Gansterer <paroga@webkit.org>
    1011#
    1112# This library is free software; you can redistribute it and/or
     
    17521753                            $constructorType =~ s/Constructor$//;
    17531754                            if ($constructorType ne "DOMObject") {
    1754                                 $implIncludes{"JS" . $constructorType . ".h"} = 1;
     1755                                my $header = "JS" . $constructorType . ".h";
     1756                                my $conditional = $attribute->signature->extendedAttributes->{"Conditional"};
     1757                                if (not $conditional) {
     1758                                    $implIncludes{$header} = 1;
     1759                                } elsif (not exists($implIncludes{$header})) {
     1760                                    $implIncludes{$header} = $conditional;
     1761                                } else {
     1762                                    my $oldValue = $implIncludes{$header};
     1763                                    if ($oldValue ne 1) {
     1764                                        my %newValue = ();
     1765                                        $newValue{$conditional} = 1;
     1766                                        foreach my $condition (split(/\|/, $oldValue)) {
     1767                                            $newValue{$condition} = 1;
     1768                                        }
     1769                                        $implIncludes{$header} = join("|", sort keys %newValue);
     1770                                    }
     1771                                }
    17551772                            }
    17561773                            push(@implContent, "    // Shadowing a built-in constructor\n");
     
    29272944
    29282945        my @includes = ();
     2946        my %implIncludeConditions = ();
    29292947        foreach my $include (keys %implIncludes) {
     2948            my $condition = $implIncludes{$include};
    29302949            my $checkType = $include;
    29312950            $checkType =~ s/\.h//;
     
    29332952
    29342953            $include = "\"$include\"" unless $include =~ /^["<]/; # "
    2935             push @includes, $include;
     2954
     2955            if ($condition eq 1) {
     2956                push @includes, $include;
     2957            } else {
     2958                push @{$implIncludeConditions{$condition}}, $include;
     2959            }
    29362960        }
    29372961        foreach my $include (sort @includes) {
    29382962            print $IMPL "#include $include\n";
     2963        }
     2964        foreach my $condition (sort keys %implIncludeConditions) {
     2965            print $IMPL "\n#if " . GenerateConditionalStringFromAttributeValue($condition) . "\n";
     2966            foreach my $include (sort @{$implIncludeConditions{$condition}}) {
     2967                print $IMPL "#include $include\n";
     2968            }
     2969            print $IMPL "#endif\n";
    29392970        }
    29402971
Note: See TracChangeset for help on using the changeset viewer.