[geany/geany] 6f6921: C: Fix line continuation handling (#1370)

Colomban Wendling git-noreply at xxxxx
Thu Apr 20 06:57:02 UTC 2017


Branch:      refs/heads/master
Author:      Colomban Wendling <lists.ban at herbesfolles.org>
Committer:   elextr <elextr at gmail.com>
Date:        Thu, 20 Apr 2017 06:57:02 UTC
Commit:      6f692112e39fa0714d882332b8f935419fd69a27
             https://github.com/geany/geany/commit/6f692112e39fa0714d882332b8f935419fd69a27

Log Message:
-----------
C: Fix line continuation handling (#1370)

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