public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libc: fix fropen/fwopen compile warnings
@ 2022-12-07 10:59 Alexey Lapshin
  2022-12-07 12:23 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Lapshin @ 2022-12-07 10:59 UTC (permalink / raw)
  To: newlib; +Cc: Alexey Gerenkov, Ivan Grokhotkov, Anton Maklakov

This patch fixes warnings that appears when compiling:


#define fwopen(__cookie,__fn) funopen(__cookie, (int (*)())0, __fn,
(fpos_t (*)())0, (int (*)())0)
Expands to:

funopen(__null, (int (*)())0, &app_printf, (fpos_t (*)())0, (int
(*)())0)
argument of type "int (*)()" is incompatible with parameter of type
"int (*)(void *__cookie, char *__buf, int __n)"C/C++(167)
invalid conversion from 'fpos_t (*)()' {aka 'long int (*)()'} to
'fpos_t (*)(void*, fpos_t, int)' {aka 'long int (*)(void*,

Discussion is here:
https://github.com/espressif/arduino-esp32/issues/7407


---
 newlib/libc/include/stdio.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index ab18806e3..08c1ffe45 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -614,10 +614,8 @@ FILE	*_funopen_r (struct _reent *, const
void *__cookie,
 		int (*__closefn)(void *__cookie));
 # endif /* !__LARGE64_FILES */
 
-# define	fropen(__cookie, __fn) funopen(__cookie, __fn, (int
(*)())0, \
-					       (fpos_t (*)())0, (int
(*)())0)
-# define	fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0,
__fn, \
-					       (fpos_t (*)())0, (int
(*)())0)
+# define	fropen(__cookie, __fn) funopen(__cookie, __fn, NULL,
NULL, NULL)
+# define	fwopen(__cookie, __fn) funopen(__cookie, NULL, __fn,
NULL, NULL)
 #endif /* __BSD_VISIBLE */
 
 #if __GNU_VISIBLE
-- 
2.34.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-07 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 10:59 [PATCH] libc: fix fropen/fwopen compile warnings Alexey Lapshin
2022-12-07 12:23 ` Corinna Vinschen

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).