Bug 146677 - Remove compile warning (missing-field-initializers)
Summary: Remove compile warning (missing-field-initializers)
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hunseop Jeong
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-07 00:22 PDT by Hunseop Jeong
Modified: 2017-03-11 11:02 PST (History)
6 users (show)

See Also:


Attachments
Patch (2.99 KB, patch)
2015-07-07 00:26 PDT, Hunseop Jeong
darin: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hunseop Jeong 2015-07-07 00:22:11 PDT
Many compile warning occurred in ENABLE(NETWORK_CACHE).

../../Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h:87:45: warning: missing initializer for member 'WebKit::NetworkCache::Storage::Record::key' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h:87:45: warning: missing initializer for member 'WebKit::NetworkCache::Storage::Record::timeStamp' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h:87:45: warning: missing initializer for member 'WebKit::NetworkCache::Storage::Record::header' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h:87:45: warning: missing initializer for member 'WebKit::NetworkCache::Storage::Record::body' [-Wmissing-field-initializers]

../../Source/WebKit2/NetworkProcess/cache/NetworkCacheBlobStorage.cpp:109:18: warning: missing initializer for member 'WebKit::NetworkCache::BlobStorage::Blob::data' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheBlobStorage.cpp:109:18: warning: missing initializer for member 'WebKit::NetworkCache::BlobStorage::Blob::hash' [-Wmissing-field-initializers]

../../Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.cpp:107:18: warning: missing initializer for member 'WebKit::NetworkCache::FileTimes::creation' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.cpp:107:18: warning: missing initializer for member 'WebKit::NetworkCache::FileTimes::modification' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.cpp:110:18: warning: missing initializer for member 'WebKit::NetworkCache::FileTimes::creation' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.cpp:110:18: warning: missing initializer for member 'WebKit::NetworkCache::FileTimes::modification' [-Wmissing-field-initializers]

../../Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:763:51: warning: missing initializer for member 'WebKit::NetworkCache::Storage::RecordInfo::bodySize' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:763:51: warning: missing initializer for member 'WebKit::NetworkCache::Storage::RecordInfo::worth' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:763:51: warning: missing initializer for member 'WebKit::NetworkCache::Storage::RecordInfo::bodyShareCount' [-Wmissing-field-initializers]
../../Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:763:51: warning: missing initializer for member 'WebKit::NetworkCache::Storage::RecordInfo::bodyHash' [-Wmissing-field-initializers]
Comment 1 Hunseop Jeong 2015-07-07 00:26:51 PDT
Created attachment 256285 [details]
Patch
Comment 2 Darin Adler 2015-07-08 19:27:41 PDT
Comment on attachment 256285 [details]
Patch

No, please don’t do this. Could you explain this warning?
Comment 3 Michael Catanzaro 2015-07-08 20:10:37 PDT
       -Wmissing-field-initializers
           Warn if a structure's initializer has some fields missing.  For
           example, the following code causes such a warning, because "x.h" is
           implicitly zero:

                   struct s { int f, g, h; };
                   struct s x = { 3, 4 };

           This option does not warn about designated initializers, so the
           following modification does not trigger a warning:

                   struct s { int f, g, h; };
                   struct s x = { .f = 3, .g = 4 };

           In C++ this option does not warn either about the empty { }
           initializer, for example:

                   struct s { int f, g, h; };
                   s x = { };

           This warning is included in -Wextra.  To get other -Wextra warnings
           without this one, use -Wextra -Wno-missing-field-initializers.

But a quick check of NetworkCacheBlobStorage.cpp and NetworkCacheFileSystem.cpp shows that it's warning about { } even though it says it should not. That's odd.
Comment 4 Hunseop Jeong 2015-07-08 21:00:26 PDT
I got this warnings when compiling the webkitgtk+ port.
gtk+ didn't use the -Wno-missing-field-initializers options.

According to comment of Michael Catanzaro, { } does not warn in C++. That's odd.

I use the ubuntu 15.04.
Comment 5 Csaba Osztrogonác 2015-12-02 06:10:24 PST
(In reply to comment #3)
 
>            In C++ this option does not warn either about the empty { }
>            initializer, for example:
> 
>                    struct s { int f, g, h; };
>                    s x = { };
> 
>            This warning is included in -Wextra.  To get other -Wextra
> warnings
>            without this one, use -Wextra -Wno-missing-field-initializers.
> 
> But a quick check of NetworkCacheBlobStorage.cpp and
> NetworkCacheFileSystem.cpp shows that it's warning about { } even though it
> says it should not. That's odd.

Unfortunately it is a GCC 5 only feature. 
GCC 4.9 still complains with empty initializers. :(
Comment 6 Hunseop Jeong 2015-12-02 22:01:51 PST
(In reply to comment #5)
> (In reply to comment #3)
>  
> >            In C++ this option does not warn either about the empty { }
> >            initializer, for example:
> > 
> >                    struct s { int f, g, h; };
> >                    s x = { };
> > 
> >            This warning is included in -Wextra.  To get other -Wextra
> > warnings
> >            without this one, use -Wextra -Wno-missing-field-initializers.
> > 
> > But a quick check of NetworkCacheBlobStorage.cpp and
> > NetworkCacheFileSystem.cpp shows that it's warning about { } even though it
> > says it should not. That's odd.
> 
> Unfortunately it is a GCC 5 only feature. 
> GCC 4.9 still complains with empty initializers. :(

I tried to build with NETWORK_CACHE but build error was occurred by this warning in EFL. Do we wait for ubuntu 15.10?