Bug 177893

Summary: Disable -Wcast-qual for new clang compiler in Apple ports
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebCore Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, cdumez, cmarcelo, commit-queue, darin, dbates, thorton
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 177895    
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2017-10-04 13:04:43 PDT
We need to temporarily disable -Wcast-qual in WebCore for a new clang compiler until a new cast function can be made to do the casts safely (and without using reinterpret_cast<>(const_cast<>()) operators everywhere).

This also turns off the -Wcast-qual warning for one part of RetainPtr<>.

All of these warnings are due to casting a const CFTypeRef (or sometimes a const void*, which is the return type of functions like CFArrayGetValueAtIndex()) to a non-const CFTypeRef in C++ or Objective-C++ code.

<rdar://problem/33667497>
Comment 1 David Kilzer (:ddkilzer) 2017-10-04 13:52:37 PDT
Created attachment 322715 [details]
Patch v1
Comment 2 WebKit Commit Bot 2017-10-05 12:12:08 PDT
Comment on attachment 322715 [details]
Patch v1

Clearing flags on attachment: 322715

Committed r222928: <http://trac.webkit.org/changeset/222928>
Comment 3 WebKit Commit Bot 2017-10-05 12:12:10 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2017-10-07 13:33:59 PDT
(In reply to David Kilzer (:ddkilzer) from comment #0)
> We need to temporarily disable -Wcast-qual in WebCore for a new clang
> compiler until a new cast function can be made to do the casts safely (and
> without using reinterpret_cast<>(const_cast<>()) operators everywhere).
> 
> This also turns off the -Wcast-qual warning for one part of RetainPtr<>.
> 
> All of these warnings are due to casting a const CFTypeRef (or sometimes a
> const void*, which is the return type of functions like
> CFArrayGetValueAtIndex()) to a non-const CFTypeRef in C++ or Objective-C++
> code.

I’d really like to get this turned back on. Is someone working on the new cast?
Comment 5 David Kilzer (:ddkilzer) 2017-10-11 11:09:51 PDT
(In reply to Darin Adler from comment #4)
> (In reply to David Kilzer (:ddkilzer) from comment #0)
> > We need to temporarily disable -Wcast-qual in WebCore for a new clang
> > compiler until a new cast function can be made to do the casts safely (and
> > without using reinterpret_cast<>(const_cast<>()) operators everywhere).
> > 
> > This also turns off the -Wcast-qual warning for one part of RetainPtr<>.
> > 
> > All of these warnings are due to casting a const CFTypeRef (or sometimes a
> > const void*, which is the return type of functions like
> > CFArrayGetValueAtIndex()) to a non-const CFTypeRef in C++ or Objective-C++
> > code.
> 
> I’d really like to get this turned back on. Is someone working on the new
> cast?

It's being tracked here:  Bug 177895: Re-enable -Wcast-qual for Apple ports