mirror of https://github.com/microsoft/clang.git
Added the attribute name to the err_attribute_wrong_number_arguments diagnostic for clarity; updated almost all of the affected test cases.
Thanks to Fariborz Jahanian for the suggestion! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186980 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e673f8f24
commit
baec77865b
|
@ -1756,8 +1756,8 @@ def err_attribute_can_be_applied_only_to_symbol_declaration : Error<
|
|||
def err_attributes_are_not_compatible : Error<
|
||||
"%0 and %1 attributes are not compatible">;
|
||||
def err_attribute_wrong_number_arguments : Error<
|
||||
"attribute %plural{0:takes no arguments|1:takes one argument|"
|
||||
":requires exactly %0 arguments}0">;
|
||||
"%0 attribute %plural{0:takes no arguments|1:takes one argument|"
|
||||
":requires exactly %1 arguments}1">;
|
||||
def err_attribute_too_many_arguments : Error<
|
||||
"attribute takes no more than %0 argument%s0">;
|
||||
def err_suppress_autosynthesis : Error<
|
||||
|
|
|
@ -219,7 +219,8 @@ static inline bool isCFStringType(QualType T, ASTContext &Ctx) {
|
|||
static bool checkAttributeNumArgs(Sema &S, const AttributeList &Attr,
|
||||
unsigned int Num) {
|
||||
if (Attr.getNumArgs() != Num) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << Num;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << Num;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1112,8 @@ static void handleIBOutletCollection(Sema &S, Decl *D,
|
|||
|
||||
// The iboutletcollection attribute can have zero or one arguments.
|
||||
if (Attr.getParameterName() && Attr.getNumArgs() > 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1344,14 +1346,16 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
|
|||
case AttributeList::AT_ownership_takes:
|
||||
K = OwnershipAttr::Takes;
|
||||
if (AL.getNumArgs() < 1) {
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2;
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< AL.getName() << 2;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AttributeList::AT_ownership_holds:
|
||||
K = OwnershipAttr::Holds;
|
||||
if (AL.getNumArgs() < 1) {
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2;
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< AL.getName() << 2;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -1359,7 +1363,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
|
|||
K = OwnershipAttr::Returns;
|
||||
if (AL.getNumArgs() > 1) {
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< AL.getNumArgs() + 1;
|
||||
<< AL.getName() << AL.getNumArgs() + 1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -1471,7 +1475,8 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
|
|||
llvm::array_pod_sort(start, start + size);
|
||||
|
||||
if (K != OwnershipAttr::Returns && OwnershipArgs.empty()) {
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2;
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< AL.getName() << 2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1488,8 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
|
|||
static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() > 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1660,7 +1666,8 @@ static void handleAlwaysInlineAttr(Sema &S, Decl *D,
|
|||
const AttributeList &Attr) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1713,7 +1720,8 @@ static void handleTLSModelAttr(Sema &S, Decl *D,
|
|||
static void handleMallocAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1786,7 +1794,8 @@ static void handleNoReturnAttr(Sema &S, Decl *D, const AttributeList &attr) {
|
|||
|
||||
bool Sema::CheckNoReturnAttr(const AttributeList &attr) {
|
||||
if (attr.hasParameterOrArguments()) {
|
||||
Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< attr.getName() << 0;
|
||||
attr.setInvalid();
|
||||
return true;
|
||||
}
|
||||
|
@ -1924,7 +1933,8 @@ static void handleDependencyAttr(Sema &S, Scope *Scope, Decl *D,
|
|||
static void handleUnusedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1944,7 +1954,8 @@ static void handleReturnsTwiceAttr(Sema &S, Decl *D,
|
|||
const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1962,7 +1973,8 @@ static void handleReturnsTwiceAttr(Sema &S, Decl *D,
|
|||
static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2445,7 +2457,8 @@ static void handleObjCMethodFamilyAttr(Sema &S, Decl *decl,
|
|||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
|
||||
<< Attr.getName() << 1 << ArgumentString;
|
||||
} else {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
}
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
|
@ -2555,7 +2568,8 @@ static void handleBlocksAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
}
|
||||
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2711,7 +2725,8 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const AttributeList &Attr)
|
|||
static void handleWeakAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2908,7 +2923,8 @@ static void handleSectionAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
static void handleNothrowAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2925,7 +2941,8 @@ static void handleNothrowAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
static void handleConstAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2951,12 +2968,14 @@ static void handlePureAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
|
||||
static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
if (!Attr.getParameterName()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3200,7 +3219,8 @@ static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
}
|
||||
|
||||
if (Attr.getNumArgs() != 2) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 3;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3434,7 +3454,8 @@ static void handleAnnotateAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.getNumArgs() > 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3834,7 +3855,8 @@ static void handleConstantAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
if (S.LangOpts.CUDA) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3856,7 +3878,8 @@ static void handleDeviceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
if (S.LangOpts.CUDA) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4076,7 +4099,8 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
|
|||
|
||||
unsigned ReqArgs = attr.getKind() == AttributeList::AT_Pcs ? 1 : 0;
|
||||
if (attr.getNumArgs() != ReqArgs || attr.getParameterName()) {
|
||||
Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments) << ReqArgs;
|
||||
Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< attr.getName() << ReqArgs;
|
||||
attr.setInvalid();
|
||||
return true;
|
||||
}
|
||||
|
@ -4249,7 +4273,7 @@ static void handleArgumentWithTypeTagAttr(Sema &S, Decl *D,
|
|||
|
||||
if (Attr.getNumArgs() != 2) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< /* required args = */ 3;
|
||||
<< Attr.getName() << /* required args = */ 3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3832,7 +3832,8 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
|
|||
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4079,7 +4080,8 @@ static bool handleObjCGCTypeAttr(TypeProcessingState &state,
|
|||
}
|
||||
Qualifiers::GC GCAttr;
|
||||
if (attr.getNumArgs() != 0) {
|
||||
S.Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< attr.getName() << 1;
|
||||
attr.setInvalid();
|
||||
return true;
|
||||
}
|
||||
|
@ -4463,7 +4465,8 @@ static void HandleOpenCLImageAccessAttribute(QualType& CurType,
|
|||
Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4503,7 +4506,8 @@ static void HandleVectorSizeAttr(QualType& CurType, const AttributeList &Attr,
|
|||
Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4569,7 +4573,8 @@ static void HandleExtVectorTypeAttr(QualType &CurType,
|
|||
} else {
|
||||
// check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
sizeExpr = Attr.getArg(0);
|
||||
|
@ -4594,7 +4599,8 @@ static void HandleNeonVectorTypeAttr(QualType& CurType,
|
|||
const char *AttrName) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ static void HandleMSP430InterruptAttr(Decl *d,
|
|||
const AttributeList &Attr, Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +76,8 @@ static void HandleMBlazeInterruptHandlerAttr(Decl *d, const AttributeList &Attr,
|
|||
Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,7 +92,8 @@ static void HandleMBlazeSaveVolatilesAttr(Decl *d, const AttributeList &Attr,
|
|||
Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -125,7 +128,8 @@ static void HandleX86ForceAlignArgPointerAttr(Decl *D,
|
|||
Sema &S) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,7 +181,8 @@ DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D, SourceRange Range,
|
|||
static void HandleDLLImportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,7 +228,8 @@ DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range,
|
|||
static void HandleDLLExportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 0) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -280,7 +286,8 @@ namespace {
|
|||
static void HandleMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
// Attribute can only be applied to function types.
|
||||
|
@ -296,7 +303,8 @@ static void HandleMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) {
|
|||
static void HandleNoMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) {
|
||||
// check the attribute arguments.
|
||||
if (Attr.hasParameterOrArguments()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
<< Attr.getName() << 0;
|
||||
return;
|
||||
}
|
||||
// Attribute can only be applied to function types.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
||||
|
||||
void __attribute__((annotate("foo"))) foo(float *a) {
|
||||
void __attribute__((annotate("foo"))) foo(float *a) {
|
||||
__attribute__((annotate("bar"))) int x;
|
||||
__attribute__((annotate(1))) int y; // expected-error {{argument to annotate attribute was not a string literal}}
|
||||
__attribute__((annotate("bar", 1))) int z; // expected-error {{attribute takes one argument}}
|
||||
__attribute__((annotate("bar", 1))) int z; // expected-error {{'annotate' attribute takes one argument}}
|
||||
int u = __builtin_annotation(z, (char*) 0); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
|
||||
int v = __builtin_annotation(z, (char*) L"bar"); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
|
||||
int w = __builtin_annotation(z, "foo");
|
||||
|
|
|
@ -8,11 +8,11 @@ static int g3 __attribute((cleanup(c1))); // expected-warning {{cleanup attribut
|
|||
|
||||
void t1()
|
||||
{
|
||||
int v1 __attribute((cleanup)); // expected-error {{attribute takes one argument}}
|
||||
int v2 __attribute((cleanup(1, 2))); // expected-error {{attribute takes one argument}}
|
||||
|
||||
int v1 __attribute((cleanup)); // expected-error {{'cleanup' attribute takes one argument}}
|
||||
int v2 __attribute((cleanup(1, 2))); // expected-error {{'cleanup' attribute takes one argument}}
|
||||
|
||||
static int v3 __attribute((cleanup(c1))); // expected-warning {{cleanup attribute ignored}}
|
||||
|
||||
|
||||
int v4 __attribute((cleanup(h))); // expected-error {{'cleanup' argument 'h' not found}}
|
||||
|
||||
int v5 __attribute((cleanup(c1)));
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}}
|
||||
|
||||
__attribute__((naked)) int t0(void) {
|
||||
__attribute__((naked)) int t0(void) {
|
||||
__asm__ volatile("mov r0, #0");
|
||||
}
|
||||
|
||||
void t1() __attribute__((naked));
|
||||
|
||||
void t2() __attribute__((naked(2))); // expected-error {{attribute takes no arguments}}
|
||||
void t2() __attribute__((naked(2))); // expected-error {{'naked' attribute takes no arguments}}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ int a __attribute__((nodebug));
|
|||
|
||||
void b() {
|
||||
int b __attribute__((nodebug)); // expected-warning {{'nodebug' only applies to variables with static storage duration and functions}}
|
||||
}
|
||||
}
|
||||
|
||||
void t1() __attribute__((nodebug));
|
||||
|
||||
void t2() __attribute__((nodebug(2))); // expected-error {{attribute takes no arguments}}
|
||||
void t2() __attribute__((nodebug(2))); // expected-error {{'nodebug' attribute takes no arguments}}
|
||||
|
|
|
@ -4,5 +4,5 @@ int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only
|
|||
|
||||
void t1() __attribute__((noinline));
|
||||
|
||||
void t2() __attribute__((noinline(2))); // expected-error {{attribute takes no arguments}}
|
||||
void t2() __attribute__((noinline(2))); // expected-error {{'noinline' attribute takes no arguments}}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ int f1() __attribute__((noreturn));
|
|||
|
||||
int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' only applies to function types; type here is 'int'}}
|
||||
|
||||
int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute takes no arguments}}
|
||||
int f2() __attribute__((noreturn(1, 2))); // expected-error {{'noreturn' attribute takes no arguments}}
|
||||
|
||||
void f3() __attribute__((noreturn));
|
||||
void f3() {
|
||||
|
@ -33,7 +33,7 @@ extern void f5 (unsigned long) __attribute__ ((__noreturn__));
|
|||
void
|
||||
f5 (unsigned long size)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// PR2461
|
||||
|
@ -41,4 +41,4 @@ __attribute__((noreturn)) void f(__attribute__((noreturn)) void (*x)(void)) {
|
|||
x();
|
||||
}
|
||||
|
||||
typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute takes no arguments}}
|
||||
typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{'noreturn' attribute takes no arguments}}
|
||||
|
|
|
@ -4,7 +4,7 @@ __attribute((regparm(2))) int x0(void);
|
|||
__attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires integer constant}}
|
||||
__attribute((regparm(-1))) int x2(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
|
||||
__attribute((regparm(5))) int x3(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
|
||||
__attribute((regparm(5,3))) int x4(void); // expected-error{{attribute takes one argument}}
|
||||
__attribute((regparm(5,3))) int x4(void); // expected-error{{'regparm' attribute takes one argument}}
|
||||
|
||||
void __attribute__((regparm(3))) x5(int);
|
||||
void x5(int); // expected-note{{previous declaration is here}}
|
||||
|
|
|
@ -7,6 +7,6 @@ __attribute__((returns_twice)) void t0(void) {
|
|||
|
||||
void t1() __attribute__((returns_twice));
|
||||
|
||||
void t2() __attribute__((returns_twice(2))); // expected-error {{attribute takes no arguments}}
|
||||
void t2() __attribute__((returns_twice(2))); // expected-error {{'returns_twice' attribute takes no arguments}}
|
||||
|
||||
typedef void (*t3)(void) __attribute__((returns_twice)); // expected-warning {{'returns_twice' attribute only applies to functions}}
|
||||
|
|
|
@ -9,6 +9,6 @@ int f() __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_mod
|
|||
int x __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}}
|
||||
static __thread int y __attribute((tls_model("global-dynamic"))); // no-warning
|
||||
|
||||
static __thread int y __attribute((tls_model("local", "dynamic"))); // expected-error {{attribute takes one argument}}
|
||||
static __thread int y __attribute((tls_model("local", "dynamic"))); // expected-error {{'tls_model' attribute takes one argument}}
|
||||
static __thread int y __attribute((tls_model(123))); // expected-error {{argument to tls_model attribute was not a string literal}}
|
||||
static __thread int y __attribute((tls_model("foobar"))); // expected-error {{tls_model must be "global-dynamic", "local-dynamic", "initial-exec" or "local-exec"}}
|
||||
|
|
|
@ -9,7 +9,7 @@ int f1() __attribute__((unused));
|
|||
|
||||
int g0 __attribute__((unused));
|
||||
|
||||
int f2() __attribute__((unused(1, 2))); // expected-error {{attribute takes no arguments}}
|
||||
int f2() __attribute__((unused(1, 2))); // expected-error {{'unused' attribute takes no arguments}}
|
||||
|
||||
struct Test0_unused {} __attribute__((unused));
|
||||
struct Test0_not_unused {};
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -verify
|
||||
|
||||
void __attribute__((fastcall)) foo(float *a) {
|
||||
void __attribute__((fastcall)) foo(float *a) {
|
||||
}
|
||||
|
||||
void __attribute__((stdcall)) bar(float *a) {
|
||||
void __attribute__((stdcall)) bar(float *a) {
|
||||
}
|
||||
|
||||
void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute takes no arguments}}
|
||||
void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}}
|
||||
}
|
||||
|
||||
void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
|
||||
|
@ -20,7 +20,7 @@ void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic
|
|||
|
||||
void __attribute__((cdecl)) ctest0() {}
|
||||
|
||||
void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute takes no arguments}}
|
||||
void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' attribute takes no arguments}}
|
||||
|
||||
void (__attribute__((fastcall)) *pfoo)(float*) = foo;
|
||||
|
||||
|
@ -36,9 +36,9 @@ void (__attribute__((cdecl)) *pctest2)() = ctest2;
|
|||
typedef void (__attribute__((fastcall)) *Handler) (float *);
|
||||
Handler H = foo;
|
||||
|
||||
int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{attribute takes one argument}}
|
||||
int __attribute__((pcs())) pcs2(void); // expected-error {{attribute takes one argument}}
|
||||
int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{attribute takes one argument}}
|
||||
int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{'pcs' attribute takes one argument}}
|
||||
int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute takes one argument}}
|
||||
int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute takes one argument}}
|
||||
int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires parameter 1 to be a string}}
|
||||
/* These are ignored because the target is i386 and not ARM */
|
||||
int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
void foo32();
|
||||
void foo16();
|
||||
void __attribute__((nomips16)) foo32();
|
||||
void __attribute__((mips16)) foo16();
|
||||
void __attribute__((nomips16)) foo32();
|
||||
void __attribute__((mips16)) foo16();
|
||||
|
||||
void __attribute__((nomips16)) foo32_();
|
||||
void __attribute__((mips16)) foo16_();
|
||||
void __attribute__((nomips16)) foo32_();
|
||||
void __attribute__((mips16)) foo16_();
|
||||
void foo32_();
|
||||
void foo16_();
|
||||
|
||||
void foo32__() __attribute__((nomips16));
|
||||
void foo32__() __attribute__((mips16));
|
||||
void foo32__() __attribute__((nomips16));
|
||||
void foo32__() __attribute__((mips16));
|
||||
|
||||
void foo32a() __attribute__((nomips16(xyz))) ; // expected-error {{attribute takes no arguments}}
|
||||
void __attribute__((mips16(xyz))) foo16a(); // expected-error {{attribute takes no arguments}}
|
||||
void foo32a() __attribute__((nomips16(xyz))) ; // expected-error {{'nomips16' attribute takes no arguments}}
|
||||
void __attribute__((mips16(xyz))) foo16a(); // expected-error {{'mips16' attribute takes no arguments}}
|
||||
|
||||
void __attribute__((nomips16(1, 2))) foo32b(); // expected-error {{attribute takes no arguments}}
|
||||
void __attribute__((mips16(1, 2))) foo16b(); // expected-error {{attribute takes no arguments}}
|
||||
void __attribute__((nomips16(1, 2))) foo32b(); // expected-error {{'nomips16' attribute takes no arguments}}
|
||||
void __attribute__((mips16(1, 2))) foo16b(); // expected-error {{'mips16' attribute takes no arguments}}
|
||||
|
||||
|
||||
__attribute((nomips16)) int a; // expected-error {{attribute only applies to functions}}
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
|
|||
typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
|
||||
|
||||
// The attributes must have a single argument.
|
||||
typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}}
|
||||
typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{'neon_vector_type' attribute takes one argument}}
|
||||
|
||||
// The number of elements must be an ICE.
|
||||
typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute can only be applied to a function}}
|
||||
void params(void) __attribute__((overloadable(12))); // expected-error {{attribute takes no arguments}}
|
||||
void params(void) __attribute__((overloadable(12))); // expected-error {{'overloadable' attribute takes no arguments}}
|
||||
|
||||
int *f(int) __attribute__((overloadable)); // expected-note 2{{previous overload of function is here}}
|
||||
float *f(float); // expected-error{{overloaded function 'f' must have the 'overloadable' attribute}}
|
||||
|
@ -66,7 +66,7 @@ extern int __attribute__((overloadable)) f0(); // expected-error{{'overloadable'
|
|||
typedef int f1_type();
|
||||
f1_type __attribute__((overloadable)) f1; // expected-error{{'overloadable' function 'f1' must have a prototype}}
|
||||
|
||||
void test() {
|
||||
void test() {
|
||||
f0();
|
||||
f1();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
void noanal_fun() NO_SANITIZE_ADDRESS;
|
||||
|
||||
void noanal_fun_args() __attribute__((no_sanitize_address(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'no_sanitize_address' attribute takes no arguments}}
|
||||
|
||||
int noanal_testfn(int y) NO_SANITIZE_ADDRESS;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
void noanal_fun() NO_SANITIZE_MEMORY;
|
||||
|
||||
void noanal_fun_args() __attribute__((no_sanitize_memory(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'no_sanitize_memory' attribute takes no arguments}}
|
||||
|
||||
int noanal_testfn(int y) NO_SANITIZE_MEMORY;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
void noanal_fun() NO_SANITIZE_THREAD;
|
||||
|
||||
void noanal_fun_args() __attribute__((no_sanitize_thread(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'no_sanitize_thread' attribute takes no arguments}}
|
||||
|
||||
int noanal_testfn(int y) NO_SANITIZE_THREAD;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ extern Two koo[];
|
|||
|
||||
Two foo __attribute__((init_priority(101))) ( 5, 6 );
|
||||
|
||||
Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{attribute takes one argument}}
|
||||
Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_priority' attribute takes one argument}}
|
||||
|
||||
Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority attribute requires integer constant between 101 and 65535 inclusive}}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class Bar {
|
|||
void noanal_fun() NO_THREAD_SAFETY_ANALYSIS;
|
||||
|
||||
void noanal_fun_args() __attribute__((no_thread_safety_analysis(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'no_thread_safety_analysis' attribute takes no arguments}}
|
||||
|
||||
int noanal_testfn(int y) NO_THREAD_SAFETY_ANALYSIS;
|
||||
|
||||
|
@ -142,13 +142,13 @@ void noanal_fun_params(int lvar NO_THREAD_SAFETY_ANALYSIS); // \
|
|||
int gv_var_noargs GUARDED_VAR;
|
||||
|
||||
int gv_var_args __attribute__((guarded_var(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'guarded_var' attribute takes no arguments}}
|
||||
|
||||
class GVFoo {
|
||||
private:
|
||||
int gv_field_noargs GUARDED_VAR;
|
||||
int gv_field_args __attribute__((guarded_var(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'guarded_var' attribute takes no arguments}}
|
||||
};
|
||||
|
||||
class GUARDED_VAR GV { // \
|
||||
|
@ -188,7 +188,7 @@ class PGVFoo {
|
|||
int field_noargs PT_GUARDED_VAR; // \
|
||||
// expected-warning {{'pt_guarded_var' only applies to pointer types; type here is 'int'}}
|
||||
int *gv_field_args __attribute__((pt_guarded_var(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'pt_guarded_var' attribute takes no arguments}}
|
||||
};
|
||||
|
||||
class PT_GUARDED_VAR PGV { // \
|
||||
|
@ -196,7 +196,7 @@ class PT_GUARDED_VAR PGV { // \
|
|||
};
|
||||
|
||||
int *pgv_var_args __attribute__((pt_guarded_var(1))); // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'pt_guarded_var' attribute takes no arguments}}
|
||||
|
||||
|
||||
void pgv_function() PT_GUARDED_VAR; // \
|
||||
|
@ -225,7 +225,7 @@ class LOCKABLE LTestClass {
|
|||
};
|
||||
|
||||
class __attribute__((lockable (1))) LTestClass_args { // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'lockable' attribute takes no arguments}}
|
||||
};
|
||||
|
||||
void l_test_function() LOCKABLE; // \
|
||||
|
@ -265,7 +265,7 @@ class SCOPED_LOCKABLE SLTestClass {
|
|||
};
|
||||
|
||||
class __attribute__((scoped_lockable (1))) SLTestClass_args { // \
|
||||
// expected-error {{attribute takes no arguments}}
|
||||
// expected-error {{'scoped_lockable' attribute takes no arguments}}
|
||||
};
|
||||
|
||||
void sl_test_function() SCOPED_LOCKABLE; // \
|
||||
|
@ -308,15 +308,15 @@ void sl_function_params(int lvar SCOPED_LOCKABLE); // \
|
|||
int gb_var_arg GUARDED_BY(mu1);
|
||||
|
||||
int gb_var_args __attribute__((guarded_by(mu1, mu2))); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'guarded_by' attribute takes one argument}}
|
||||
|
||||
int gb_var_noargs __attribute__((guarded_by)); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'guarded_by' attribute takes one argument}}
|
||||
|
||||
class GBFoo {
|
||||
private:
|
||||
int gb_field_noargs __attribute__((guarded_by)); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'guarded_by' attribute takes one argument}}
|
||||
int gb_field_args GUARDED_BY(mu1);
|
||||
};
|
||||
|
||||
|
@ -374,12 +374,12 @@ int gb_var_arg_bad_4 GUARDED_BY(umu); // \
|
|||
//1. Check applied to the right types & argument number
|
||||
|
||||
int *pgb_var_noargs __attribute__((pt_guarded_by)); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'pt_guarded_by' attribute takes one argument}}
|
||||
|
||||
int *pgb_ptr_var_arg PT_GUARDED_BY(mu1);
|
||||
|
||||
int *pgb_ptr_var_args __attribute__((pt_guarded_by(mu1, mu2))); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'pt_guarded_by' attribute takes one argument}}
|
||||
|
||||
int pgb_var_args PT_GUARDED_BY(mu1); // \
|
||||
// expected-warning {{'pt_guarded_by' only applies to pointer types; type here is 'int'}}
|
||||
|
@ -387,7 +387,7 @@ int pgb_var_args PT_GUARDED_BY(mu1); // \
|
|||
class PGBFoo {
|
||||
private:
|
||||
int *pgb_field_noargs __attribute__((pt_guarded_by)); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'pt_guarded_by' attribute takes one argument}}
|
||||
int *pgb_field_args PT_GUARDED_BY(mu1);
|
||||
};
|
||||
|
||||
|
@ -931,12 +931,12 @@ int uf_function_bad_7() UNLOCK_FUNCTION(0); // \
|
|||
// Takes exactly one argument, a var/field
|
||||
|
||||
void lr_function() __attribute__((lock_returned)); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'lock_returned' attribute takes one argument}}
|
||||
|
||||
void lr_function_arg() LOCK_RETURNED(mu1);
|
||||
|
||||
void lr_function_args() __attribute__((lock_returned(mu1, mu2))); // \
|
||||
// expected-error {{attribute takes one argument}}
|
||||
// expected-error {{'lock_returned' attribute takes one argument}}
|
||||
|
||||
int lr_testfn(int y) LOCK_RETURNED(mu1);
|
||||
|
||||
|
|
|
@ -87,6 +87,6 @@ __attribute__((objc_arc_weak_reference_unavailable))
|
|||
@synthesize font = _font;
|
||||
@end
|
||||
|
||||
__attribute__((objc_arc_weak_reference_unavailable(1))) // expected-error {{attribute takes no arguments}}
|
||||
__attribute__((objc_arc_weak_reference_unavailable(1))) // expected-error {{'objc_arc_weak_reference_unavailable' attribute takes no arguments}}
|
||||
@interface I3
|
||||
@end
|
||||
|
|
|
@ -4,7 +4,7 @@ static id __attribute((objc_gc(strong))) b;
|
|||
|
||||
static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
|
||||
static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
|
||||
static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute takes one argument}}
|
||||
static id __attribute((objc_gc(foo, 456))) e; // expected-error{{'objc_gc' attribute takes one argument}}
|
||||
static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}}
|
||||
|
||||
static int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}}
|
||||
|
|
|
@ -15,6 +15,6 @@ __attribute__((objc_root_class)) static void nonClassDeclaration() // expected-
|
|||
{
|
||||
}
|
||||
|
||||
__attribute__((objc_root_class(1))) // expected-error {{attribute takes no arguments}}
|
||||
__attribute__((objc_root_class(1))) // expected-error {{'objc_root_class' attribute takes no arguments}}
|
||||
@interface I1
|
||||
@end
|
||||
|
|
|
@ -154,6 +154,6 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
|
|||
@synthesize failureCount = _failureCount;
|
||||
@end
|
||||
|
||||
__attribute ((objc_requires_property_definitions(1))) // expected-error {{attribute takes no arguments}}
|
||||
__attribute ((objc_requires_property_definitions(1))) // expected-error {{'objc_requires_property_definitions' attribute takes no arguments}}
|
||||
@interface I1
|
||||
@end
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
extern NSString *fa2 (const NSString *) __attribute__((format_arg(1)));
|
||||
extern NSString *fa3 (NSString *) __attribute__((format_arg(1)));
|
||||
|
||||
extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{attribute takes one argument}}
|
||||
extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute takes one argument}}
|
||||
extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute takes one argument}}
|
||||
extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{'format_arg' attribute takes one argument}}
|
||||
extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{'format_arg' attribute takes one argument}}
|
||||
extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{'format_arg' attribute takes one argument}}
|
||||
|
||||
struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
|
||||
union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
typedef void *PV;
|
||||
@interface BAD {
|
||||
__attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
|
||||
__attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{'iboutletcollection' attribute takes one argument}}
|
||||
__attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
|
||||
__attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
|
||||
__attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{instance variable with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
|
||||
__attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
|
||||
__attribute__((iboutlet)) int ivar6; // expected-warning {{instance variable with 'iboutlet' attribute must be an object type}}
|
||||
}
|
||||
@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
|
||||
@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{'iboutletcollection' attribute takes one argument}}
|
||||
@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
|
||||
|
||||
@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
||||
|
||||
typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
|
||||
typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-error {{attribute takes no arguments}}
|
||||
typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-error {{'NSObject' attribute takes no arguments}}
|
||||
|
||||
static int count;
|
||||
static CGColorRef tmp = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -verify %s
|
||||
|
||||
kernel __attribute__((vec_type_hint)) void kernel1() {} //expected-error{{attribute takes one argument}}
|
||||
kernel __attribute__((vec_type_hint)) void kernel1() {} //expected-error{{'vec_type_hint' attribute takes one argument}}
|
||||
|
||||
kernel __attribute__((vec_type_hint(not_type))) void kernel2() {} //expected-error{{unknown type name 'not_type'}}
|
||||
|
||||
|
@ -10,7 +10,7 @@ kernel __attribute__((vec_type_hint(bool))) void kernel4() {} //expected-error{{
|
|||
|
||||
kernel __attribute__((vec_type_hint(int))) __attribute__((vec_type_hint(float))) void kernel5() {} //expected-warning{{attribute 'vec_type_hint' is already applied with different parameters}}
|
||||
|
||||
kernel __attribute__((work_group_size_hint(8,16,32,4))) void kernel6() {} //expected-error{{attribute requires exactly 3 arguments}}
|
||||
kernel __attribute__((work_group_size_hint(8,16,32,4))) void kernel6() {} //expected-error{{'work_group_size_hint' attribute requires exactly 3 arguments}}
|
||||
|
||||
kernel __attribute__((work_group_size_hint(1,2,3))) __attribute__((work_group_size_hint(3,2,1))) void kernel7() {} //expected-warning{{attribute 'work_group_size_hint' is already applied with different parameters}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue