From 05072804cfba9f5635d126b14c136e3887e0a0c0 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 3 Feb 2012 01:30:34 +0000 Subject: [PATCH] Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error. This is to ease the transition of large apps moving from non-ARC to ARC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149659 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticParseKinds.td | 6 ++++-- test/SemaObjC/illegal-nonarc-bridged-cast.m | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 047d6ce7dc..73d7883fbe 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -330,8 +330,10 @@ def err_illegal_super_cast : Error< let CategoryName = "ARC Parse Issue" in { def err_arc_bridge_retain : Error< "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">; -def err_arc_bridge_cast_nonarc : Error< - "'%0' casts are only allowed when using ARC">; +def err_arc_bridge_cast_nonarc : Warning< + "'%0' casts are only allowed when using ARC">, + InGroup>, + DefaultError; } def err_objc_illegal_visibility_spec : Error< diff --git a/test/SemaObjC/illegal-nonarc-bridged-cast.m b/test/SemaObjC/illegal-nonarc-bridged-cast.m index b0d1e82475..fe6b24a634 100644 --- a/test/SemaObjC/illegal-nonarc-bridged-cast.m +++ b/test/SemaObjC/illegal-nonarc-bridged-cast.m @@ -35,3 +35,10 @@ void fixits() { id obj1 = (id)CFCreateSomething(); CFTypeRef cf1 = (CFTypeRef)CreateSomething(); } + +#pragma clang diagnostic ignored "-Warc-bridge-casts-disallowed-in-nonarc" + +void to_cf_ignored(id obj) { + CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // no-warning + CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // no-warning +} -- 2.40.0