1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

pragma: add minimalist message pragma implementation

for example:

#pragma message ("in a bottle")

results in:

hello.c(207): Note: in a bottle
This commit is contained in:
Pascal de Bruijn 2017-07-18 18:12:19 +02:00
parent 6002e59c28
commit 6e93c1ba73

View File

@ -78,6 +78,7 @@ typedef enum {
PRAGMA_DATASEG, /* obsolete */
PRAGMA_INLINE_STDFUNCS,
PRAGMA_LOCAL_STRINGS,
PRAGMA_MESSAGE,
PRAGMA_OPTIMIZE,
PRAGMA_REGISTER_VARS,
PRAGMA_REGVARADDR,
@ -114,6 +115,7 @@ static const struct Pragma {
{ "dataseg", PRAGMA_DATASEG }, /* obsolete */
{ "inline-stdfuncs", PRAGMA_INLINE_STDFUNCS },
{ "local-strings", PRAGMA_LOCAL_STRINGS },
{ "message", PRAGMA_MESSAGE },
{ "optimize", PRAGMA_OPTIMIZE },
{ "register-vars", PRAGMA_REGISTER_VARS },
{ "regvaraddr", PRAGMA_REGVARADDR },
@ -750,6 +752,13 @@ static void IntPragma (StrBuf* B, IntStack* Stack, long Low, long High)
static void MakeMessage (const char* Message)
{
fprintf (stderr, "%s(%u): Note: %s\n", GetInputName (CurTok.LI), GetInputLine (CurTok.LI), Message);
}
static void ParsePragma (void)
/* Parse the contents of the _Pragma statement */
{
@ -849,6 +858,10 @@ static void ParsePragma (void)
FlagPragma (&B, &LocalStrings);
break;
case PRAGMA_MESSAGE:
StringPragma (&B, MakeMessage);
break;
case PRAGMA_OPTIMIZE:
FlagPragma (&B, &Optimize);
break;