Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 23 Feb 2014 19:10:35 UTC Commit: e47d45eb281a968b733241aab431c045d61569f9 https://github.com/geany/geany/commit/e47d45eb281a968b733241aab431c045d61569...
Log Message: ----------- Fortran: fix handling of preprocessor directives on the first line
Fix a race initialization leading to incorrect handling of preprocessor directives on the first input line.
Test case contributed by Adam Hirst, thanks.
Modified Paths: -------------- tagmanager/ctags/fortran.c tests/ctags/Makefile.am tests/ctags/preprocessor.f90 tests/ctags/preprocessor.f90.tags
Modified: tagmanager/ctags/fortran.c 13 files changed, 7 insertions(+), 6 deletions(-) =================================================================== @@ -208,6 +208,7 @@ static boolean FreeSourceForm = FALSE; static boolean ParsingString; static tokenInfo *Parent = NULL; +static boolean NewLine = TRUE; static unsigned int contextual_fake_count = 0;
/* indexed by tagType */ @@ -725,7 +726,6 @@ static int skipToNextLine (void)
static int getFreeFormChar (boolean inComment) { - static boolean newline = TRUE; boolean advanceLine = FALSE; int c = fileGetc ();
@@ -740,7 +740,7 @@ static int getFreeFormChar (boolean inComment) while (isspace (c) && c != '\n'); if (c == '\n') { - newline = TRUE; + NewLine = TRUE; advanceLine = TRUE; } else if (c == '!') @@ -751,16 +751,16 @@ static int getFreeFormChar (boolean inComment) c = '&'; } } - else if (newline && (c == '!' || c == '#')) + else if (NewLine && (c == '!' || c == '#')) advanceLine = TRUE; while (advanceLine) { while (isspace (c)) c = fileGetc (); - if (c == '!' || (newline && c == '#')) + if (c == '!' || (NewLine && c == '#')) { c = skipToNextLine (); - newline = TRUE; + NewLine = TRUE; continue; } if (c == '&') @@ -768,7 +768,7 @@ static int getFreeFormChar (boolean inComment) else advanceLine = FALSE; } - newline = (boolean) (c == '\n'); + NewLine = (boolean) (c == '\n'); return c; }
@@ -2289,6 +2289,7 @@ static boolean findFortranTags (const unsigned int passCount) FreeSourceForm = (boolean) (passCount > 1); contextual_fake_count = 0; Column = 0; + NewLine = TRUE; exception = (exception_t) setjmp (Exception); if (exception == ExceptionEOF) retry = FALSE;
Modified: tests/ctags/Makefile.am 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -194,6 +194,7 @@ test_sources = \ objectivec_protocol.mm \ Package.pm \ php5_5_class_kw.php \ + preprocessor.f90 \ procedure_pointer_module.f90 \ procpoint.f90 \ property.cs \
Modified: tests/ctags/preprocessor.f90 17 files changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,17 @@ +#include +! preprocessor directives on line 1 (and only line 1) cause breakage +module Invisible + + integer :: nope + +contains + + function SpillsOutside + ! ... + end function SpillsOutside + +end module Invisible + +program Main +! ... +end program Main
Modified: tests/ctags/preprocessor.f90.tags 5 files changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +# format=tagmanager +InvisibleÌ256Ö0 +MainÌ2048Ö0 +SpillsOutsideÌ16ÎInvisibleÖ0 +nopeÌ16384ÎInvisibleÖ0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).