Skip to content

Commit afd34be

Browse files
committed
issue #10726 Error in processing Fortran file with character string returning function
Define some standard Fortran words (starting with a `C`) that should not trigger as start of a fixed form comment line.
1 parent 181b501 commit afd34be

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/util.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6686,6 +6686,24 @@ bool openOutputFile(const QCString &outFile,std::ofstream &f)
66866686
return fileOpened;
66876687
}
66886688

6689+
static bool keyWordsFortranC(const char *contents)
6690+
{
6691+
static const std::unordered_set<std::string> fortran_C_keywords = {
6692+
"character", "call", "close", "common", "continue",
6693+
"case", "contains", "cycle", "class", "codimension",
6694+
"concurrent", "contiguous", "critical"
6695+
};
6696+
6697+
if (*contents != 'c' && *contents != 'C') return false;
6698+
6699+
const char *c = contents;
6700+
QCString keyword;
6701+
while (*c && *c != ' ') {keyword += *c; c++;};
6702+
keyword = keyword.lower();
6703+
6704+
return (fortran_C_keywords.find(keyword.str()) != fortran_C_keywords.end());
6705+
}
6706+
66896707
//------------------------------------------------------
66906708
// simplified way to know if this is fixed form
66916709
bool recognizeFixedForm(const QCString &contents, FortranFormat format)
@@ -6721,6 +6739,11 @@ bool recognizeFixedForm(const QCString &contents, FortranFormat format)
67216739
break;
67226740
case 'C':
67236741
case 'c':
6742+
if (column==1)
6743+
{
6744+
return !keyWordsFortranC(contents.data()+i);
6745+
}
6746+
// fallthrough
67246747
case '*':
67256748
if (column==1) return TRUE;
67266749
if (skipLine) break;

0 commit comments

Comments
 (0)