aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--preprocess.c2
-rw-r--r--tests/079.sh27
2 files changed, 27 insertions, 2 deletions
diff --git a/preprocess.c b/preprocess.c
index 4ab1a48..db9ad13 100644
--- a/preprocess.c
+++ b/preprocess.c
@@ -682,7 +682,6 @@ PpToken* process_define_directive(Preprocessor* pp, PpToken* tok) {
} else {
fatal_error("#define: invalid function-like macro syntax");
}
- tok2 = skip_whitespace(tok2);
tok3 = find_next_newline(tok2);
if (tok3) {
pp_macro = pp->pp_macros->data + pp->pp_macros->len;
@@ -696,7 +695,6 @@ PpToken* process_define_directive(Preprocessor* pp, PpToken* tok) {
++pp->pp_macros->len;
}
} else {
- tok2 = skip_whitespace(tok2);
tok3 = find_next_newline(tok2);
if (tok3) {
pp_macro = pp->pp_macros->data + pp->pp_macros->len;
diff --git a/tests/079.sh b/tests/079.sh
new file mode 100644
index 0000000..4381f45
--- /dev/null
+++ b/tests/079.sh
@@ -0,0 +1,27 @@
+set -e
+
+cat <<'EOF' > expected
+42
+EOF
+
+cat <<'EOF' > header.h
+#ifndef HEADER_H
+#define HEADER_H
+
+int f() { return 42; }
+
+#endif
+EOF
+
+bash ../../test_diff.sh <<'EOF'
+#include "header.h"
+#include "header.h"
+#include "header.h"
+
+int printf();
+
+int main() {
+ printf("%d\n", HEADER_H HEADER_H HEADER_H f() HEADER_H HEADER_H HEADER_H);
+ return 0;
+}
+EOF