Bug 179892 - Detect __declspec within JSBase.h
Summary: Detect __declspec within JSBase.h
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Don Olmstead
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-20 11:29 PST by Don Olmstead
Modified: 2017-11-20 18:50 PST (History)
10 users (show)

See Also:


Attachments
Patch (1.63 KB, patch)
2017-11-20 11:33 PST, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (1.75 KB, patch)
2017-11-20 12:05 PST, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (2.09 KB, patch)
2017-11-20 14:17 PST, Don Olmstead
darin: review+
Details | Formatted Diff | Diff
Patch (2.03 KB, patch)
2017-11-20 17:21 PST, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2017-11-20 11:29:09 PST
Clang has support for a Microsoft style __declspec attribute, https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute, and this should be detected within JSBase.h.
Comment 1 Don Olmstead 2017-11-20 11:33:34 PST
Created attachment 327369 [details]
Patch

Uses clangs declspec detection. Also getting rid of WIN_CE define.
Comment 2 Don Olmstead 2017-11-20 12:05:24 PST
Created attachment 327370 [details]
Patch
Comment 3 Don Olmstead 2017-11-20 14:17:02 PST
Created attachment 327375 [details]
Patch

Moving declaration to its own block. Adding RealView ARM Compiler support of declspec.
Comment 4 EWS Watchlist 2017-11-20 14:18:28 PST
Attachment 327375 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSBase.h:72:  One space before end of line comments  [whitespace/comments] [5]
ERROR: Source/JavaScriptCore/API/JSBase.h:72:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Darin Adler 2017-11-20 16:32:07 PST
Comment on attachment 327375 [details]
Patch

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

> Source/JavaScriptCore/API/JSBase.h:80
> +#ifndef __has_declspec_attribute
> +#if defined(WIN32) || defined(_WIN32) || defined(__CC_ARM) || defined(__ARMCC__)
> +#define __has_declspec_attribute(x) 1
> +#else
> +#define __has_declspec_attribute(x) 0
> +#endif
> +#endif

Defining this macro isn’t great in a public header like JSBase.h, but I guess we can live with it.

> Source/JavaScriptCore/API/JSBase.h:88
> +#elif (__has_declspec_attribute(dllimport) && __has_declspec_attribute(dllexport))

No need for these parentheses.
Comment 6 Don Olmstead 2017-11-20 17:21:35 PST
Created attachment 327380 [details]
Patch

Addressing feedback
Comment 7 EWS Watchlist 2017-11-20 17:23:08 PST
Attachment 327380 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSBase.h:72:  One space before end of line comments  [whitespace/comments] [5]
ERROR: Source/JavaScriptCore/API/JSBase.h:72:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Don Olmstead 2017-11-20 18:28:18 PST
Comment on attachment 327380 [details]
Patch

Apple Win failures are around FourCC which is unrelated
Comment 9 WebKit Commit Bot 2017-11-20 18:48:17 PST
Comment on attachment 327380 [details]
Patch

Clearing flags on attachment: 327380

Committed r225063: <https://trac.webkit.org/changeset/225063>
Comment 10 WebKit Commit Bot 2017-11-20 18:48:19 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2017-11-20 18:50:26 PST
<rdar://problem/35651308>