diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2018-12-24 13:08:31 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2018-12-24 13:08:31 (GMT) |
commit | 0a384496099569c2a675a94c5af06ad83cccb247 (patch) | |
tree | ef37f86ee8e33679e152464bd34e92b97bcc6347 /src/defargs.l | |
parent | ba8e4ea594cea3554e6e6f75fa0af67deb85db47 (diff) | |
download | Doxygen-0a384496099569c2a675a94c5af06ad83cccb247.zip Doxygen-0a384496099569c2a675a94c5af06ad83cccb247.tar.gz Doxygen-0a384496099569c2a675a94c5af06ad83cccb247.tar.bz2 |
Changed implementation, added test case
Diffstat (limited to 'src/defargs.l')
-rw-r--r-- | src/defargs.l | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/defargs.l b/src/defargs.l index 86e2529..d726fa9 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -104,17 +104,32 @@ static int yyread(char *buf,int max_size) } /* bug_520975 */ -static bool checkSpecialType(QCString &typ, QCString &nam) +static bool nameIsActuallyPartOfType(QCString &name) { - if (nam == "unsigned" || nam == "signed" || - nam == "int" || nam == "long" || - nam == "volatile" || nam == "const") return TRUE; - QCStringList qsl=QCStringList::split(' ',typ); - for (uint j=0;j<qsl.count();j++) + static bool first=TRUE; + static QDict<void> keywords(17); + if (first) // fill keyword dict first time { - if (!(qsl[j] == "volatile" || qsl[j] == "const")) return FALSE; + #define DUMMY_ADDR (void*)0x8 + keywords.insert("unsigned", DUMMY_ADDR); // foo(... unsigned) + keywords.insert("signed", DUMMY_ADDR); // foo(... signed) + keywords.insert("bool", DUMMY_ADDR); // foo(... bool) + keywords.insert("char", DUMMY_ADDR); // foo(... char) + keywords.insert("int", DUMMY_ADDR); // foo(... int) + keywords.insert("long", DUMMY_ADDR); // foo(... long) + keywords.insert("float", DUMMY_ADDR); // foo(... float) + keywords.insert("double", DUMMY_ADDR); // foo(... double) + keywords.insert("int8_t", DUMMY_ADDR); // foo(... int8_t) + keywords.insert("uint8_t", DUMMY_ADDR); // foo(... uint8_t) + keywords.insert("int16_t", DUMMY_ADDR); // foo(... int16_t) + keywords.insert("uint16_t", DUMMY_ADDR); // foo(... uint16_t) + keywords.insert("int32_t", DUMMY_ADDR); // foo(... int32_t) + keywords.insert("uint32_t", DUMMY_ADDR); // foo(... uint32_t) + keywords.insert("const", DUMMY_ADDR); // foo(... const) + keywords.insert("volatile", DUMMY_ADDR); // foo(... volatile) + first=FALSE; } - return TRUE; + return keywords.find(name)!=0; } %} @@ -398,9 +413,9 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" a->type.mid(sv)=="union" || a->type.mid(sv)=="class" || a->type.mid(sv)=="typename" || - checkSpecialType(a->type, a->name) + nameIsActuallyPartOfType(a->name) ) - { + { a->type = a->type + " " + a->name; a->name.resize(0); } |