Bug 169243 - Fix -Wattributes warning spam
Summary: Fix -Wattributes warning spam
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-06 18:41 PST by Michael Catanzaro
Modified: 2017-03-08 18:41 PST (History)
9 users (show)

See Also:


Attachments
Patch (3.74 KB, patch)
2017-03-06 18:43 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (2.83 KB, patch)
2017-03-07 12:43 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2017-03-06 18:41:26 PST
-Wattributes warning spam caused by r213198:

../../Source/WebKit2/UIProcess/API/C/WKPageGroup.h:55:102: warning: ‘unavailable’ attribute directive ignored [-Wattributes]
 WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup) __attribute__((unavailable));
                                                                                                      ^
../../Source/WebKit2/UIProcess/API/C/WKPageGroup.h:56:143: warning: ‘unavailable’ attribute directive ignored [-Wattributes]
 WK_EXPORT void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroup, WKUserContentFilterRef userContentFilter) __attribute__((unavailable));
                                                                                                                                               ^
../../Source/WebKit2/UIProcess/API/C/WKPageGroup.h:57:139: warning: ‘unavailable’ attribute directive ignored [-Wattributes]
 WK_EXPORT void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroup, WKStringRef userContentFilterName) __attribute__((unavailable));

It prints hundreds of times, since it's in a header file.
Comment 1 Michael Catanzaro 2017-03-06 18:43:47 PST
Created attachment 303600 [details]
Patch
Comment 2 mitz 2017-03-06 18:59:23 PST
Comment on attachment 303600 [details]
Patch

Don’t import wtf headers from WebKit2 framework headers. Instead, you can define WK_UNAVAILABLE in WKDeclarationSpecifiers.h.
Comment 3 Michael Catanzaro 2017-03-06 19:36:28 PST
(In reply to comment #2)
> Comment on attachment 303600 [details]
> Patch
> 
> Don’t import wtf headers from WebKit2 framework headers.

Umm yeah, that was dumb, oops.
Comment 4 Alexey Proskuryakov 2017-03-06 22:32:40 PST
This failure is surprising, given that NS_UNAVAILAbLE is defined in macOS like this:

/*
 * only certain compilers support __attribute__((unavailable))
 */
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
    #define UNAVAILABLE_ATTRIBUTE __attribute__((unavailable))
#else
    #define UNAVAILABLE_ATTRIBUTE
#endif

#if !defined(NS_UNAVAILABLE)
#define NS_UNAVAILABLE UNAVAILABLE_ATTRIBUTE
#endif
Comment 5 Michael Catanzaro 2017-03-07 07:02:26 PST
Weird. I have absolutely no clue; maybe it used to exist but was removed (very unlikely), maybe Apple has its own fork of GCC where it added that attribute (seems unlikely too), maybe you don't care about GCC and the check is really just there for Clang (also seems unlikely)... I don't know! It's not documented anywhere and it definitely does not work.
Comment 6 Michael Catanzaro 2017-03-07 12:43:46 PST
Created attachment 303703 [details]
Patch
Comment 7 Michael Catanzaro 2017-03-07 12:44:40 PST
Let's see if EWS likes this.

Note: __has_extension is guaranteed to be defined where I removed the check for it; that's a drive-by cleanup.
Comment 8 Michael Catanzaro 2017-03-08 18:05:35 PST
Comment on attachment 303703 [details]
Patch

Thanks!
Comment 9 WebKit Commit Bot 2017-03-08 18:40:58 PST
Comment on attachment 303703 [details]
Patch

Clearing flags on attachment: 303703

Committed r213620: <http://trac.webkit.org/changeset/213620>
Comment 10 WebKit Commit Bot 2017-03-08 18:41:04 PST
All reviewed patches have been landed.  Closing bug.