aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-02 03:32:06 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:06:21 +0900
commit000e9d54435081bd40f877b319658e44dc45c7e0 (patch)
tree09f8b40512e69d90c87eaf64616b47ab06eeefa5
parenteb2700aea276018b754afa24199e5ede80cdb5bb (diff)
downloadducc-000e9d54435081bd40f877b319658e44dc45c7e0.tar.gz
ducc-000e9d54435081bd40f877b319658e44dc45c7e0.tar.zst
ducc-000e9d54435081bd40f877b319658e44dc45c7e0.zip
feat: improve error message while processing #define directives
-rw-r--r--preprocess.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/preprocess.c b/preprocess.c
index 9f98e40..5374c53 100644
--- a/preprocess.c
+++ b/preprocess.c
@@ -680,7 +680,8 @@ PpToken* process_define_directive(Preprocessor* pp, PpToken* tok) {
if (tok2->kind == PpTokenKind_punctuator && string_equals_cstr(&tok2->raw, ")")) {
++tok2;
} else {
- fatal_error("#define: invalid function-like macro syntax");
+ fatal_error("%s:%d: invalid function-like macro syntax (#define %.*s)", macro_name->loc.filename,
+ macro_name->loc.line, macro_name->raw.len, macro_name->raw.data);
}
tok3 = find_next_newline(tok2);
if (tok3) {