[EXPR_CLASSIFY_TYPE] = PREC_UNARY,
[EXPR_ALIGNOF] = PREC_UNARY,
- [EXPR_FUNCTION] = PREC_PRIM,
- [EXPR_PRETTY_FUNCTION] = PREC_PRIM,
+ [EXPR_FUNCNAME] = PREC_PRIM,
[EXPR_BUILTIN_SYMBOL] = PREC_PRIM,
[EXPR_BUILTIN_CONSTANT_P] = PREC_PRIM,
[EXPR_BUILTIN_PREFETCH] = PREC_PRIM,
print_quoted_string(&string_literal->value, '"');
}
+/**
+ * Prints a predefined symbol.
+ */
+static void print_funcname(
+ const funcname_expression_t *funcname)
+{
+ const char *s = "";
+ switch(funcname->kind) {
+ case FUNCNAME_FUNCTION: s = (c_mode & _C99) ? "__func__" : "__FUNCTION__"; break;
+ case FUNCNAME_PRETTY_FUNCTION: s = "__PRETTY_FUNCTION__"; break;
+ case FUNCNAME_FUNCSIG: s = "__FUNCSIG__"; break;
+ case FUNCNAME_FUNCDNAME: s = "__FUNCDNAME__"; break;
+ }
+ fputc('"', out);
+ fputs(s, out);
+ fputc('"', out);
+}
+
static void print_wide_string_literal(
const wide_string_literal_expression_t *const wstr)
{
case EXPR_CONST:
print_const(&expression->conste);
break;
- case EXPR_FUNCTION:
- case EXPR_PRETTY_FUNCTION:
+ case EXPR_FUNCNAME:
+ print_funcname(&expression->funcname);
+ break;
case EXPR_STRING_LITERAL:
print_string_literal(&expression->string);
break;
fputs(");\n", out);
}
+/**
+ * Print a microsoft __try statement.
+ *
+ * @param statement the statement
+ */
+static void print_ms_try_statement(const ms_try_statement_t *statement)
+{
+ fputs("__try ", out);
+ print_statement(statement->try_statement);
+ print_indent();
+ if(statement->except_expression != NULL) {
+ fputs("__except(", out);
+ print_expression(statement->except_expression);
+ fputs(") ", out);
+ } else {
+ fputs("__finally ", out);
+ }
+ print_statement(statement->final_statement);
+}
+
+/**
+ * Print a microsoft __leave statement.
+ *
+ * @param statement the statement
+ */
+static void print_leave_statement(const leave_statement_t *statement)
+{
+ (void) statement;
+ fputs("__leave;\n", out);
+}
+
/**
* Print a statement.
*
case STATEMENT_ASM:
print_asm_statement(&statement->asms);
break;
+ case STATEMENT_MS_TRY:
+ print_ms_try_statement(&statement->ms_try);
+ break;
+ case STATEMENT_LEAVE:
+ print_leave_statement(&statement->leave);
+ break;
case STATEMENT_INVALID:
fprintf(out, "$invalid statement$");
break;
if((c_mode & _MS) == 0)
return;
- decl_modifiers_t modifiers = declaration->modifiers;
+ decl_modifiers_t modifiers = declaration->decl_modifiers;
/* DM_FORCEINLINE handled outside. */
if((modifiers & ~DM_FORCEINLINE) != 0 ||
{
print_storage_class((storage_class_tag_t) declaration->declared_storage_class);
if(declaration->is_inline) {
- if(declaration->modifiers & DM_FORCEINLINE)
+ if(declaration->decl_modifiers & DM_FORCEINLINE)
fputs("__forceinline ", out);
else {
- if(declaration->modifiers & DM_MICROSOFT_INLINE)
+ if(declaration->decl_modifiers & DM_MICROSOFT_INLINE)
fputs("__inline ", out);
else
fputs("inline ", out);
case EXPR_WIDE_STRING_LITERAL:
case EXPR_SIZEOF:
case EXPR_CLASSIFY_TYPE:
- case EXPR_FUNCTION:
- case EXPR_FUNCSIG:
- case EXPR_FUNCDNAME:
- case EXPR_PRETTY_FUNCTION:
+ case EXPR_FUNCNAME:
case EXPR_OFFSETOF:
case EXPR_ALIGNOF:
case EXPR_BUILTIN_CONSTANT_P: