[cfe-commits] r61137 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Parse/ParseTentative.cpp test/SemaCXX/const-cast.cpp test/SemaCXX/decl-expr-ambiguity.cpp test/SemaCXX/direct-initializer.cpp test/SemaCXX/references.cpp
Douglas Gregor
dgregor at apple.com
Wed Dec 17 08:19:29 PST 2008
Author: dgregor
Date: Wed Dec 17 10:19:15 2008
New Revision: 61137
URL: http://llvm.org/viewvc/llvm-project?rev=61137&view=rev
Log:
Removed the warning
warning: statement was disambiguated as declaration
because it is currently firing in cases where the declaration would
not actually parse as a statement. We'd love to bring this warning
back if we can make it more accurate.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/SemaCXX/const-cast.cpp
cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
cfe/trunk/test/SemaCXX/direct-initializer.cpp
cfe/trunk/test/SemaCXX/references.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Dec 17 10:19:15 2008
@@ -597,8 +597,6 @@
"expected '(' for function-style cast or type construction")
DIAG(err_expected_equal_after_declarator, ERROR,
"expected '=' after declarator")
-DIAG(warn_statement_disambiguation, WARNING,
- "statement was disambiguated as %0")
DIAG(warn_parens_disambiguated_as_function_decl, WARNING,
"parentheses were disambiguated as a function declarator")
DIAG(err_expected_member_or_base_name, ERROR,
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Wed Dec 17 10:19:15 2008
@@ -126,18 +126,6 @@
TPR = TPResult::True();
assert(TPR == TPResult::True() || TPR == TPResult::False());
- if (TPR == TPResult::True() && Tok.isNot(tok::kw_void)) {
- // We have a declaration that looks like a functional cast; there's a high
- // chance that the author intended the statement to be an expression.
- // Emit a warning.
- Diag(Tok, diag::warn_statement_disambiguation)
- << "declaration" << SourceRange(Tok.getLocation(), TentativeParseLoc);
- } else if (TPR == TPResult::False() && Tok.is(tok::kw_void)) {
- // A functional cast to 'void' expression ? Warning..
- Diag(Tok, diag::warn_statement_disambiguation)
- << "expression" << SourceRange(Tok.getLocation(), TentativeParseLoc);
- }
-
return TPR == TPResult::True();
}
Modified: cfe/trunk/test/SemaCXX/const-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/const-cast.cpp?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/const-cast.cpp (original)
+++ cfe/trunk/test/SemaCXX/const-cast.cpp Wed Dec 17 10:19:15 2008
@@ -27,7 +27,7 @@
// Drop reference. Intentionally without qualifier change.
char *** var5 = const_cast<cppp>(var4);
const int ar[100] = {0};
- int (&rar)[100] = const_cast<iarr>(ar); // expected-warning {{statement was disambiguated as declaration}} expected-error {{const_cast from 'int const [100]' to 'iarr' is not allowed}}
+ int (&rar)[100] = const_cast<iarr>(ar); // expected-error {{const_cast from 'int const [100]' to 'iarr' is not allowed}}
// Array decay. Intentionally without qualifier change.
int *pi = const_cast<int*>(ar);
f fp = 0;
Modified: cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp Wed Dec 17 10:19:15 2008
@@ -10,7 +10,7 @@
int(a)++; // expected-error {{expression is not assignable}}
__extension__ int(a)++; // expected-error {{expression is not assignable}}
typeof(int)(a,5)<<a; // expected-error {{function-style cast to a builtin type can only take one argument}}
- void(a), ++a; // expected-warning {{statement was disambiguated as expression}} expected-warning {{expression result unused}}
+ void(a), ++a; // expected-warning {{expression result unused}}
if (int(a)+1) {}
for (int(a)+1;;) {}
a = sizeof(int()+1);
@@ -23,13 +23,13 @@
// Declarations.
int fd(T(a)); // expected-warning {{parentheses were disambiguated as a function declarator}}
- T(*d)(int(p)); // expected-warning {{parentheses were disambiguated as a function declarator}} expected-warning {{statement was disambiguated as declaration}} expected-note {{previous definition is here}}
- T(d)[5]; // expected-warning {{statement was disambiguated as declaration}} expected-error {{redefinition of 'd'}}
- typeof(int[])(f) = { 1, 2 }; // expected-warning {{statement was disambiguated as declaration}}
+ T(*d)(int(p)); // expected-warning {{parentheses were disambiguated as a function declarator}} expected-note {{previous definition is here}}
+ T(d)[5]; // expected-error {{redefinition of 'd'}}
+ typeof(int[])(f) = { 1, 2 };
void(b)(int);
- int(d2) __attribute__(()); // expected-warning {{statement was disambiguated as declaration}}
+ int(d2) __attribute__(());
if (int(a)=1) {}
- int(d3(int())); // expected-warning {{statement was disambiguated as declaration}}
+ int(d3(int()));
}
class C { };
Modified: cfe/trunk/test/SemaCXX/direct-initializer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/direct-initializer.cpp?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/direct-initializer.cpp (original)
+++ cfe/trunk/test/SemaCXX/direct-initializer.cpp Wed Dec 17 10:19:15 2008
@@ -5,7 +5,7 @@
void f() {
int x(1);
- int (x2)(1); // expected-warning {{statement was disambiguated as declaration}}
+ int (x2)(1);
for (int x(1);;) {}
}
Modified: cfe/trunk/test/SemaCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/references.cpp?rev=61137&r1=61136&r2=61137&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/references.cpp (original)
+++ cfe/trunk/test/SemaCXX/references.cpp Wed Dec 17 10:19:15 2008
@@ -7,10 +7,10 @@
r = 1;
int *p = &r;
int &rr = r;
- int (&rg)(int) = g; // expected-warning{{statement was disambiguated as declaration}}
+ int (&rg)(int) = g;
rg(i);
int a[3];
- int (&ra)[3] = a; // expected-warning{{statement was disambiguated as declaration}}
+ int (&ra)[3] = a;
ra[1] = i;
int *Q;
int *& P = Q;
@@ -24,7 +24,7 @@
int c[3];
- int (&rc)[3] = c; // expected-warning{{statement was disambiguated as declaration}}
+ int (&rc)[3] = c;
}
// C++ [dcl.init.ref]p5b1
More information about the cfe-commits
mailing list