Revert r266415, it broke parsing SDK headers (PR27367).

llvm-svn: 266431
This commit is contained in:
Nico Weber 2016-04-15 14:35:06 +00:00
parent 6cb18a09b1
commit 917fc9d7cb
20 changed files with 48 additions and 163 deletions

View File

@ -152,8 +152,8 @@ public:
enum {
/// The maximum supported address space number.
/// 23 bits should be enough for anyone.
MaxAddressSpace = 0x7fffffu,
/// 24 bits should be enough for anyone.
MaxAddressSpace = 0xffffffu,
/// The width of the "fast" qualifier mask.
FastWidth = 3,
@ -265,13 +265,6 @@ public:
Mask |= mask;
}
bool hasUnaligned() const { return Mask & UMask; }
void setUnaligned(bool flag) {
Mask = (Mask & ~UMask) | (flag ? UMask : 0);
}
void removeUnaligned() { Mask &= ~UMask; }
void addUnaligned() { Mask |= UMask; }
bool hasObjCGCAttr() const { return Mask & GCAttrMask; }
GC getObjCGCAttr() const { return GC((Mask & GCAttrMask) >> GCAttrShift); }
void setObjCGCAttr(GC type) {
@ -440,9 +433,7 @@ public:
// ObjC lifetime qualifiers must match exactly.
getObjCLifetime() == other.getObjCLifetime() &&
// CVR qualifiers may subset.
(((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
// U qualifier may superset.
(!(other.Mask & UMask) || (Mask & UMask));
(((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask));
}
/// \brief Determines if these qualifiers compatibly include another set of
@ -510,19 +501,16 @@ public:
private:
// bits: |0 1 2|3|4 .. 5|6 .. 8|9 ... 31|
// |C R V|U|GCAttr|Lifetime|AddressSpace|
// bits: |0 1 2|3 .. 4|5 .. 7|8 ... 31|
// |C R V|GCAttr|Lifetime|AddressSpace|
uint32_t Mask;
static const uint32_t UMask = 0x8;
static const uint32_t UShift = 3;
static const uint32_t GCAttrMask = 0x30;
static const uint32_t GCAttrShift = 4;
static const uint32_t LifetimeMask = 0x1C0;
static const uint32_t LifetimeShift = 6;
static const uint32_t AddressSpaceMask =
~(CVRMask | UMask | GCAttrMask | LifetimeMask);
static const uint32_t AddressSpaceShift = 9;
static const uint32_t GCAttrMask = 0x18;
static const uint32_t GCAttrShift = 3;
static const uint32_t LifetimeMask = 0xE0;
static const uint32_t LifetimeShift = 5;
static const uint32_t AddressSpaceMask = ~(CVRMask|GCAttrMask|LifetimeMask);
static const uint32_t AddressSpaceShift = 8;
};
/// A std::pair-like structure for storing a qualified type split

View File

@ -25,7 +25,7 @@ namespace LangAS {
/// This uses a high starting offset so as not to conflict with any address
/// space used by a target.
enum ID {
Offset = 0x7FFF00,
Offset = 0xFFFF00,
opencl_global = Offset,
opencl_local,

View File

@ -2149,6 +2149,10 @@ def InitSeg : Attr {
}];
}
def Unaligned : IgnoredAttr {
let Spellings = [Keyword<"__unaligned">];
}
def LoopHint : Attr {
/// #pragma clang loop <option> directive
/// vectorize: vectorizes loop operations if State == Enable.

View File

@ -313,10 +313,8 @@ public:
TQ_volatile = 4,
// This has no corresponding Qualifiers::TQ value, because it's not treated
// as a qualifier in our type system.
TQ_atomic = 8,
// There is no corresponding Qualifiers::TQ value, but it's kept separately
// in a dedicated Qualifiers::Mask bit.
TQ_unaligned = 16 };
TQ_atomic = 8
};
/// ParsedSpecifiers - Flags to query which specifiers were applied. This is
/// returned by getParsedSpecifiers.
@ -346,7 +344,7 @@ private:
unsigned TypeSpecPipe : 1;
// type-qualifiers
unsigned TypeQualifiers : 5; // Bitwise OR of TQ.
unsigned TypeQualifiers : 4; // Bitwise OR of TQ.
// function-specifier
unsigned FS_inline_specified : 1;
@ -388,8 +386,7 @@ private:
/// TSTNameLoc provides source range info for tag types.
SourceLocation TSTNameLoc;
SourceRange TypeofParensRange;
SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
TQ_unalignedLoc;
SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc;
SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
SourceLocation FS_forceinlineLoc;
SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc, ConceptLoc;
@ -543,7 +540,6 @@ public:
SourceLocation getRestrictSpecLoc() const { return TQ_restrictLoc; }
SourceLocation getVolatileSpecLoc() const { return TQ_volatileLoc; }
SourceLocation getAtomicSpecLoc() const { return TQ_atomicLoc; }
SourceLocation getUnalignedSpecLoc() const { return TQ_unalignedLoc; }
SourceLocation getPipeLoc() const { return TQ_pipeLoc; }
/// \brief Clear out all of the type qualifiers.
@ -553,7 +549,6 @@ public:
TQ_restrictLoc = SourceLocation();
TQ_volatileLoc = SourceLocation();
TQ_atomicLoc = SourceLocation();
TQ_unalignedLoc = SourceLocation();
TQ_pipeLoc = SourceLocation();
}
@ -1119,8 +1114,8 @@ struct DeclaratorChunk {
};
struct PointerTypeInfo : TypeInfoCommon {
/// The type qualifiers: const/volatile/restrict/atomic/unaligned.
unsigned TypeQuals : 5;
/// The type qualifiers: const/volatile/restrict/atomic.
unsigned TypeQuals : 4;
/// The location of the const-qualifier, if any.
unsigned ConstQualLoc;
@ -1134,9 +1129,6 @@ struct DeclaratorChunk {
/// The location of the _Atomic-qualifier, if any.
unsigned AtomicQualLoc;
/// The location of the __unaligned-qualifier, if any.
unsigned UnalignedQualLoc;
void destroy() {
}
};
@ -1477,8 +1469,7 @@ struct DeclaratorChunk {
SourceLocation ConstQualLoc,
SourceLocation VolatileQualLoc,
SourceLocation RestrictQualLoc,
SourceLocation AtomicQualLoc,
SourceLocation UnalignedQualLoc) {
SourceLocation AtomicQualLoc) {
DeclaratorChunk I;
I.Kind = Pointer;
I.Loc = Loc;
@ -1487,7 +1478,6 @@ struct DeclaratorChunk {
I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
I.Ptr.AtomicQualLoc = AtomicQualLoc.getRawEncoding();
I.Ptr.UnalignedQualLoc = UnalignedQualLoc.getRawEncoding();
I.Ptr.AttrList = nullptr;
return I;
}

View File

@ -1647,8 +1647,7 @@ public:
SourceLocation ConstQualLoc = SourceLocation(),
SourceLocation VolatileQualLoc = SourceLocation(),
SourceLocation RestrictQualLoc = SourceLocation(),
SourceLocation AtomicQualLoc = SourceLocation(),
SourceLocation UnalignedQualLoc = SourceLocation());
SourceLocation AtomicQualLoc = SourceLocation());
static bool adjustContextForLocalExternDecl(DeclContext *&DC);
void DiagnoseFunctionSpecifiers(const DeclSpec &DS);

View File

@ -1444,9 +1444,6 @@ void MicrosoftCXXNameMangler::manglePointerExtQualifiers(Qualifiers Quals,
(PointeeType.isNull() || !PointeeType->isFunctionType()))
Out << 'E';
if (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned())
Out << 'F';
if (HasRestrict)
Out << 'I';
}
@ -1580,8 +1577,6 @@ void MicrosoftCXXNameMangler::mangleType(QualType T, SourceRange Range,
}
break;
case QMM_Result:
// Presence of __unaligned qualifier shouldn't affect mangling here.
Quals.removeUnaligned();
if ((!IsPointer && Quals) || isa<TagType>(T)) {
Out << '?';
mangleQualifiers(Quals, false);

View File

@ -1592,12 +1592,6 @@ void Qualifiers::print(raw_ostream &OS, const PrintingPolicy& Policy,
AppendTypeQualList(OS, quals, Policy.LangOpts.C99);
addSpace = true;
}
if (hasUnaligned()) {
if (addSpace)
OS << ' ';
OS << "__unaligned";
addSpace = true;
}
if (unsigned addrspace = getAddressSpace()) {
if (addSpace)
OS << ' ';

View File

@ -609,6 +609,7 @@ void Parser::ParseMicrosoftTypeAttributes(ParsedAttributes &attrs) {
case tok::kw___ptr64:
case tok::kw___w64:
case tok::kw___ptr32:
case tok::kw___unaligned:
case tok::kw___sptr:
case tok::kw___uptr: {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
@ -3086,11 +3087,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
break;
}
case tok::kw___unaligned:
isInvalid = DS.SetTypeQual(DeclSpec::TQ_unaligned, Loc, PrevSpec, DiagID,
getLangOpts());
break;
case tok::kw___sptr:
case tok::kw___uptr:
case tok::kw___ptr64:
@ -3101,6 +3097,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
case tok::kw___fastcall:
case tok::kw___thiscall:
case tok::kw___vectorcall:
case tok::kw___unaligned:
ParseMicrosoftTypeAttributes(DS.getAttributes());
continue;
@ -4822,10 +4819,6 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs,
ParseOpenCLQualifiers(DS.getAttributes());
break;
case tok::kw___unaligned:
isInvalid = DS.SetTypeQual(DeclSpec::TQ_unaligned, Loc, PrevSpec, DiagID,
getLangOpts());
break;
case tok::kw___uptr:
// GNU libc headers in C mode use '__uptr' as an identifer which conflicts
// with the MS modifier keyword.
@ -4843,6 +4836,7 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs,
case tok::kw___fastcall:
case tok::kw___thiscall:
case tok::kw___vectorcall:
case tok::kw___unaligned:
if (AttrReqs & AR_DeclspecAttributesParsed) {
ParseMicrosoftTypeAttributes(DS.getAttributes());
continue;
@ -5065,8 +5059,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
DS.getConstSpecLoc(),
DS.getVolatileSpecLoc(),
DS.getRestrictSpecLoc(),
DS.getAtomicSpecLoc(),
DS.getUnalignedSpecLoc()),
DS.getAtomicSpecLoc()),
DS.getAttributes(),
SourceLocation());
else

View File

@ -833,7 +833,7 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract,
// '(' abstract-declarator ')'
if (Tok.isOneOf(tok::kw___attribute, tok::kw___declspec, tok::kw___cdecl,
tok::kw___stdcall, tok::kw___fastcall, tok::kw___thiscall,
tok::kw___vectorcall))
tok::kw___vectorcall, tok::kw___unaligned))
return TPResult::True; // attributes indicate declaration
TPResult TPR = TryParseDeclarator(mayBeAbstract, mayHaveIdentifier);
if (TPR != TPResult::Ambiguous)

