int64_t MaxBytesToFill = 0;
auto parseAlign = [&]() -> bool {
- if (checkForValidSection() || parseAbsoluteExpression(Alignment))
+ if (parseAbsoluteExpression(Alignment))
return true;
if (parseOptionalToken(AsmToken::Comma)) {
// The fill expression can be omitted while specifying a maximum number of
return parseToken(AsmToken::EndOfStatement);
};
+ if (checkForValidSection())
+ return addErrorSuffix(" in directive");
+ // Ignore empty '.p2align' directives for GNU-as compatibility
+ if (IsPow2 && (ValueSize == 1) && getTok().is(AsmToken::EndOfStatement)) {
+ Warning(AlignmentLoc, "p2align directive with no operand(s) is ignored");
+ return parseToken(AsmToken::EndOfStatement);
+ }
if (parseAlign())
return addErrorSuffix(" in directive");
-# RUN: not llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s
+# RUN: not llvm-mc -triple i386-apple-darwin9 %s 2> %t.err | FileCheck %s
+# RUN: FileCheck < %t.err %s --check-prefix=CHECK-WARN
# CHECK: TEST0:
# CHECK: .p2align 1
# CHECK: .balign 3, 10
TEST2:
.balign 3,10
+
+# CHECK-WARN: p2align directive with no operand(s) is ignored
+TEST3:
+ .p2align