aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseyko <seyko2@gmail.com>2016-04-14 21:46:46 +0300
committerseyko <seyko2@gmail.com>2016-04-14 21:46:46 +0300
commit16cbca281fe5d22cd3e6f548cae59d19c31d30ac (patch)
tree4921266adc409f06327db5773073b5b5128a54c6
parent5fb57bead41cd3a84f0aa3f98d00b5fe5de25a08 (diff)
downloadtinycc-16cbca281fe5d22cd3e6f548cae59d19c31d30ac.tar.gz
tinycc-16cbca281fe5d22cd3e6f548cae59d19c31d30ac.tar.bz2
fix preprocessing *.S with ` ' chars in #comments
with a test program. Problem detected when trying to compile linux-2.4.37.9 with tcc.
-rw-r--r--tccpp.c6
-rw-r--r--tests/pp/13.S6
-rw-r--r--tests/pp/13.expect6
3 files changed, 17 insertions, 1 deletions
diff --git a/tccpp.c b/tccpp.c
index aa0f1ae..cb220ab 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -796,8 +796,10 @@ redo_start:
in_warn_or_error = 1;
else if (tok == TOK_LINEFEED)
goto redo_start;
+ else if (parse_flags & PARSE_FLAG_ASM_FILE)
+ p = parse_line_comment(p);
} else if (parse_flags & PARSE_FLAG_ASM_FILE)
- p = parse_line_comment(p);
+ p = parse_line_comment(p);
break;
_default:
default:
@@ -2743,6 +2745,8 @@ maybe_newline:
p++;
break;
default:
+ if (parse_flags & PARSE_FLAG_ASM_FILE)
+ goto parse_simple;
tcc_error("unrecognized character \\x%02x", c);
break;
}
diff --git a/tests/pp/13.S b/tests/pp/13.S
new file mode 100644
index 0000000..bf0b525
--- /dev/null
+++ b/tests/pp/13.S
@@ -0,0 +1,6 @@
+# `modelist' label. Each video mode record looks like:
+#ifdef AAA
+# modelist' label. Each video mode record looks like:
+#endif
+.text
+endtext:
diff --git a/tests/pp/13.expect b/tests/pp/13.expect
new file mode 100644
index 0000000..3532dd7
--- /dev/null
+++ b/tests/pp/13.expect
@@ -0,0 +1,6 @@
+# `modelist' label. Each video mode record looks like:
+
+
+
+.text
+endtext: