From 6c785d56ed010a3a1a5b8cffe3cc7c8394f69590 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 4 Dec 2007 15:16:55 +0000 Subject: [PATCH] finished implementation of __func__ and _PRETTY_FUNC__ [r18599] --- parser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/parser.c b/parser.c index 235b5f0..beedd11 100644 --- a/parser.c +++ b/parser.c @@ -3197,7 +3197,7 @@ static expression_t *parse_function_keyword(void) expression->expression.type = EXPR_FUNCTION; expression->expression.datatype = type_string; - expression->value = "TODO: FUNCTION"; + expression->value = current_function->symbol->string; return (expression_t*) expression; } @@ -3207,12 +3207,16 @@ static expression_t *parse_pretty_function_keyword(void) eat(T___PRETTY_FUNCTION__); /* TODO */ + if (current_function == NULL) { + parse_error("'__PRETTY_FUNCTION__' used outside of a function"); + } + string_literal_expression_t *expression = allocate_ast_zero(sizeof(expression[0])); expression->expression.type = EXPR_PRETTY_FUNCTION; expression->expression.datatype = type_string; - expression->value = "TODO: PRETTY FUNCTION"; + expression->value = current_function->symbol->string; return (expression_t*) expression; } -- 2.20.1