WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 191146
[Win][Clang][JSC] JIT::is64BitType reports "warning: explicit specialization cannot have a storage class"
https://bugs.webkit.org/show_bug.cgi?id=191146
Summary
[Win][Clang][JSC] JIT::is64BitType reports "warning: explicit specialization ...
Fujii Hironori
Reported
2018-11-01 00:40:37 PDT
[Win][Clang][JSC] JIT::is64BitType reports "warning: explicit specialization cannot have a storage class" clang-cl 7.0 reports following compilation error.
> In file included from DerivedSources\JavaScriptCore\unified-sources\UnifiedSource26.cpp:2: > In file included from ..\..\Source\JavaScriptCore\bytecode/CodeBlock.cpp:59: > ..\..\Source\JavaScriptCore\jit\JIT.h(787,31): warning: explicit specialization cannot have a storage class > static constexpr bool is64BitType<void>() { return true; } > ~~~~~~~ ^ > 1 warning generated.
Attachments
Patch
(2.20 KB, patch)
2018-11-01 02:22 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch for landing
(2.19 KB, patch)
2018-11-04 21:40 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2018-11-01 00:51:47 PDT
(In reply to Fujii Hironori from
comment #0
)
> clang-cl 7.0 reports following compilation error.
Oops. It is a warning, not error.
Fujii Hironori
Comment 2
2018-11-01 01:27:16 PDT
c++ - constexpr static template function: g++ error is a warning on clang - Stack Overflow
https://stackoverflow.com/q/37879642/2691131
Fujii Hironori
Comment 3
2018-11-01 02:22:20 PDT
Created
attachment 353588
[details]
Patch
Ross Kirsling
Comment 4
2018-11-01 10:30:09 PDT
Comment on
attachment 353588
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
Looks like this one's my fault (
bug 183655
).
> Source/JavaScriptCore/jit/JIT.h:791 > template<typename Type> > - static constexpr bool is64BitType() { return sizeof(Type) <= 8; } > + struct is64BitType { > + static const bool value = sizeof(Type) <= 8; > + }; > > template<> > - static constexpr bool is64BitType<void>() { return true; } > + struct is64BitType<void> { > + static const bool value = true; > + };
Could we drop `static` and move this to an anonymous namespace instead? It probably shouldn't have been a member to begin with... 😓
Fujii Hironori
Comment 5
2018-11-01 18:30:06 PDT
Comment on
attachment 353588
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
>> Source/JavaScriptCore/jit/JIT.h:791 >> + }; > > Could we drop `static` and move this to an anonymous namespace instead? > It probably shouldn't have been a member to begin with... 😓
I tested both patches with both compilers, and confirmed both works fine. I prefer the inner template class version to template class version because anonymous namespace is useless in Unified Source Builds. C++14 has template variable. I will refine the patch.
Fujii Hironori
Comment 6
2018-11-01 19:15:47 PDT
(In reply to Fujii Hironori from
comment #5
)
> C++14 has template variable. I will refine the patch.
Oh, no. I am hitting the following issue if I use a template variable. variable template causes internal compiler error when used in a static_assert inside class template - Developer Community
https://developercommunity.visualstudio.com/content/problem/268619/variable-template-causes-internal-compiler-error-w.html
This is fixed in Visual Studio 2017 version 15.8.
Fujii Hironori
Comment 7
2018-11-01 19:18:24 PDT
Comment on
attachment 353588
[details]
Patch Review, please.
Keith Miller
Comment 8
2018-11-01 19:27:53 PDT
Comment on
attachment 353588
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
>>> Source/JavaScriptCore/jit/JIT.h:791 >>> + }; >> >> Could we drop `static` and move this to an anonymous namespace instead? >> It probably shouldn't have been a member to begin with... 😓 > > I tested both patches with both compilers, and confirmed both > works fine. I prefer the inner template class version to template > class version because anonymous namespace is useless in Unified > Source Builds. > > C++14 has template variable. I will refine the patch.
Does anyone actually use the fact that is64BitType is static? Can we just removed that keyword?
Fujii Hironori
Comment 9
2018-11-01 20:00:33 PDT
Comment on
attachment 353588
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
>>>> Source/JavaScriptCore/jit/JIT.h:791 >>>> + }; >>> >>> Could we drop `static` and move this to an anonymous namespace instead? >>> It probably shouldn't have been a member to begin with... 😓 >> >> I tested both patches with both compilers, and confirmed both >> works fine. I prefer the inner template class version to template >> class version because anonymous namespace is useless in Unified >> Source Builds. >> >> C++14 has template variable. I will refine the patch. > > Does anyone actually use the fact that is64BitType is static? Can we just removed that keyword?
It can't compile by GCC, Clang, MSVC if is64BitType is non-static member function. Maybe, 'this' can not be used in static_assert.
https://godbolt.org/z/NxG5HI
Ross Kirsling
Comment 10
2018-11-01 21:18:19 PDT
(In reply to Fujii Hironori from
comment #9
)
> Comment on
attachment 353588
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
> > >>>> Source/JavaScriptCore/jit/JIT.h:791 > >>>> + }; > >>> > >>> Could we drop `static` and move this to an anonymous namespace instead? > >>> It probably shouldn't have been a member to begin with... 😓 > >> > >> I tested both patches with both compilers, and confirmed both > >> works fine. I prefer the inner template class version to template > >> class version because anonymous namespace is useless in Unified > >> Source Builds. > >> > >> C++14 has template variable. I will refine the patch. > > > > Does anyone actually use the fact that is64BitType is static? Can we just removed that keyword? > > It can't compile by GCC, Clang, MSVC if is64BitType is non-static member > function. > Maybe, 'this' can not be used in static_assert. >
https://godbolt.org/z/NxG5HI
As I mentioned, it was my mistake. It's just a simple helper function that doesn't need to be a member at all, but I must've guessed that it would better align with existing practices to make it a method instead of namespace-static. But as you've noted, simply removing `static` won't compile.
Yusuke Suzuki
Comment 11
2018-11-02 19:58:54 PDT
Comment on
attachment 353588
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353588&action=review
OK, then r=me
> Source/JavaScriptCore/jit/JIT.h:785 > + static const bool value = sizeof(Type) <= 8;
Ditto.
> Source/JavaScriptCore/jit/JIT.h:790 > + static const bool value = true;
Use `static constexpr bool`
>>>>>> Source/JavaScriptCore/jit/JIT.h:791 >>>>>> + }; >>>>> >>>>> Could we drop `static` and move this to an anonymous namespace instead? >>>>> It probably shouldn't have been a member to begin with... 😓 >>>> >>>> I tested both patches with both compilers, and confirmed both >>>> works fine. I prefer the inner template class version to template >>>> class version because anonymous namespace is useless in Unified >>>> Source Builds. >>>> >>>> C++14 has template variable. I will refine the patch. >>> >>> Does anyone actually use the fact that is64BitType is static? Can we just removed that keyword? >> >> It can't compile by GCC, Clang, MSVC if is64BitType is non-static member function. >> Maybe, 'this' can not be used in static_assert. >>
https://godbolt.org/z/NxG5HI
> > As I mentioned, it was my mistake. It's just a simple helper function that doesn't need to be a member at all, but I must've guessed that it would better align with existing practices to make it a method instead of namespace-static. But as you've noted, simply removing `static` won't compile.
I'm not sure whether template variable can be used in some versions of GCC... But it may be now updated.
Fujii Hironori
Comment 12
2018-11-04 21:40:18 PST
Created
attachment 353827
[details]
Patch for landing Thank you for the review. Addressed the review feedback.
Fujii Hironori
Comment 13
2018-11-05 01:34:58 PST
Comment on
attachment 353827
[details]
Patch for landing Clearing flags on attachment: 353827 Committed
r237793
: <
https://trac.webkit.org/changeset/237793
>
Fujii Hironori
Comment 14
2018-11-05 01:35:01 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15
2018-11-05 01:35:19 PST
<
rdar://problem/45802019
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug