Cleanup a fixme by using a specific diagnostic for subscripting
a pointer to void. llvm-svn: 133912
This commit is contained in:
parent
7a20096874
commit
4cc3f296a9
|
@ -2838,6 +2838,8 @@ def err_subscript_function_type : Error<
|
||||||
"subscript of pointer to function type %0">;
|
"subscript of pointer to function type %0">;
|
||||||
def err_subscript_incomplete_type : Error<
|
def err_subscript_incomplete_type : Error<
|
||||||
"subscript of pointer to incomplete type %0">;
|
"subscript of pointer to incomplete type %0">;
|
||||||
|
def ext_gnu_subscript_void_type : Extension<
|
||||||
|
"subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
|
||||||
def err_typecheck_member_reference_struct_union : Error<
|
def err_typecheck_member_reference_struct_union : Error<
|
||||||
"member reference base type %0 is not a structure or union">;
|
"member reference base type %0 is not a structure or union">;
|
||||||
def err_typecheck_member_reference_ivar : Error<
|
def err_typecheck_member_reference_ivar : Error<
|
||||||
|
|
|
@ -3092,9 +3092,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
|
||||||
|
|
||||||
if (ResultType->isVoidType() && !getLangOptions().CPlusPlus) {
|
if (ResultType->isVoidType() && !getLangOptions().CPlusPlus) {
|
||||||
// GNU extension: subscripting on pointer to void
|
// GNU extension: subscripting on pointer to void
|
||||||
// FIXME: Use a better warning for this.
|
Diag(LLoc, diag::ext_gnu_subscript_void_type)
|
||||||
Diag(LLoc, diag::ext_gnu_void_ptr)
|
<< BaseExpr->getSourceRange();
|
||||||
<< 0 << BaseExpr->getSourceRange();
|
|
||||||
|
|
||||||
// C forbids expressions of unqualified void type from being l-values.
|
// C forbids expressions of unqualified void type from being l-values.
|
||||||
// See IsCForbiddenLValueType.
|
// See IsCForbiddenLValueType.
|
||||||
|
|
|
@ -9,7 +9,7 @@ void a(S* b, void* c) {
|
||||||
c += 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
c += 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
||||||
c--; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
c--; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
||||||
c -= 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
c -= 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
||||||
(void) c[1]; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
|
(void) c[1]; // expected-warning {{subscript of a pointer to void is a GNU extension}}
|
||||||
b = 1+b; // expected-error {{arithmetic on a pointer to an incomplete type}}
|
b = 1+b; // expected-error {{arithmetic on a pointer to an incomplete type}}
|
||||||
/* The next couple tests are only pedantic warnings in gcc */
|
/* The next couple tests are only pedantic warnings in gcc */
|
||||||
void (*d)(S*,void*) = a;
|
void (*d)(S*,void*) = a;
|
||||||
|
|
Loading…
Reference in New Issue