/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Tokens for the #pragmas */
typedef enum {
PRAGMA_ILLEGAL = -1,
+ PRAGMA_ALIGN,
PRAGMA_BSS_NAME,
PRAGMA_BSSSEG, /* obsolete */
PRAGMA_CHARMAP,
const char* Key; /* Keyword */
pragma_t Tok; /* Token */
} Pragmas[PRAGMA_COUNT] = {
+ { "align", PRAGMA_ALIGN },
{ "bss-name", PRAGMA_BSS_NAME },
{ "bssseg", PRAGMA_BSSSEG }, /* obsolete */
{ "charmap", PRAGMA_CHARMAP },
StrBuf Ident = AUTO_STRBUF_INITIALIZER;
PushPopResult Res = PP_NONE;
+ /* Remember the current string index, so we can go back in case of errors */
+ unsigned Index = SB_GetIndex (B);
/* Try to read an identifier */
if (SB_GetSym (B, &Ident, 0)) {
/* Skip the following comma */
if (!GetComma (B)) {
+ /* Error already flagged by GetComma */
Res = PP_ERROR;
}
} else {
- /* Unknown keyword */
- Error ("Invalid pragma arguments");
- Res = PP_ERROR;
+ /* Unknown keyword, roll back */
+ SB_SetIndex (B, Index);
}
}
int Push;
/* A warning name must follow */
- IntStack* S =GetWarning (B);
+ IntStack* S = GetWarning (B);
if (S == 0) {
return;
}
/* Switch for the different pragmas */
switch (Pragma) {
+ case PRAGMA_ALIGN:
+ IntPragma (&B, &DataAlignment, 1, 4096);
+ break;
+
case PRAGMA_BSSSEG:
Warning ("#pragma bssseg is obsolete, please use #pragma bss-name instead");
/* FALLTHROUGH */