View File

@ -494,7 +494,6 @@ const char *DeclSpec::getSpecifierName(TQ T) {
case DeclSpec::TQ_restrict: return "restrict";
case DeclSpec::TQ_volatile: return "volatile";
case DeclSpec::TQ_atomic: return "_Atomic";
case DeclSpec::TQ_unaligned: return "__unaligned";
}
llvm_unreachable("Unknown typespec!");
}
@ -797,7 +796,6 @@ bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
case TQ_restrict: TQ_restrictLoc = Loc; return false;
case TQ_volatile: TQ_volatileLoc = Loc; return false;
case TQ_atomic: TQ_atomicLoc = Loc; return false;
case TQ_unaligned: TQ_unalignedLoc = Loc; return false;
}
llvm_unreachable("Unknown type qualifier!");
@ -963,10 +961,10 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
TypeSpecSign != TSS_unspecified ||
TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
TypeQualifiers)) {
const unsigned NumLocs = 9;
const unsigned NumLocs = 8;
SourceLocation ExtraLocs[NumLocs] = {
TSWLoc, TSCLoc, TSSLoc, AltiVecLoc,
TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc
TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc
};
FixItHint Hints[NumLocs];
SourceLocation FirstLoc;

View File

@ -3812,9 +3812,6 @@ void Sema::CodeCompleteTypeQualifiers(DeclSpec &DS) {
if (getLangOpts().C11 &&
!(DS.getTypeQualifiers() & DeclSpec::TQ_atomic))
Results.AddResult("_Atomic");
if (getLangOpts().MSVCCompat &&
!(DS.getTypeQualifiers() & DeclSpec::TQ_unaligned))
Results.AddResult("__unaligned");
Results.ExitScope();
HandleCodeCompleteResults(this, CodeCompleter,
Results.getCompletionContext(),

View File

@ -3974,8 +3974,6 @@ Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
// Restrict is covered above.
if (DS.getTypeQualifiers() & DeclSpec::TQ_atomic)
Diag(DS.getAtomicSpecLoc(), DiagID) << "_Atomic";
if (DS.getTypeQualifiers() & DeclSpec::TQ_unaligned)
Diag(DS.getUnalignedSpecLoc(), DiagID) << "__unaligned";
}
// Warn about ignored type attributes, for example:
@ -4233,11 +4231,6 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
diag::ext_anonymous_struct_union_qualified)
<< Record->isUnion() << "_Atomic"
<< FixItHint::CreateRemoval(DS.getAtomicSpecLoc());
if (DS.getTypeQualifiers() & DeclSpec::TQ_unaligned)
Diag(DS.getUnalignedSpecLoc(),
diag::ext_anonymous_struct_union_qualified)
<< Record->isUnion() << "__unaligned"
<< FixItHint::CreateRemoval(DS.getUnalignedSpecLoc());
DS.ClearTypeQualifiers();
}

