summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-08-31 14:34:10 (GMT)
committerGitHub <noreply@github.com>2019-08-31 14:34:10 (GMT)
commit9c408394d4f91568e81a5055869f7264ca6009e7 (patch)
tree52666e050ac62410d6a78ff8a6216f2900af9203 /src
parent272cd04fd10401b2e196679ba81c64cd457164e4 (diff)
parentb3f4bb7f95295359674c0a730a3ba649a6d49454 (diff)
downloadDoxygen-9c408394d4f91568e81a5055869f7264ca6009e7.zip
Doxygen-9c408394d4f91568e81a5055869f7264ca6009e7.tar.gz
Doxygen-9c408394d4f91568e81a5055869f7264ca6009e7.tar.bz2
Merge pull request #7202 from albert-github/feature/issue_7200
issue #7200 Fortran warning: type not declared or defined
Diffstat (limited to 'src')
-rw-r--r--src/fortranscanner.l48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 1699c1d..09c4490 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -106,12 +106,14 @@ struct SymbolModifiers {
bool volat; /* volatile is a reserved name */
bool value; /* volatile is a reserved name */
QCString passVar;
+ QCString bindVar;
SymbolModifiers() : type(), returnName(), protection(NONE_P), direction(NONE_D),
optional(FALSE), protect(FALSE), dimension(), allocatable(FALSE),
external(FALSE), intrinsic(FALSE), parameter(FALSE),
pointer(FALSE), target(FALSE), save(FALSE), deferred(FALSE), nonoverridable(FALSE),
- nopass(FALSE), pass(FALSE), contiguous(FALSE), volat(FALSE), value(FALSE), passVar() {}
+ nopass(FALSE), pass(FALSE), contiguous(FALSE), volat(FALSE), value(FALSE), passVar(),
+ bindVar() {}
SymbolModifiers& operator|=(const SymbolModifiers &mdfs);
SymbolModifiers& operator|=(QCString mdfrString);
@@ -227,6 +229,7 @@ static void pushBuffer(QCString &buffer);
static void popBuffer();
//static void extractPrefix(QCString& text);
static QCString extractFromParens(const QCString name);
+static QCString extractBind(const QCString name);
static CommentInPrepass* locatePrepassComment(int from, int to);
static void updateVariablePrepassComment(int from, int to);
static void newLine();
@@ -273,7 +276,7 @@ TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX
INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
ATTR_SPEC (EXTERNAL|ALLOCATABLE|DIMENSION{ARGS}|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE|CONTIGUOUS|VOLATILE|VALUE)
ACCESS_SPEC (PRIVATE|PUBLIC)
-LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")"
+LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}((,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})|(,{BS}NAME{BS}"="{BS}"'"(.*)"'"{BS}))?")"
/* Assume that attribute statements are almost the same as attributes. */
ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC}
EXTERNAL_STMT (EXTERNAL)
@@ -810,6 +813,9 @@ private {
<AttributeList>{
{COMMA} {}
{BS} {}
+{LANGUAGE_BIND_SPEC} {
+ currentModifiers |= yytext;
+ }
{ATTR_SPEC}. { /* update current modifiers when it is an ATTR_SPEC and not a variable name */
/* bug_625519 */
QChar chr = yytext[(int)yyleng-1];
@@ -1834,6 +1840,29 @@ static QCString extractFromParens(const QCString name)
return extracted;
}
+/*! remove non usefull spaces from bind statement */
+static QCString extractBind(const QCString name)
+{
+ QCString parensPart = extractFromParens(name);
+ if (parensPart.length() == 1)
+ {
+ return "bind(C)";
+ }
+ else
+ {
+ //strip 'c'
+ parensPart = parensPart.mid(1).stripWhiteSpace();
+ // strip ','
+ parensPart = parensPart.mid(1).stripWhiteSpace();
+ // name part
+ parensPart = parensPart.mid(4).stripWhiteSpace();
+ // = part
+ parensPart = parensPart.mid(1).stripWhiteSpace();
+
+ return "bind(C, name=" + parensPart + ")";
+ }
+}
+
/*! Adds passed modifiers to these modifiers.*/
SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs)
{
@@ -1854,6 +1883,7 @@ SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs)
nopass |= mdfs.nopass;
pass |= mdfs.pass;
passVar = mdfs.passVar;
+ bindVar = mdfs.bindVar;
contiguous |= mdfs.contiguous;
volat |= mdfs.volat;
value |= mdfs.value;
@@ -1861,9 +1891,9 @@ SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs)
}
/*! Extracts and adds passed modifier to these modifiers.*/
-SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString)
+SymbolModifiers& SymbolModifiers::operator|=(QCString mdfStringArg)
{
- mdfString = mdfString.lower();
+ QCString mdfString = mdfStringArg.lower();
SymbolModifiers newMdf;
if (mdfString.find("dimension")==0)
@@ -1955,6 +1985,11 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString)
else
newMdf.passVar = "";
}
+ else if (QString(mdfString.data()).startsWith("bind"))
+ {
+ // we need here the original string as we want to don't want to have the lowercase name between the quotes of the name= part
+ newMdf.bindVar = extractBind(mdfStringArg);
+ }
(*this) |= newMdf;
return *this;
@@ -2086,6 +2121,11 @@ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
if (!mdfs.passVar.isEmpty())
typeName += "(" + mdfs.passVar + ")";
}
+ if (!mdfs.bindVar.isEmpty())
+ {
+ if (!typeName.isEmpty()) typeName += ", ";
+ typeName += mdfs.bindVar;
+ }
if (mdfs.protection == SymbolModifiers::PUBLIC)
{
if (!typeName.isEmpty()) typeName += ", ";