From 6e93c1ba7332c55eb2067d7be6d20050912ef27d Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Tue, 18 Jul 2017 18:12:19 +0200 Subject: [PATCH 1/2] pragma: add minimalist message pragma implementation for example: #pragma message ("in a bottle") results in: hello.c(207): Note: in a bottle --- src/cc65/pragma.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index d50d151a7..25bc29d43 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -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; From 80b27bde5e4eff1ed11dc6c84e3fbe99ae34f038 Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Thu, 20 Jul 2017 18:13:39 +0200 Subject: [PATCH 2/2] pragma: add minimalist message pragma documentation documents 6e93c1ba7332c55eb2067d7be6d20050912ef27d --- doc/cc65.sgml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 3689c0b35..cd94f50ac 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -1119,6 +1119,23 @@ parameter with the #pragma message (<message>)