[geany/geany] a11d67: make: Fix handling comments inside rules
Colomban Wendling
git-noreply at xxxxx
Mon Apr 20 17:53:28 UTC 2015
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 20 Apr 2015 17:53:28 UTC
Commit: a11d67bb0b46a94d08ff32676a724838be97a680
https://github.com/geany/geany/commit/a11d67bb0b46a94d08ff32676a724838be97a680
Log Message:
-----------
make: Fix handling comments inside rules
A line consisting only of blanks or comments should not end a rule,
even if it doesn't start with a tabulation character.
Modified Paths:
--------------
tagmanager/ctags/make.c
tests/ctags/Makefile.am
tests/ctags/make-comment-in-rule.mak
tests/ctags/make-comment-in-rule.mak.tags
Modified: tagmanager/ctags/make.c
14 lines changed, 6 insertions(+), 8 deletions(-)
===================================================================
@@ -59,12 +59,10 @@ static void skipLine (void)
fileUngetc (c);
}
-static int skipToNonWhite (void)
+static int skipToNonWhite (int c)
{
- int c;
- do
+ while (c != '\n' && isspace (c))
c = nextChar ();
- while (c != '\n' && isspace (c));
return c;
}
@@ -138,12 +136,12 @@ static void findMakeTags (void)
{
if (in_rule)
{
- if (c == '\t')
+ if (c == '\t' || (c = skipToNonWhite (c)) == '#')
{
- skipLine (); /* skip rule */
+ skipLine (); /* skip rule or comment */
c = nextChar ();
}
- else
+ else if (c != '\n')
in_rule = FALSE;
}
stringListClear (identifiers);
@@ -198,7 +196,7 @@ static void findMakeTags (void)
else if (! strcmp (vStringValue (name), "define"))
{
in_define = TRUE;
- c = skipToNonWhite ();
+ c = skipToNonWhite (nextChar ());
vStringClear (name);
/* all remaining characters on the line are the name -- even spaces */
while (c != EOF && c != '\n')
Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -200,6 +200,7 @@ test_sources = \
line_directives.c \
local.c \
macros.c \
+ make-comment-in-rule.mak \
make-multi-target.mak \
make-target-with-parentheses.mak \
make-variable-on-cmdline.mak \
Modified: tests/ctags/make-comment-in-rule.mak
17 lines changed, 17 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,17 @@
+# all this is one single rule
+all:
+ a=1; echo "$$a"
+# foo
+ b=2; echo "$$b"
+ # foo
+ c=3; echo "$$c"
+
# foo
+ d=4; echo "$$d"
+
# foo
+ e=5; echo "$$e"
+
+
+ f=6; echo "$$f"
+ # foo
+
+ g=7; echo "$$g"
Modified: tests/ctags/make-comment-in-rule.mak.tags
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,2 @@
+# format=tagmanager
+all�16�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