consider building with -Wblock-capture-autoreleasing |
|||||
Issue description-Wblock-capture-autoreleasing looks like a useful warning that got enabled by default in upstream clang recently. The warning fires in several places (example: https://uberchromegw.corp.google.com/i/internal.bling.fyi/builders/clang-tot-device/builds/1036/steps/compile/logs/stdio) so we have to disable the warning for now, but we should check if it's useful and consider turning it on. Maybe one of you wants to take a look with an iOS build?
,
Feb 10 2017
Our current clang has this, just off by default.
,
Feb 11 2017
msarda@ it seems like the fix is to change the method param from `NSError **` --> `NSError *__autoreleasing*` thakis@ does that sound correct? Some light googling gave me conflicting advice, specifically: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#indirect-parameters suggests NSError ** should "be implicitly qualified with __autoreleasing." It appears this is the only error when adding -Wblock-capture-autoreleasing
,
Feb 11 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/48130024a853818d09b132c10dfca934a14e7da6 commit 48130024a853818d09b132c10dfca934a14e7da6 Author: thakis <thakis@chromium.org> Date: Sat Feb 11 02:33:14 2017 clang: Disable -Wblock-capture-autoreleasing This warning has existed for a while but used to be off-by-default. Upstream made it on-by-default recently, which breaks the compile step of the iOS ToT bot. BUG= 691120 TBR=hans Review-Url: https://codereview.chromium.org/2682943010 Cr-Commit-Position: refs/heads/master@{#449837} [modify] https://crrev.com/48130024a853818d09b132c10dfca934a14e7da6/build/config/compiler/BUILD.gn
,
Feb 11 2017
justincohen: good point, let me look into that
,
Feb 11 2017
Error looks like:
somefile.m: error: block captures an autoreleasing out-parameter, which may result in use-after-free bugs [-Werror,-Wblock-capture-autoreleasing]
if (error) {
^
somefile.m: note: declare the parameter __autoreleasing explicitly to suppress this warning
- (NSDictionary *)fooWithError:(NSError **)error {
^
__autoreleasing
somefile.m: note: declare the parameter __strong or capture a __block __strong variable to keep values alive across autorelease pools
,
Feb 11 2017
,
Feb 13 2017
Assigning to Justin as he said he would look into it.
,
Feb 13 2017
thakis@ I'm not sure if the response here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170206/185190.html implies we need to make a change (NSError ** -> NSError * __autoreleasing*) or that it's a clang bug.
,
Feb 13 2017
I'm not sure either :-) I'll follow up there if I don't hear back by tomorrow.
,
Feb 15 2017
I got a reply: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170213/185409.html It sounds like clang does generate the code as if __autoreleasing is implicitly there at this point, but apparently this is surprising to people, so now clang warns when that happens. To suppress the warning, one has to explicitly add that __autoreleasing. Does that make sense? Upstream is open to changing the wording of the warning if anyone has a better suggestion. But it sounds like we do want to add __autoreleasing to that file.
,
Feb 17 2017
,
Feb 20 2017
I landed the internal fix -- thakis@ can you try block-capture-autoreleasing again?
,
Mar 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0f16147c62ef8635f594ed77c415cc9de2ece5a6 commit 0f16147c62ef8635f594ed77c415cc9de2ece5a6 Author: thakis <thakis@chromium.org> Date: Mon Mar 06 18:29:28 2017 clang: Stop disabling -Wblock-capture-autoreleasing Things should build with it enabled now, and it's a useful warning. BUG= 691120 Review-Url: https://codereview.chromium.org/2730273002 Cr-Commit-Position: refs/heads/master@{#454895} [modify] https://crrev.com/0f16147c62ef8635f594ed77c415cc9de2ece5a6/build/config/compiler/BUILD.gn
,
Mar 6 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by justincohen@chromium.org
, Feb 10 2017Labels: restri