From 657a6b5348d453fd1351b8c3238426e25acdbbb9 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 14 Jul 2018 16:43:17 +0200 Subject: Bug 520975 - Unnamed parameters parsed incorrectly Added "signed" and "unsigned" to the list of "special types" analogous to "const" and "volatile" Created a function for this that would make it possible to have also constructs like "const const" recognized. --- src/defargs.l | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/defargs.l b/src/defargs.l index 7f1e1bb..f925ffb 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -52,6 +52,7 @@ #include #include #include +#include #include "defargs.h" #include "entry.h" @@ -102,6 +103,17 @@ static int yyread(char *buf,int max_size) return c; } +/* bug_520975 */ +static bool checkSpecialType(QCString &typ) +{ + QStringList qsl=QStringList::split(' ',typ); + for(uint j=0;jtype.mid(sv)=="union" || a->type.mid(sv)=="class" || a->type.mid(sv)=="typename" || - a->type=="const" || - a->type=="volatile" + checkSpecialType(a->type) ) { a->type = a->type + " " + a->name; -- cgit v0.12 From 7ef7b137d38d7ddcbcef787704317531b44c2baf Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 14 Jul 2018 19:28:02 +0200 Subject: Bug 436883 - Handling of unnamed parameters (C/C++) unclear Also the name should not be a reserved type of word. --- src/defargs.l | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/defargs.l b/src/defargs.l index f925ffb..47fa763 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -104,8 +104,10 @@ static int yyread(char *buf,int max_size) } /* bug_520975 */ -static bool checkSpecialType(QCString &typ) +static bool checkSpecialType(QCString &typ, QCString &nam) { + if (nam == "unsigned" || nam == "signed" || + nam == "volatile" || nam == "const") return TRUE; QStringList qsl=QStringList::split(' ',typ); for(uint j=0;jtype.mid(sv)=="union" || a->type.mid(sv)=="class" || a->type.mid(sv)=="typename" || - checkSpecialType(a->type) + checkSpecialType(a->type, a->name) ) { a->type = a->type + " " + a->name; -- cgit v0.12 From d0852053693f3f56741657f2a5167950e4d000d5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 28 Oct 2018 15:52:34 +0100 Subject: Use QCStringList::split i.s.o. QStringList::split --- src/defargs.l | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/defargs.l b/src/defargs.l index 47fa763..52052fa 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include "defargs.h" #include "entry.h" @@ -108,8 +108,8 @@ static bool checkSpecialType(QCString &typ, QCString &nam) { if (nam == "unsigned" || nam == "signed" || nam == "volatile" || nam == "const") return TRUE; - QStringList qsl=QStringList::split(' ',typ); - for(uint j=0;jtype.mid(sv)=="union" || a->type.mid(sv)=="class" || a->type.mid(sv)=="typename" || - checkSpecialType(a->type, a->name) + checkSpecialType(a->type, a->name) ) { a->type = a->type + " " + a->name; -- cgit v0.12