Preserve __M2__ in output

This commit is contained in:
Jeremiah Orians 2022-01-22 13:55:09 -05:00
parent a6397e7eb7
commit ae5ae61461
No known key found for this signature in database
GPG Key ID: 6B3A3F198708F894
3 changed files with 6 additions and 3 deletions

2
README
View File

@ -14,4 +14,6 @@ M2-Mesoplanet simplifies the bootstrappable stage0/M2-Planet toolchain by imitat
- --max-string <N> :: N is a number
- --fuzz :: prevents execution of dangerous random garbage
- --no-debug :: strip debug symbols from output
- --dirty-mode :: keep all temp files
- --debug-mode <N> :: N is a number

2
cc.c
View File

@ -44,7 +44,7 @@ int main(int argc, char** argv, char** envp)
FILE* tempfile;
char* destination_name = "a.out";
FILE* destination_file = stdout;
init_macro_env("__M2__", "42", "__INTERNAL_M2__", 0); /* Setup __M2__ */
init_macro_env("__M2__", "__M2__", "__INTERNAL_M2__", 0); /* Setup __M2__ */
char* name;
char* hold;
int DUMP_MODE = FALSE;

View File

@ -86,7 +86,6 @@ void eat_current_token_without_space()
struct token_list* lookup_token(struct token_list* token, struct token_list* arguments)
{
char *s;
if(NULL == token)
{
fputs("null token received in token\n", stderr);
@ -152,7 +151,7 @@ struct token_list* insert_tokens(struct token_list* point, struct token_list* to
struct token_list* copy_list(struct token_list* token)
{
struct token_list* copy;
struct token_list* prev = NULL;
struct token_list* prev = NULL;
while (NULL != token)
{
@ -884,6 +883,8 @@ struct token_list* maybe_expand(struct token_list* token)
return token->next;
}
if(match("__M2__", token->s)) return token->next;
token = eat_token(token);
if (NULL == hold->expansion)