NEW 146677
Remove compile warning (missing-field-initializers)
https://bugs.webkit.org/show_bug.cgi?id=146677
Summary Remove compile warning (missing-field-initializers)
Hunseop Jeong
Reported 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]
Attachments
Patch (2.99 KB, patch)
2015-07-07 00:26 PDT, Hunseop Jeong
darin: review-
Hunseop Jeong
Comment 1 2015-07-07 00:26:51 PDT
Darin Adler
Comment 2 2015-07-08 19:27:41 PDT
Comment on attachment 256285 [details] Patch No, please don’t do this. Could you explain this warning?
Michael Catanzaro
Comment 3 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.
Hunseop Jeong
Comment 4 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.
Csaba Osztrogonác
Comment 5 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. :(
Hunseop Jeong
Comment 6 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?
Note You need to log in before you can comment on or make changes to this bug.