[geany/geany] b737f0: c family: Fix trigraph handling
Colomban Wendling
git-noreply at xxxxx
Sun Jun 14 16:23:29 UTC 2015
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 14 Jun 2015 16:23:29 UTC
Commit: b737f031cab65e345cb29504c2b39f1924900781
https://github.com/geany/geany/commit/b737f031cab65e345cb29504c2b39f1924900781
Log Message:
-----------
c family: Fix trigraph handling
X-Universal-CTags-Commit-ID: d6d1a0f2b90a600bdec9cd6ba964ee69382743e4
Modified Paths:
--------------
tagmanager/ctags/get.c
tests/ctags/Makefile.am
tests/ctags/c-trigraphs.c
tests/ctags/c-trigraphs.c.tags
Modified: tagmanager/ctags/get.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -648,8 +648,6 @@ extern int cppGetc (void)
if (next == NEWLINE)
continue;
- else if (next == '?')
- cppUngetc (next);
else
fileUngetc (next);
break;
@@ -675,8 +673,8 @@ extern int cppGetc (void)
case '-': c = '~'; break;
case '=': c = '#'; goto process;
default:
+ fileUngetc ('?');
fileUngetc (next);
- cppUngetc ('?');
break;
}
}
Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -108,6 +108,7 @@ test_sources = \
bug960316.v \
bug961001.v \
byte.f \
+ c-trigraphs.c \
case_sensitivity.php \
char-selector.f90 \
classes.php \
Modified: tests/ctags/c-trigraphs.c
56 lines changed, 56 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,56 @@
+
+/* simple trigraphs */
+??=define A 1
+??=define B 2
+??=define STRINGIFY_INTERN(x) ??=x
+??=define STRINGIFY(x) STRINGIFY_INTERN(x)
+
+/* doesn't expand to anything that makes sense, but as "???" is not a valid
+ * trigraph it should not prevent "??/" to match */
+??=define D 4 ???/
+#define bug1
+??=define E ?????/
+#define bug2
+
+/* \ isn't interpreted for trigraphs */
+??=define F ???\??/
+extern int bug3 = ??-0;
+
+??=define M3_INIT(a, b, c) ??< a, b, c ??>
+typedef int matrix3??(3??);
+
+struct str ??<
+ char *buf;
+ unsigned int len, size;
+??>;
+
+int main(void)
+??<
+ const char *hello = STRINGIFY(hello);
+ matrix3 m = M3_INIT(1, 2, 3);
+
+ return m??(2??);
+??>
+
+/* FIXME: how to test "??'" ("^"), "??!" ("|") and "??-" ("~")?
+ * I can't think of a construct CTags cares about using those */
+
+??=if 0
+#define bug4
+??=endif
+
+
+/* test the same with untaken preprocessor paths (as they are then not read by
+ * the C parser but get.c) */
+#if 0
+
+??=define if0d_A 1
+??=define if0d_B 2
+??=define if0d_C 4 ???/
+#define bug5
+??=define I ?????/
+#define bug6
+??=define I ??????????/
+#define bug7
+
+#endif
Modified: tests/ctags/c-trigraphs.c.tags
15 lines changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,15 @@
+# format=tagmanager
+A�65536�0
+B�65536�0
+D�65536�0
+E�65536�0
+F�65536�0
+M3_INIT�131072�(a, b, c)�0
+STRINGIFY�131072�(x)�0
+STRINGIFY_INTERN�131072�(x)�0
+buf�64�str�0�char
+len�64�str�0�int
+main�16�(void)�0�int
+matrix3�4096�0�int
+size�64�str�0�int
+str�2048�0
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list