WONKY



LOG | FILES | OVERVIEW


F diff --git a/src/semantics/program/translation_unit.c b/src/semantics/program/translation_unit.c --- a/src/semantics/program/translation_unit.c +++ b/src/semantics/program/translation_unit.c
else
wonky_assert(SHOULD_NOT_REACH_HERE);
+ /*
+ Note: this does not work because we are evaluating lazily.
+ This means that when we actually get to checking whether
+ this id has been expanded already this function will have passed.
+ */
+ //id->was_already_expanded_as_a_macro=0;
+
}
void token_ptr_execute_normal_macro(struct Token_Pointer *ptr,struct normal_define_directive *macro)
{
- token_ptr_jump_to_first(ptr,macro->replacement_tokens,0);
- ptr->context->executed_macro_id=macro->id;
+ /*hack*/
+ if(macro->replacement_tokens && macro->replacement_tokens->size)
+ {
+ token_ptr_jump_to_first(ptr,macro->replacement_tokens,0);
+ ptr->context->executed_macro_id=macro->id;
+ }else
+ {
+ /*we don't jump to it so there is no context to say that this macro has finished executing*/
+ macro->id->was_already_expanded_as_a_macro=0;
+ }
}
void token_ptr_execute_functionlike_macro(struct Token_Pointer *ptr,struct functionlike_define_directive *macro)
{
- token_ptr_load_functionlike_macro_arguments_with_tokens(ptr,macro);
- token_ptr_jump_to_first(ptr,macro->replacement_tokens,0);
- ptr->context->executed_macro_id=macro->id;
+ /*hack*/
+ if(macro->replacement_tokens && macro->replacement_tokens->size)
+ {
+ token_ptr_load_functionlike_macro_arguments_with_tokens(ptr,macro);
+ token_ptr_jump_to_first(ptr,macro->replacement_tokens,0);
+ ptr->context->executed_macro_id=macro->id;
+ }else
+ {
+ /*we don't jump to it so there is no context to say that this macro has finished executing*/
+ macro->id->was_already_expanded_as_a_macro=0;
+ }
}
void token_ptr_execute_functionlike_macro_argument(struct Token_Pointer *ptr,struct functionlike_define_directive_argument *argument)
{