[geany/geany] b974d2: C: Fix line continuation handling

Colomban Wendling git-noreply at xxxxx
Fri Jan 20 13:05:03 UTC 2017


Branch:      refs/heads/c/backslashes
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 20 Jan 2017 13:05:03 UTC
Commit:      b974d26dff67d0e8dd768057b8b47a0ba67f0315
             https://github.com/geany/geany/commit/b974d26dff67d0e8dd768057b8b47a0ba67f0315

Log Message:
-----------
C: Fix line continuation handling

Escaped newlines were properly handled inside preprocessor directives,
but not otherwise.

Seeing `continue` here suggests the code used to work a long time ago
but some loop refactoring broke it, as now it would not stay in the
loop unless in a preprocessor directive.  Or maybe it only ever worked
for preprocessor directives, and the `continue` was superfluous?

Fixes #1370.


Modified Paths:
--------------
    ctags/main/lcpp.c
    tests/ctags/Makefile.am
    tests/ctags/backslashes.c
    tests/ctags/backslashes.c.tags

Modified: ctags/main/lcpp.c
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -704,7 +704,10 @@ extern int cppGetc (void)
 				int next = getcFromInputFile ();
 
 				if (next == NEWLINE)
-					continue;
+				{
+					c = getcFromInputFile ();
+					goto process;
+				}
 				else
 					ungetcToInputFile (next);
 				break;


Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -20,6 +20,7 @@ test_sources = \
 	array-spec.f90					\
 	attributes.cs					\
 	auto.f							\
+	backslashes.c					\
 	bit_field.c						\
 	block.f90						\
 	bracematch.js					\


Modified: tests/ctags/backslashes.c
29 lines changed, 29 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,29 @@
+typedef int T;
+
+int func1(\
+int var1, int var2, ...);
+
+int func2(int var1, \
+int var2, ...);
+
+int func3(T \
+          var1, T var2, ...);
+int func4(T var1, \
+          T var2, ...);
+
+int func5(int \
+          var1, int var2, ...);
+
+// check continuations in macros are properly handled
+#define MACRO1 \
+  (
+int func6(void);
+#define MACRO2(x) \
+  int x(void);
+#define MACRO3(y) \
+  int \
+  y \
+  ( \
+    void \
+  );
+int func7(int a);


Modified: tests/ctags/backslashes.c.tags
12 lines changed, 12 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,12 @@
+# format=tagmanager
+MACRO1�65536�0
+MACRO2�131072�(x)�0
+MACRO3�131072�(y)�0
+T�4096�0�int
+func1�1024�(int var1, int var2, ...)�0�int
+func2�1024�(int var1, int var2, ...)�0�int
+func3�1024�(T var1, T var2, ...)�0�int
+func4�1024�(T var1, T var2, ...)�0�int
+func5�1024�(int var1, int var2, ...)�0�int
+func6�1024�(void)�0�int
+func7�1024�(int a)�0�int



--------------
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