Bug 221047 - [GTK] return-type-c-linkage warnings
Summary: [GTK] return-type-c-linkage warnings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-27 09:53 PST by Philippe Normand
Modified: 2021-01-29 03:01 PST (History)
5 users (show)

See Also:


Attachments
Patch (3.48 KB, patch)
2021-01-29 02:23 PST, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 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);
                      ^
Comment 1 Carlos Garcia Campos 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?
Comment 2 Philippe Normand 2021-01-29 01:59:20 PST
That's the fix indeed. Good guess!
Comment 3 Philippe Normand 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.
Comment 4 Philippe Normand 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
Comment 5 Carlos Garcia Campos 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?
Comment 6 Philippe Normand 2021-01-29 02:23:09 PST
Created attachment 418713 [details]
Patch
Comment 7 Carlos Garcia Campos 2021-01-29 02:31:14 PST
Comment on attachment 418713 [details]
Patch

Thanks!
Comment 8 EWS 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].