[cfe-commits] r91094 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/SemaCXX/overload-call-copycon.cpp test/SemaCXX/vararg-non-pod.cpp test/SemaObjCXX/vararg-non-pod.mm
Chris Lattner
sabre at nondot.org
Thu Dec 10 17:52:51 PST 2009
Author: lattner
Date: Thu Dec 10 19:52:50 2009
New Revision: 91094
URL: http://llvm.org/viewvc/llvm-project?rev=91094&view=rev
Log:
Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/SemaCXX/overload-call-copycon.cpp
cfe/trunk/test/SemaCXX/vararg-non-pod.cpp
cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=91094&r1=91093&r2=91094&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 10 19:52:50 2009
@@ -2009,7 +2009,8 @@
def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
"cannot pass object of non-POD type %0 through variadic "
- "%select{function|block|method|constructor}1; call will abort at runtime">;
+ "%select{function|block|method|constructor}1; call will abort at runtime">,
+ InGroup<DiagGroup<"non-pod-varargs">>, DefaultError;
def err_typecheck_call_invalid_ordered_compare : Error<
"ordered compare requires two args of floating point type (%0 and %1)">;
Modified: cfe/trunk/test/SemaCXX/overload-call-copycon.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call-copycon.cpp?rev=91094&r1=91093&r2=91094&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call-copycon.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call-copycon.cpp Thu Dec 10 19:52:50 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: clang-cc -fsyntax-only %s -Wnon-pod-varargs
class X { };
int& copycon(X x);
@@ -23,10 +23,10 @@
void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) {
int& i1 = copycon2(b);
- float& f1 = copycon2(bc);
- float& f2 = copycon2(bv);
+ float& f1 = copycon2(bc); // expected-warning {{cannot pass object of non-POD type}}
+ float& f2 = copycon2(bv); // expected-warning {{cannot pass object of non-POD type}}
short& s1 = copycon2(a);
- float& f3 = copycon2(ac);
+ float& f3 = copycon2(ac); // expected-warning {{cannot pass object of non-POD type}}
}
int& copycon3(A a);
@@ -34,7 +34,7 @@
void test_copycon3(B b, const B bc) {
int& i1 = copycon3(b);
- float& f1 = copycon3(bc);
+ float& f1 = copycon3(bc); // expected-warning {{cannot pass object of non-POD type}}
}
Modified: cfe/trunk/test/SemaCXX/vararg-non-pod.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vararg-non-pod.cpp?rev=91094&r1=91093&r2=91094&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/vararg-non-pod.cpp (original)
+++ cfe/trunk/test/SemaCXX/vararg-non-pod.cpp Thu Dec 10 19:52:50 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fblocks %s
+// RUN: clang-cc -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
extern char version[];
Modified: cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm?rev=91094&r1=91093&r2=91094&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm (original)
+++ cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm Thu Dec 10 19:52:50 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: clang-cc -fsyntax-only -verify %s -Wnon-pod-varargs
extern char version[];
More information about the cfe-commits
mailing list