[cfe-commits] r103360 - in /cfe/trunk: lib/AST/Expr.cpp lib/Sema/SemaOverload.cpp test/Sema/unused-expr.c
Douglas Gregor
dgregor at apple.com
Sat May 8 15:41:50 PDT 2010
Author: dgregor
Date: Sat May 8 17:41:50 2010
New Revision: 103360
URL: http://llvm.org/viewvc/llvm-project?rev=103360&view=rev
Log:
Don't complain about an __builtin_va_arg expression's result being
unused, since the operation has side effects.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/Sema/unused-expr.c
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=103360&r1=103359&r2=103360&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat May 8 17:41:50 2010
@@ -976,6 +976,7 @@
return true;
}
case CompoundAssignOperatorClass:
+ case VAArgExprClass:
return false;
case ConditionalOperatorClass: {
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=103360&r1=103359&r2=103360&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat May 8 17:41:50 2010
@@ -2910,6 +2910,7 @@
/// TryContextuallyConvertToBool - Attempt to contextually convert the
/// expression From to bool (C++0x [conv]p3).
ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
+ // FIXME: This is pretty broken.
return TryImplicitConversion(From, Context.BoolTy,
// FIXME: Are these flags correct?
/*SuppressUserConversions=*/false,
Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=103360&r1=103359&r2=103360&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Sat May 8 17:41:50 2010
@@ -110,3 +110,11 @@
void t10() {
(void*) some_function(); //expected-warning {{expression result unused; should this cast be to 'void'?}}
}
+
+void f(int i, ...) {
+ __builtin_va_list ap;
+
+ __builtin_va_start(ap, i);
+ __builtin_va_arg(ap, int);
+ __builtin_va_end(ap);
+}
More information about the cfe-commits
mailing list