View File

@ -1503,7 +1503,6 @@ void Sema::actOnObjCTypeArgsOrProtocolQualifiers(
SourceLocation(),
SourceLocation(),
SourceLocation(),
SourceLocation(),
SourceLocation()),
parsedAttrs,
starLoc);

View File

@ -7138,7 +7138,7 @@ checkPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType) {
else if (lhq.getObjCLifetime() != rhq.getObjCLifetime())
ConvTy = Sema::IncompatiblePointerDiscardsQualifiers;
// For GCC/MS compatibility, other qualifier mismatches are treated
// For GCC compatibility, other qualifier mismatches are treated
// as still compatible in C.
else ConvTy = Sema::CompatiblePointerDiscardsQualifiers;
}

View File

@ -1742,13 +1742,12 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
}
QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
unsigned CVRAU, const DeclSpec *DS) {
unsigned CVRA, const DeclSpec *DS) {
if (T.isNull())
return QualType();
// Convert from DeclSpec::TQ to Qualifiers::TQ by just dropping TQ_atomic and
// TQ_unaligned;
unsigned CVR = CVRAU & ~DeclSpec::TQ_atomic & ~DeclSpec::TQ_unaligned;
// Convert from DeclSpec::TQ to Qualifiers::TQ by just dropping TQ_atomic.
unsigned CVR = CVRA & ~DeclSpec::TQ_atomic;
// C11 6.7.3/5:
// If the same qualifier appears more than once in the same
@ -1758,7 +1757,7 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
// It's not specified what happens when the _Atomic qualifier is applied to
// a type specified with the _Atomic specifier, but we assume that this
// should be treated as if the _Atomic qualifier appeared multiple times.
if (CVRAU & DeclSpec::TQ_atomic && !T->isAtomicType()) {
if (CVRA & DeclSpec::TQ_atomic && !T->isAtomicType()) {
// C11 6.7.3/5:
// If other qualifiers appear along with the _Atomic qualifier in a
// specifier-qualifier-list, the resulting type is the so-qualified
@ -1775,9 +1774,7 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
return BuildQualifiedType(T, Loc, Split.Quals);
}
Qualifiers Q = Qualifiers::fromCVRMask(CVR);
Q.setUnaligned(CVRAU & DeclSpec::TQ_unaligned);
return BuildQualifiedType(T, Loc, Q, DS);
return BuildQualifiedType(T, Loc, Qualifiers::fromCVRMask(CVR), DS);
}
/// \brief Build a paren type including \p T.
@ -2619,8 +2616,7 @@ void Sema::diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
SourceLocation ConstQualLoc,
SourceLocation VolatileQualLoc,
SourceLocation RestrictQualLoc,
SourceLocation AtomicQualLoc,
SourceLocation UnalignedQualLoc) {
SourceLocation AtomicQualLoc) {
if (!Quals)
return;
@ -2628,21 +2624,20 @@ void Sema::diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
const char *Name;
unsigned Mask;
SourceLocation Loc;
} const QualKinds[5] = {
} const QualKinds[4] = {
{ "const", DeclSpec::TQ_const, ConstQualLoc },
{ "volatile", DeclSpec::TQ_volatile, VolatileQualLoc },
{ "restrict", DeclSpec::TQ_restrict, RestrictQualLoc },
{ "_Atomic", DeclSpec::TQ_atomic, AtomicQualLoc },
{ "__unaligned", DeclSpec::TQ_unaligned, UnalignedQualLoc }
{ "_Atomic", DeclSpec::TQ_atomic, AtomicQualLoc }
};
SmallString<32> QualStr;
unsigned NumQuals = 0;
SourceLocation Loc;
FixItHint FixIts[5];
FixItHint FixIts[4];
// Build a string naming the redundant qualifiers.
for (unsigned I = 0; I != 5; ++I) {
for (unsigned I = 0; I != 4; ++I) {
if (Quals & QualKinds[I].Mask) {
if (!QualStr.empty()) QualStr += ' ';
QualStr += QualKinds[I].Name;
@ -2694,8 +2689,7 @@ static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy,
SourceLocation::getFromRawEncoding(PTI.ConstQualLoc),
SourceLocation::getFromRawEncoding(PTI.VolatileQualLoc),
SourceLocation::getFromRawEncoding(PTI.RestrictQualLoc),
SourceLocation::getFromRawEncoding(PTI.AtomicQualLoc),
SourceLocation::getFromRawEncoding(PTI.UnalignedQualLoc));
SourceLocation::getFromRawEncoding(PTI.AtomicQualLoc));
return;
}
@ -2731,8 +2725,7 @@ static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy,
D.getDeclSpec().getConstSpecLoc(),
D.getDeclSpec().getVolatileSpecLoc(),
D.getDeclSpec().getRestrictSpecLoc(),
D.getDeclSpec().getAtomicSpecLoc(),
D.getDeclSpec().getUnalignedSpecLoc());
D.getDeclSpec().getAtomicSpecLoc());
}
static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,

