Bug 173889

Summary: [Win] Build JSCOnly on Windows with clang-cl
Product: WebKit Reporter: Stephan Szabo <stephan.szabo>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, commit-queue, don.olmstead, lforschler
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 174221    
Bug Blocks: 171618    
Attachments:
Description Flags
Patch to build jsc-only with clang-cl toolset
none
Patch to build jsc-only with clang-cl toolset
none
Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4 option
none
Patch to build jsc-only with clang-cl toolset - restructured gcc_or_clang block
none
Patch to build jsc-only with clang-cl toolset - restructured gcc_or_clang block none

Description Stephan Szabo 2017-06-27 14:26:28 PDT
Support using the clang-cl toolset for JSC only builds on Windows
Comment 1 Stephan Szabo 2017-06-27 14:32:58 PDT
Created attachment 313946 [details]
Patch to build jsc-only with clang-cl toolset
Comment 2 Stephan Szabo 2017-06-27 15:20:12 PDT
Created attachment 313952 [details]
Patch to build jsc-only with clang-cl toolset
Comment 3 Stephan Szabo 2017-06-27 15:41:24 PDT
Created attachment 313956 [details]
Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4 option
Comment 4 Konstantin Tokarev 2017-06-28 13:15:12 PDT
Comment on attachment 313956 [details]
Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4 option

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

> Source/cmake/OptionsCommon.cmake:57
> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")

Don't duplicate these lines

> Source/cmake/OptionsCommon.cmake:58
> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")

Can clang-cl accept -std=c++1y? If yes, it should just add a few flags to those set in the common COMPILER_IS_GCC_OR_CLANG block
Comment 5 Don Olmstead 2017-06-28 13:48:13 PDT
Comment on attachment 313956 [details]
Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4 option

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

>> Source/cmake/OptionsCommon.cmake:57
>> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")
> 
> Don't duplicate these lines

These were duplicated from above. I'm guessing because those options are never going to change.

>> Source/cmake/OptionsCommon.cmake:58
>> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
> 
> Can clang-cl accept -std=c++1y? If yes, it should just add a few flags to those set in the common COMPILER_IS_GCC_OR_CLANG block

With clang-cl it attempts to use the cl options where applicable such as https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/
Comment 6 Stephan Szabo 2017-06-28 14:05:57 PDT
(In reply to Konstantin Tokarev from comment #4)
> Comment on attachment 313956 [details]
> Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4
> option
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=313956&action=review
> 
> > Source/cmake/OptionsCommon.cmake:57
> > +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")
> 
> Don't duplicate these lines

 
> > Source/cmake/OptionsCommon.cmake:58
> > +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
> 
> Can clang-cl accept -std=c++1y? If yes, it should just add a few flags to
> those set in the common COMPILER_IS_GCC_OR_CLANG block

Unfortunately, no, -std is considered an unknown argument.
(In reply to Konstantin Tokarev from comment #4)
> Comment on attachment 313956 [details]
> Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4
> option
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=313956&action=review
> 
> > Source/cmake/OptionsCommon.cmake:57
> > +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")
> 
> Don't duplicate these lines

I'm sorry, I'm not sure what you mean here. Is it because we're doing -fno-strict-aliasing in both branches? We aren't passing -fno-exceptions or -fno-rtti in the clang-cl case, but it'd be easy to separate the common one out if that seems better.

> > Source/cmake/OptionsCommon.cmake:58
> > +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
> 
> Can clang-cl accept -std=c++1y? If yes, it should just add a few flags to
> those set in the common COMPILER_IS_GCC_OR_CLANG block

Unfortunately, no, -std is an unknown argument for clang-cl.
Comment 7 Stephan Szabo 2017-06-28 14:06:43 PDT
Sorry, I accidentally ended up with two copies of the last post in the post.
Comment 8 Konstantin Tokarev 2017-06-28 14:37:02 PDT
Comment on attachment 313956 [details]
Patch to build jsc-only with clang-cl toolset - combined clang-cl/gcc/clang4 option

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

>>>>> Source/cmake/OptionsCommon.cmake:57
>>>>> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")
>>>> 
>>>> Don't duplicate these lines
>>> 
>>> These were duplicated from above. I'm guessing because those options are never going to change.
>> 
>> 
> 
> I'm sorry, I'm not sure what you mean here. Is it because we're doing -fno-strict-aliasing in both branches? We aren't passing -fno-exceptions or -fno-rtti in the clang-cl case, but it'd be easy to separate the common one out if that seems better.

Yes, it would be better
Comment 9 Stephan Szabo 2017-06-28 14:54:40 PDT
Created attachment 314059 [details]
Patch to build jsc-only with clang-cl toolset - restructured gcc_or_clang block
Comment 10 Stephan Szabo 2017-06-28 14:57:21 PDT
Created attachment 314060 [details]
Patch to build jsc-only with clang-cl toolset - restructured gcc_or_clang block
Comment 11 WebKit Commit Bot 2017-06-28 16:04:41 PDT
Comment on attachment 314060 [details]
Patch to build jsc-only with clang-cl toolset - restructured gcc_or_clang block

Clearing flags on attachment: 314060

Committed r218900: <http://trac.webkit.org/changeset/218900>
Comment 12 WebKit Commit Bot 2017-06-28 16:04:43 PDT
All reviewed patches have been landed.  Closing bug.