Bug 174392 - [SOUP] Do not use C linkage for functions using C++ features
Summary: [SOUP] Do not use C linkage for functions using C++ features
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-11 14:28 PDT by Adrian Perez
Modified: 2017-07-12 03:12 PDT (History)
9 users (show)

See Also:


Attachments
Patch (1.84 KB, patch)
2017-07-11 14:33 PDT, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (1.81 KB, patch)
2017-07-12 03:11 PDT, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2017-07-11 14:28:18 PDT
Building with Clang emits the following warning:

  In file included from ../../Source/WebKit2/NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:33:
  In file included from DerivedSources/ForwardingHeaders/WebCore/WebKitSoupRequestGeneric.h:1:                                                                  
  Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h:61:33:
     warning: 'webkitSoupRequestGenericGetRequest' has C-linkage specified, but returns user-defined
     type 'const WebCore::ResourceRequest &' which is incompatible with C [-Wreturn-type-c-linkage]                                                   
  const WebCore::ResourceRequest& webkitSoupRequestGenericGetRequest(WebKitSoupRequestGeneric*);
                                ^

I'll be uploading a patch for this momentarily.
Comment 1 Adrian Perez 2017-07-11 14:33:13 PDT
Created attachment 315169 [details]
Patch
Comment 2 Michael Catanzaro 2017-07-11 15:28:28 PDT
Comment on attachment 315169 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=315169&action=review

That's a good warning. Why can't GCC do that?

> Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h:61
> +// The following functions used from C++ only, they should be outside
> +// of the G_BEGIN_DECLS/G_END_DECLS block.

This should be obvious to anyone familiar with the intended use of G_BEGIN_DECLS and G_END_DECLS, and it's a pattern we'll need to follow in many private GObject header files wherever references are used in function signatures, so I would remove the comment.
Comment 3 Adrian Perez 2017-07-12 03:03:44 PDT
(In reply to Michael Catanzaro from comment #2)
> Comment on attachment 315169 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315169&action=review
> 
> That's a good warning. Why can't GCC do that?

GCC does not have -Wreturn-type-c-linkage. It does have -Wreturn-type
but it does not warn in this particular case :-/
 

> > Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h:61
> > +// The following functions used from C++ only, they should be outside
> > +// of the G_BEGIN_DECLS/G_END_DECLS block.
> 
> This should be obvious to anyone familiar with the intended use of
> G_BEGIN_DECLS and G_END_DECLS, and it's a pattern we'll need to follow in
> many private GObject header files wherever references are used in function
> signatures, so I would remove the comment.

Then I'll remove the comment and land the patch. Thanks for reviewing.
Comment 4 Adrian Perez 2017-07-12 03:11:31 PDT
Created attachment 315224 [details]
Patch
Comment 5 Adrian Perez 2017-07-12 03:12:44 PDT
Comment on attachment 315224 [details]
Patch

Clearing flags on attachment: 315224

Committed r219387: <http://trac.webkit.org/changeset/219387>
Comment 6 Adrian Perez 2017-07-12 03:12:49 PDT
All reviewed patches have been landed.  Closing bug.