Avoid redundant declarations for wxQsort()

This works around gcc -Wredundant-decls warning that was given (if
explicitly enabled) when both wx/vector.h and wx/utils.h were included.

The workaround is ugly, but it doesn't seem worth it to introduce a
separate wx/qsort.h header just for this single function, which seems to
be the only other way to fix this.

Closes https://github.com/wxWidgets/wxWidgets/pull/1271
This commit is contained in:
Vadim Zeitlin
2019-03-20 15:12:58 +01:00
parent f5f912efa1
commit 39380847da
2 changed files with 16 additions and 0 deletions

View File

@@ -41,6 +41,13 @@ inline void wxVectorSort(wxVector<T>& v)
// wxQsort is declared in wx/utils.h, but can't include that file here,
// it indirectly includes this file. Just lovely...
//
// Moreover, just declaring it here unconditionally results in gcc
// -Wredundant-decls warning, so use a preprocessor guard to avoid this.
#ifndef wxQSORT_DECLARED
#define wxQSORT_DECLARED
typedef int (*wxSortCallback)(const void* pItem1,
const void* pItem2,
const void* user_data);
@@ -48,6 +55,8 @@ WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems,
size_t size, wxSortCallback cmp,
const void* user_data);
#endif // !wxQSORT_DECLARED
namespace wxPrivate
{