View File

@ -293,14 +293,3 @@ int PR26105() {
}
// CHECK-DAG: @"\01??R<lambda_0>@?0??PR26105@@YAHXZ@QBE@H@Z"
// CHECK-DAG: @"\01??R<lambda_1>@?0???R<lambda_0>@?0??PR26105@@YAHXZ@QBE@H@Z@QBE@H@Z"
int __unaligned * unaligned_foo1() { return 0; }
int __unaligned * __unaligned * unaligned_foo2() { return 0; }
__unaligned int unaligned_foo3() { return 0; }
void unaligned_foo4(int __unaligned *p1) {}
// CHECK-DAG: @"\01?unaligned_foo1@@YAPFAHXZ"
// CHECK-DAG: @"\01?unaligned_foo2@@YAPFAPFAHXZ"
// CHECK-DAG: @"\01?unaligned_foo3@@YAHXZ"
// CHECK-DAG: @"\01?unaligned_foo4@@YAXPFAH@Z"

View File

@ -170,11 +170,3 @@ void myprintf(const char *f, ...) {
__va_start(ap, f); // expected-warning {{incompatible pointer types passing 'my_va_list'}}
}
}
// __unaligned handling
void test_unaligned() {
__unaligned int *p1 = 0;
int *p2 = p1; // expected-warning {{initializing 'int *' with an expression of type '__unaligned int *' discards qualifiers}}
__unaligned int *p3 = p2;
}

