Changeset 207576 in webkit


Ignore:
Timestamp:
Oct 19, 2016 4:34:45 PM (8 years ago)
Author:
jfbastien@apple.com
Message:

create_hash_table: allow empty tables

The Windows build was broken by because I added empty tables and Windows insists that empty tables are horrible. Put in dummy entries in that case.

create_hash_table: allow empty tables
https://bugs.webkit.org/show_bug.cgi?id=163701

Reviewed by Keith Miller.

  • create_hash_table:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r207572 r207576  
     12016-10-19  JF Bastien  <jfbastien@apple.com>
     2
     3        create_hash_table: allow empty tables
     4
     5        The Windows build was broken by because I added empty tables and Windows insists that empty tables are horrible. Put in dummy entries in that case.
     6
     7        create_hash_table: allow empty tables
     8        https://bugs.webkit.org/show_bug.cgi?id=163701
     9
     10        Reviewed by Keith Miller.
     11
     12        * create_hash_table:
     13
    1142016-10-19  JF Bastien  <jfbastien@apple.com>
    215
  • trunk/Source/JavaScriptCore/create_hash_table

    r200430 r207576  
    271271    print "namespace JSC {\n";
    272272    print "\n";
    273     print "static const struct CompactHashIndex ${nameIndex}\[$compactSize\] = {\n";
    274     for (my $i = 0; $i < $compactSize; $i++) {
    275         my $T = -1;
    276         if (defined($table[$i])) { $T = $table[$i]; }
    277         my $L = -1;
    278         if (defined($links[$i])) { $L = $links[$i]; }
    279         print "    { $T, $L },\n";
     273    if ($compactSize != 0) {
     274        print "static const struct CompactHashIndex ${nameIndex}\[$compactSize\] = {\n";
     275        for (my $i = 0; $i < $compactSize; $i++) {
     276            my $T = -1;
     277            if (defined($table[$i])) { $T = $table[$i]; }
     278            my $L = -1;
     279            if (defined($links[$i])) { $L = $links[$i]; }
     280            print "    { $T, $L },\n";
     281        }
     282    } else {
     283        # MSVC dislikes empty arrays.
     284        print "static const struct CompactHashIndex ${nameIndex}\[1\] = {\n";
     285        print "    { 0, 0 }\n";
    280286    }
    281287    print "};\n";
     
    283289
    284290    my $packedSize = scalar @keys;
    285     print "static const struct HashTableValue ${nameEntries}\[$packedSize\] = {\n";
     291    if ($packedSize != 0) {
     292        print "static const struct HashTableValue ${nameEntries}\[$packedSize\] = {\n";
     293    } else {
     294        # MSVC dislikes empty arrays.
     295        print "static const struct HashTableValue ${nameEntries}\[1\] = {\n";
     296        print "    { nullptr, 0, NoIntrinsic, { 0, 0 } }\n";
     297    }
    286298    my $i = 0;
    287299    foreach my $key (@keys) {
Note: See TracChangeset for help on using the changeset viewer.