* -Wmissing-prototypes triggers in uninorm/decompose-internal.c
@ 2020-02-19 13:36 Tim Rühsen
2020-02-19 19:33 ` Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Tim Rühsen @ 2020-02-19 13:36 UTC (permalink / raw)
To: bug-gnulib
[-- Attachment #1.1: Type: text/plain, Size: 540 bytes --]
There seems to be a prototype missing in uninorm/decompose-internal.h:
uninorm/decompose-internal.c:26:27: warning: no previous prototype for
'gl_uninorm_decompose_merge_sort_fromto' [-Wmissing-prototypes]
26 | #define merge_sort_fromto gl_uninorm_decompose_merge_sort_fromto
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uninorm/decompose-internal.c:26:27: note: in definition of macro
'merge_sort_fromto'
26 | #define merge_sort_fromto gl_uninorm_decompose_merge_sort_fromto
Regards, Tim
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: -Wmissing-prototypes triggers in uninorm/decompose-internal.c
2020-02-19 13:36 -Wmissing-prototypes triggers in uninorm/decompose-internal.c Tim Rühsen
@ 2020-02-19 19:33 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2020-02-19 19:33 UTC (permalink / raw)
To: bug-gnulib; +Cc: Tim Rühsen
Tim Rühsen wrote:
> There seems to be a prototype missing in uninorm/decompose-internal.h:
>
> uninorm/decompose-internal.c:26:27: warning: no previous prototype for
> 'gl_uninorm_decompose_merge_sort_fromto' [-Wmissing-prototypes]
> 26 | #define merge_sort_fromto gl_uninorm_decompose_merge_sort_fromto
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> uninorm/decompose-internal.c:26:27: note: in definition of macro
> 'merge_sort_fromto'
> 26 | #define merge_sort_fromto gl_uninorm_decompose_merge_sort_fromto
Thanks for the report. Fixed as follows:
2020-02-19 Bruno Haible <bruno@clisp.org>
uninorm/decompose-internal: Avoid "no previous prototype" warning.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00105.html>.
* lib/array-mergesort.h: Accept an optional macro definition
STATIC_FROMTO.
* lib/uninorm/decompose-internal.c (STATIC_FROMTO): New macro.
diff --git a/lib/array-mergesort.h b/lib/array-mergesort.h
index 3d363bb..bf86d64 100644
--- a/lib/array-mergesort.h
+++ b/lib/array-mergesort.h
@@ -29,6 +29,8 @@
respectively, less, equal, or greater than the element
pointed to by the second argument.
STATIC The storage class of the functions being defined.
+ STATIC_FROMTO (Optional.) Overrides STATIC for the 'merge_sort_fromto'
+ function.
Before including this file, you also need to include:
#include <stddef.h>
*/
@@ -87,7 +89,12 @@ merge (const ELEMENT *src1, size_t n1,
/* Sort src[0..n-1] into dst[0..n-1], using tmp[0..n/2-1] as temporary
(scratch) storage.
The arrays src, dst, tmp must not overlap. */
-STATIC void
+#ifdef STATIC_FROMTO
+STATIC_FROMTO
+#else
+STATIC
+#endif
+void
merge_sort_fromto (const ELEMENT *src, ELEMENT *dst, size_t n, ELEMENT *tmp)
{
switch (n)
diff --git a/lib/uninorm/decompose-internal.c b/lib/uninorm/decompose-internal.c
index 62a7046..e2c20e9 100644
--- a/lib/uninorm/decompose-internal.c
+++ b/lib/uninorm/decompose-internal.c
@@ -23,6 +23,7 @@
#define ELEMENT struct ucs4_with_ccc
#define COMPARE(a,b) ((a)->ccc - (b)->ccc)
#define STATIC
+#define STATIC_FROMTO static
#define merge_sort_fromto gl_uninorm_decompose_merge_sort_fromto
#define merge_sort_inplace gl_uninorm_decompose_merge_sort_inplace
#include "array-mergesort.h"
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-19 19:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 13:36 -Wmissing-prototypes triggers in uninorm/decompose-internal.c Tim Rühsen
2020-02-19 19:33 ` Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).