View File

@ -20,7 +20,7 @@ void foo(_AS3 float *a,
_AS1 int arrarr[5][5]; // expected-error {{automatic variable qualified with an address space}}
__attribute__((address_space(-1))) int *_boundsA; // expected-error {{address space is negative}}
__attribute__((address_space(0x7FFFFF))) int *_boundsB;
__attribute__((address_space(0xFFFFFF))) int *_boundsB;
__attribute__((address_space(0x1000000))) int *_boundsC; // expected-error {{address space is larger than the maximum supported}}
// chosen specifically to overflow 32 bits and come out reasonable
__attribute__((address_space(4294967500))) int *_boundsD; // expected-error {{address space is larger than the maximum supported}}

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
#define OPENCL_CONSTANT 8388354
#define OPENCL_CONSTANT 16776962
int __attribute__((address_space(OPENCL_CONSTANT))) c[3] = {0};
void foo() {

View File

@ -1,7 +1,5 @@
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions
#if TEST1
// Microsoft doesn't validate exception specification.
namespace microsoft_exception_spec {
@ -82,32 +80,7 @@ struct M {
// __unaligned handling
typedef char __unaligned *aligned_type;
typedef struct UnalignedTag { int f; } __unaligned *aligned_type2;
typedef char __unaligned aligned_type3;
// Check that __unaligned qualifier can be used for overloading
void foo_unaligned(int *arg) {}
void foo_unaligned(__unaligned int *arg) {}
void foo_unaligned(int arg) {} // expected-note {{previous definition is here}}
void foo_unaligned(__unaligned int arg) {} // expected-error {{redefinition of 'foo_unaligned'}}
class A_unaligned {};
class B_unaligned : public A_unaligned {};
int foo_unaligned(__unaligned A_unaligned *arg) { return 0; }
void *foo_unaligned(B_unaligned *arg) { return 0; }
void test_unaligned() {
int *p1 = 0;
foo_unaligned(p1);
__unaligned int *p2 = 0;
foo_unaligned(p2);
__unaligned B_unaligned *p3 = 0;
int p4 = foo_unaligned(p3);
B_unaligned *p5 = p3; // expected-error {{cannot initialize a variable of type 'B_unaligned *' with an lvalue of type '__unaligned B_unaligned *'}}
__unaligned B_unaligned *p6 = p3;
}
template<typename T> void h1(T (__stdcall M::* const )()) { }
@ -447,15 +420,3 @@ struct S {
int S::fn() { return 0; } // expected-warning {{is missing exception specification}}
}
#elif TEST2
// Check that __unaligned is not recognized if MS extensions are not enabled
typedef char __unaligned *aligned_type; // expected-error {{expected ';' after top level declarator}}
#else
#error Unknown test mode
#endif