summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParsePragma.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-10-22 21:08:43 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-10-22 21:08:43 +0000
commit48c28fa6db071750afb134a2841c98993a7c48da (patch)
tree0dd1b99ffbe3613d1cebe53b76cac1f0f7c50e1a /clang/lib/Parse/ParsePragma.cpp
parentce6c67e040e5e3853494d00f1d127f50088ffa91 (diff)
downloadbcm5719-llvm-48c28fa6db071750afb134a2841c98993a7c48da.tar.gz
bcm5719-llvm-48c28fa6db071750afb134a2841c98993a7c48da.zip
Parse: Ignore "long" and "short" in #pragma section
This fixes PR21337. llvm-svn: 220429
Diffstat (limited to 'clang/lib/Parse/ParsePragma.cpp')
-rw-r--r--clang/lib/Parse/ParsePragma.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 8c3fb7a5695..473be5467ee 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -532,9 +532,18 @@ bool Parser::HandlePragmaMSSection(StringRef PragmaName,
<< PragmaName;
return false;
}
- int SectionFlags = 0;
+ int SectionFlags = ASTContext::PSF_Read;
+ bool SectionFlagsAreDefault = true;
while (Tok.is(tok::comma)) {
PP.Lex(Tok); // ,
+ // Ignore "long" and "short".
+ // They are undocumented, but widely used, section attributes which appear
+ // to do nothing.
+ if (Tok.is(tok::kw_long) || Tok.is(tok::kw_short)) {
+ PP.Lex(Tok); // long/short
+ continue;
+ }
+
if (!Tok.isAnyIdentifier()) {
PP.Diag(PragmaLocation, diag::warn_pragma_expected_action_or_r_paren)
<< PragmaName;
@@ -560,8 +569,13 @@ bool Parser::HandlePragmaMSSection(StringRef PragmaName,
return false;
}
SectionFlags |= Flag;
+ SectionFlagsAreDefault = false;
PP.Lex(Tok); // Identifier
}
+ // If no section attributes are specified, the section will be marked as
+ // read/write.
+ if (SectionFlagsAreDefault)
+ SectionFlags |= ASTContext::PSF_Write;
if (Tok.isNot(tok::r_paren)) {
PP.Diag(PragmaLocation, diag::warn_pragma_expected_rparen) << PragmaName;
return false;
OpenPOWER on IntegriCloud