[patch] fix compilation if PUTC_MACRO and/or GETC_MACRO is turned off
Bernhard Fischer
rep.nop at aon.at
Thu Dec 14 15:39:45 UTC 2006
Hi,
$ grep "C_MACRO" uClibc.config
# UCLIBC_HAS_STDIO_GETC_MACRO is not set
# UCLIBC_HAS_STDIO_PUTC_MACRO is not set
i586-linux-uclibc-gcc -c -Os -fPIC -fno-tree-loop-optimize
-fno-tree-dominator-opts -fno-strength-reduce -fno-branch-count-reg
-falign-functions=1 -falign-jumps=1 -falign-loops=1
-mpreferred-stack-boundary=2 -g -DHAVE_CONFIG_H -DVERSION=\"3.1.9\"
-DETCDIR=\"/etc\" -DLOADAVG_MX=0.8 -DDAEMON_USERNAME=\"at\"
-DDAEMON_GROUPNAME=\"at\" -DLFILE=\"/var/lib/atjobs/.SEQ\" -Wall at.c
at.c: In function 'writefile':
at.c:468: error: '__stdin' undeclared (first use in this function)
at.c:468: error: (Each undeclared identifier is reported only once
at.c:468: error: for each function it appears in.)
at.c: In function 'process_jobs':
at.c:681: error: '__stdout' undeclared (first use in this function)
As i don't want to get in andersee's way with merging with mjn3, i want
to know if this is ok to install now.
thanks,
Bernhard
-------------- next part --------------
Index: uClibc/include/stdio.h
===================================================================
--- uClibc/include/stdio.h (revision 16918)
+++ uClibc/include/stdio.h (working copy)
@@ -840,7 +840,14 @@ extern void funlockfile (FILE *__stream)
#define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
#endif
+#ifndef __STDIO_GETC_MACRO
+#define __stdin stdin
+#endif
#define getchar() __GETC(__stdin)
+
+#ifndef __STDIO_PUTC_MACRO
+#define __stdout stdout
+#endif
#define putchar(_ch) __PUTC((_ch), __stdout)
#if defined __USE_POSIX || defined __USE_MISC
Index: uClibc/libc/stdio/gets.c
===================================================================
--- uClibc/libc/stdio/gets.c (revision 16918)
+++ uClibc/libc/stdio/gets.c (working copy)
@@ -11,11 +11,9 @@ link_warning(gets, "the 'gets' function
/* UNSAFE FUNCTION -- do not bother optimizing */
+/* disable macro, force actual function call */
+#undef getchar_unlocked
libc_hidden_proto(getchar_unlocked)
-libc_hidden_proto(__fgetc_unlocked)
-#ifndef __STDIO_GETC_MACRO
-#define __stdin stdin
-#endif
char *gets(char *s)
{
Index: uClibc/libc/stdio/getchar.c
===================================================================
--- uClibc/libc/stdio/getchar.c (revision 16918)
+++ uClibc/libc/stdio/getchar.c (working copy)
@@ -12,7 +12,9 @@ libc_hidden_proto(__fgetc_unlocked)
#undef getchar
#ifdef __DO_UNLOCKED
+/* the only use of the hidden getchar_unlocked is in gets.c */
#undef getchar_unlocked
+libc_hidden_proto(getchar_unlocked)
int getchar_unlocked(void)
{
register FILE *stream = stdin;
More information about the uClibc
mailing list