[cfe-commits] r65241 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaType.cpp test/SemaObjC/protocol-archane.m

Chris Lattner clattner at apple.com
Sun Feb 22 22:11:18 PST 2009


On Feb 21, 2009, at 11:50 AM, Steve Naroff wrote:

> Author: snaroff
> Date: Sat Feb 21 13:50:43 2009
> New Revision: 65241
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65241&view=rev
> Log:
> Warn about bogus protocol qualifiers.

Should this be a hard error?

-Chris

> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
>    cfe/trunk/lib/Sema/SemaType.cpp
>    cfe/trunk/test/SemaObjC/protocol-archane.m
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=65241&r1=65240&r2=65241&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Sat Feb 21  
> 13:50:43 2009
> @@ -1402,4 +1402,6 @@
>      "array of interface %0 should probably be an array of pointers")
> DIAG(ext_c99_array_usage, EXTENSION,
>      "use of C99-specific array features, accepted as an extension")
> +DIAG(warn_ignoring_objc_qualifiers, WARNING,
> +     "ignoring protocol qualifiers on non-ObjC type")
>
>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=65241&r1=65240&r2=65241&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Sat Feb 21 13:50:43 2009
> @@ -151,6 +151,9 @@
>         // id<protocol-list>
>         Result =  
> Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ,
>                                                  
> DS.getNumProtocolQualifiers());
> +      else
> +        Diag(DS.getSourceRange().getBegin(),
> +             diag::warn_ignoring_objc_qualifiers) <<  
> DS.getSourceRange();
>     }
>     // TypeQuals handled by caller.
>     break;
>
> Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=65241&r1=65240&r2=65241&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
> +++ cfe/trunk/test/SemaObjC/protocol-archane.m Sat Feb 21 13:50:43  
> 2009
> @@ -21,4 +21,9 @@
>
> // FIXME: provide a better diagnostic (no typedef).
> - (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short  
> type-name' is invalid}}
> - at end
> \ No newline at end of file
> + at end
> +
> +typedef int NotAnObjCObjectType;
> +
> +// GCC doesn't diagnose this.
> +NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning  
> {{ignoring protocol qualifiers on non-ObjC type}}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list