RESOLVED FIXED 221047
[GTK] return-type-c-linkage warnings
https://bugs.webkit.org/show_bug.cgi?id=221047
Summary [GTK] return-type-c-linkage warnings
Philippe Normand
Reported 2021-01-27 09:53:28 PST
When building with clang: In file included from ../../Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp:37: ../../Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.h:57:23: warning: 'webkitDirectoryInputStreamNew' has C-linkage specified, but returns user-defined type 'GRefPtr<GInputStream>' (aka 'GRefPtr<_GInputStream>') which is incompatible with C [-Wreturn-type-c-linkage] GRefPtr<GInputStream> webkitDirectoryInputStreamNew(GRefPtr<GFileEnumerator>&&, CString&& uri); ^ 1 warning generated. [6362/6762] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-10.cpp.o In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-10.cpp:1: In file included from ../../Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp:27: ../../Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.h:57:23: warning: 'webkitDirectoryInputStreamNew' has C-linkage specified, but returns incomplete type 'GRefPtr<GInputStream>' (aka 'GRefPtr<_GInputStream>') which could be incompatible with C [-Wreturn-type-c-linkage] GRefPtr<GInputStream> webkitDirectoryInputStreamNew(GRefPtr<GFileEnumerator>&&, CString&& uri); ^
Attachments
Patch (3.48 KB, patch)
2021-01-29 02:23 PST, Philippe Normand
no flags
Carlos Garcia Campos
Comment 1 2021-01-29 01:23:39 PST
I guess it's because of the G_BEGIN_DECLS. This is a private object that is always going to be used from C++ code, so I guess we can just remove the G_BEGIN_DECLS/G_END_DECLS. Could you try remove those to confirm that fixes the warning?
Philippe Normand
Comment 2 2021-01-29 01:59:20 PST
That's the fix indeed. Good guess!
Philippe Normand
Comment 3 2021-01-29 02:01:59 PST
(In reply to Philippe Normand from comment #2) > That's the fix indeed. Good guess! Hum, sorry false alarm. I still see the warning. I'll check it further.
Philippe Normand
Comment 4 2021-01-29 02:20:27 PST
Misread the output, the same issue appears in WebKitDirectoryInputStream.h, removing G_*_DECLS in both files is the way to go. Sending patch
Carlos Garcia Campos
Comment 5 2021-01-29 02:21:16 PST
(In reply to Philippe Normand from comment #3) > (In reply to Philippe Normand from comment #2) > > That's the fix indeed. Good guess! > > Hum, sorry false alarm. I still see the warning. I'll check it further. Maybe the one you are seeing now is from WebKitFormDataInputStream.h?
Philippe Normand
Comment 6 2021-01-29 02:23:09 PST
Carlos Garcia Campos
Comment 7 2021-01-29 02:31:14 PST
Comment on attachment 418713 [details] Patch Thanks!
EWS
Comment 8 2021-01-29 03:01:31 PST
Committed r272057: <https://trac.webkit.org/changeset/272057> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418713 [details].
Note You need to log in before you can comment on or make changes to this bug.