mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 06:30:16 +00:00
Use "Assertion failed" as default message for .assert if no message was
given. git-svn-id: svn://svn.cc65.org/cc65/trunk@3474 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
8eadae74bf
commit
9cd1ef08cc
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2004 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2005, Ullrich von Bassewitz */
|
||||
/* Römerstraße 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
@ -385,7 +385,7 @@ static void DoAssert (void)
|
||||
};
|
||||
|
||||
int Action;
|
||||
long Val;
|
||||
unsigned Msg;
|
||||
|
||||
/* First we have the expression that has to evaluated */
|
||||
ExprNode* Expr = Expression ();
|
||||
@ -414,7 +414,14 @@ static void DoAssert (void)
|
||||
Error ("Illegal assert action specifier");
|
||||
}
|
||||
NextTok ();
|
||||
ConsumeComma ();
|
||||
|
||||
/* We can have an optional message. If no message is present, use
|
||||
* "Assertion failed".
|
||||
*/
|
||||
if (Tok == TOK_COMMA) {
|
||||
|
||||
/* Skip the comma */
|
||||
NextTok ();
|
||||
|
||||
/* Read the message */
|
||||
if (Tok != TOK_STRCON) {
|
||||
@ -422,11 +429,21 @@ static void DoAssert (void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remember the assertion */
|
||||
AddAssertion (Expr, Action, GetStringId (SVal));
|
||||
|
||||
/* Skip the message */
|
||||
/* Translate the message into a string id. We can then skip the input
|
||||
* string.
|
||||
*/
|
||||
Msg = GetStringId (SVal);
|
||||
NextTok ();
|
||||
|
||||
} else {
|
||||
|
||||
/* Use "Assertion failed" */
|
||||
Msg = GetStringId ("Assertion failed");
|
||||
|
||||
}
|
||||
|
||||
/* Remember the assertion */
|
||||
AddAssertion (Expr, Action, Msg);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user