[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] [PATCH] Preprocessor: ignore everything after #error or #
From: |
Marc Andre Tanner |
Subject: |
[Tinycc-devel] [PATCH] Preprocessor: ignore everything after #error or #warning |
Date: |
Mon, 24 Sep 2007 17:39:07 +0200 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
Hi,
There seems to be a problem in the skiping of preprocessor directives,
tcc attempts to parse the string even after #error or #warning and
complains when it shouldn't.
cat > bug.c << EOF
#if 0
#warning This doesn't work
#endif
EOF
tcc -c bug.c
bug3.c:4: missing terminating ' character
gcc -c bug.c
Marc
--
Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
diff -r 995cf196fe69 tcc.c
--- a/tcc.c Thu Sep 20 02:52:04 2007 -0500
+++ b/tcc.c Tue Sep 18 19:31:04 2007 +0200
@@ -1412,6 +1419,12 @@ void preprocess_skip(void)
a++;
else if (tok == TOK_ENDIF)
a--;
+
+ if(tok == TOK_ERROR || tok == TOK_WARNING) {
+ while(*p++ != '\n')
+ ;
+ p--; // let the above case '\n': handle the new line
+ }
}
break;
default: