summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/defargs.l35
-rw-r--r--testing/075/struct_foo.xml148
-rw-r--r--testing/075_argmatch.cpp30
3 files changed, 203 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);
}
diff --git a/testing/075/struct_foo.xml b/testing/075/struct_foo.xml
new file mode 100644
index 0000000..eca791b
--- /dev/null
+++ b/testing/075/struct_foo.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="struct_foo" kind="struct" language="C++" prot="public">
+ <compoundname>Foo</compoundname>
+ <sectiondef kind="public-func">
+ <memberdef kind="function" id="struct_foo_1a4f9767677227174b2a9684b92e36cba7" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(float value)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>float</type>
+ <declname>value</declname>
+ </param>
+ <briefdescription>
+ <para>Float. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="5" column="1" bodyfile="075_argmatch.cpp" bodystart="14" bodyend="14"/>
+ </memberdef>
+ <memberdef kind="function" id="struct_foo_1a3b1460a8784e5cc8156899a04df08b94" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(unsigned value)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>unsigned</type>
+ <declname>value</declname>
+ </param>
+ <briefdescription>
+ <para>Unsigned int. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="6" column="1" bodyfile="075_argmatch.cpp" bodystart="17" bodyend="17"/>
+ </memberdef>
+ <memberdef kind="function" id="struct_foo_1a87f5be128245c4a16b25500fe6ae2fd1" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(unsigned long)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>unsigned long</type>
+ </param>
+ <briefdescription>
+ <para>Unnamed unsigned long. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="7" column="1" bodyfile="075_argmatch.cpp" bodystart="20" bodyend="20"/>
+ </memberdef>
+ <memberdef kind="function" id="struct_foo_1adc1cd4494f8a556d5bf6cb78409e3e68" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(signed long)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>signed long</type>
+ </param>
+ <briefdescription>
+ <para>Unnamed signed long. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="8" column="1" bodyfile="075_argmatch.cpp" bodystart="23" bodyend="23"/>
+ </memberdef>
+ <memberdef kind="function" id="struct_foo_1a0baba36cdd24740c6e39d5641e30a0fe" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(const struct Foo)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>const struct <ref refid="struct_foo" kindref="compound">Foo</ref></type>
+ </param>
+ <briefdescription>
+ <para>Unnamed struct foo. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="9" column="1" bodyfile="075_argmatch.cpp" bodystart="26" bodyend="26"/>
+ </memberdef>
+ <memberdef kind="function" id="struct_foo_1abeaaeb54ad61db26205c06927968845f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Foo::foo</definition>
+ <argsstring>(const char *const, const double param2)</argsstring>
+ <name>foo</name>
+ <param>
+ <type>const char * const</type>
+ </param>
+ <param>
+ <type>const double</type>
+ <declname>param2</declname>
+ </param>
+ <briefdescription>
+ <para>Unnamed const pointer. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="075_argmatch.cpp" line="10" column="1"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ <para><ref refid="struct_foo" kindref="compound">Foo</ref>. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="075_argmatch.cpp" line="4" column="1" bodyfile="075_argmatch.cpp" bodystart="4" bodyend="11"/>
+ <listofallmembers>
+ <member refid="struct_foo_1a4f9767677227174b2a9684b92e36cba7" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ <member refid="struct_foo_1a3b1460a8784e5cc8156899a04df08b94" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ <member refid="struct_foo_1a87f5be128245c4a16b25500fe6ae2fd1" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ <member refid="struct_foo_1adc1cd4494f8a556d5bf6cb78409e3e68" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ <member refid="struct_foo_1a0baba36cdd24740c6e39d5641e30a0fe" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ <member refid="struct_foo_1abeaaeb54ad61db26205c06927968845f" prot="public" virt="non-virtual">
+ <scope>Foo</scope>
+ <name>foo</name>
+ </member>
+ </listofallmembers>
+ </compounddef>
+</doxygen>
diff --git a/testing/075_argmatch.cpp b/testing/075_argmatch.cpp
new file mode 100644
index 0000000..439cdca
--- /dev/null
+++ b/testing/075_argmatch.cpp
@@ -0,0 +1,30 @@
+// objective: test argument matching in particular for unnamed types
+// check: struct_foo.xml
+/** @brief Foo */
+struct Foo {
+ void foo(float value);
+ void foo(unsigned value);
+ void foo(unsigned long);
+ void foo(signed long);
+ void foo(const struct Foo);
+ void foo(const char * const, const double param2);
+};
+
+/** @brief Float */
+void Foo::foo(float) {}
+
+/** @brief Unsigned int */
+void Foo::foo(unsigned value) {}
+
+/** @brief Unnamed unsigned long */
+void Foo::foo(unsigned long) {}
+
+/** @brief Unnamed signed long */
+void Foo::foo(signed long) {}
+
+/** @brief Unnamed struct foo */
+void Foo::foo(const struct Foo) {}
+
+/** @brief Unnamed const pointer */
+void Foo::foo(const char * const, const double param2);
+