aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-09 13:13:21 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-09 13:13:21 +0100
commit88b9fad1102afa60e360c3d339acd1ce0f666d5a (patch)
tree3fb8fc1c9cb1a73e19bce9be5f55835cd32889eb
parentmds-kbdc: compile-layout: fix a bug in parse_variable (diff)
downloadmds-88b9fad1102afa60e360c3d339acd1ce0f666d5a.tar.gz
mds-88b9fad1102afa60e360c3d339acd1ce0f666d5a.tar.bz2
mds-88b9fad1102afa60e360c3d339acd1ce0f666d5a.tar.xz
mds-kbdc: compile-layout: macro_call: fix bug: do not duplicate the arguments if there are none
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/mds-kbdc/compile-layout.c3
-rw-r--r--test-files/mds-kbdc/compile-layout/invalid/macro-undefined_macro-call2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c
index cc9719b..0622d35 100644
--- a/src/mds-kbdc/compile-layout.c
+++ b/src/mds-kbdc/compile-layout.c
@@ -2404,7 +2404,8 @@ static int compile_macro_call(mds_kbdc_tree_macro_call_t* restrict tree)
/* Duplicate arguments and evaluate function calls,
variable dereferences and escapes in the macro
call arguments. */
- fail_if (arg = mds_kbdc_tree_dup(tree->arguments), arg == NULL);
+ if (tree->arguments)
+ fail_if (arg = mds_kbdc_tree_dup(tree->arguments), arg == NULL);
fail_if (bad = evaluate_element(arg), bad < 0);
if (bad)
return 0;
diff --git a/test-files/mds-kbdc/compile-layout/invalid/macro-undefined_macro-call b/test-files/mds-kbdc/compile-layout/invalid/macro-undefined_macro-call
index 6626ae7..69f2f8e 100644
--- a/test-files/mds-kbdc/compile-layout/invalid/macro-undefined_macro-call
+++ b/test-files/mds-kbdc/compile-layout/invalid/macro-undefined_macro-call
@@ -1,5 +1,3 @@
-# TODO does not work
-
macro m/0
m(1)
end macro