Skip to content

Bad tokenization of function pointers from function arguments #1285

@mihaipopescu

Description

@mihaipopescu

Expected versus output diff:

diff --git "a/C:\\work\\external\\uncrustify\\tests\\output\\staging\\60028-UNI-21509.cpp" "b/C:\\work\\external\\uncrustify\\tests\\results\\staging\\60028-UNI-21509.cpp"
index c89583f..3813c39 100644
--- "a/C:\\work\\external\\uncrustify\\tests\\output\\staging\\60028-UNI-21509.cpp"
+++ "b/C:\\work\\external\\uncrustify\\tests\\results\\staging\\60028-UNI-21509.cpp"
@@ -1,11 +1,15 @@
 void (*foo)(int);
 static bar(void (*foo)(int))
 {
 }
 
 bool (*comp_func)(const TypeA*const a, const TypeB& value) = NULL;
-static foo(bool (*comp_func)(const TypeA*const a, const TypeB& value) = NULL)
+static foo(bool (*comp_func)(const TypeA * const a, const TypeB&value));
+static foo(bool (*comp_func)(const TypeA * const a, const TypeB&value) = NULL)
 {
 }
 
-void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void*, const void&));
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const TypeA* lhs, const TypeB&rhs));
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const TypeA* lhs, const TypeB&rhs) = NULL)
+{
+}

Debug support files:

60028-UNI-21509.cpp
60028-UNI-21509.cpp.log
60028-UNI-21509.cpp.unc
Uncrustify.Cpp.cfg
UNI-21509.cpp

Disclaimer:

Note: This is a generated issue from our internal issue tracker.
Expect a dry description which could be insufficient to properly understand the issue.
On the other hand, the support files should be sufficient to easily reproduce and debug the issue,
but please comment if it's still unclear and I will get back with clarifications.
See main discussion thread here #1223.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions