From 919121bdf572b632cc5bfbbee502664682b26ab8 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 18 Apr 2010 23:18:45 -0400 Subject: Give backtraces for diagnostics from macros and include files. Partly this means that dmnsn_diagnostic() can't be called anywhere except during parsing, because the dmnsn_parse_location::parent pointers dangle. --- dimension/common.rules | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'dimension/common.rules') diff --git a/dimension/common.rules b/dimension/common.rules index d77ab1a..157edca 100644 --- a/dimension/common.rules +++ b/dimension/common.rules @@ -477,6 +477,14 @@ FLOAT: ARITH_EXPR { } ; +INT: FLOAT { + $$ = $1; + if ($$.type == DMNSN_AST_FLOAT) { + dmnsn_diagnostic(@$, "WARNING: float rounded to integer"); + } + } +; + FLOAT_LITERAL: "integer" { $$ = dmnsn_new_astnode(DMNSN_AST_INTEGER, @$); $$.ptr = dmnsn_malloc(sizeof(long)); -- cgit v1.2.3