Discussion:
fix a warning on AIX
(too old to reply)
Bruno Haible
2016-10-17 00:18:05 UTC
Permalink
Raw Message
On AIX 7.1 with gcc, I see this compilation warning:

test-system-quote-child.c: In function 'main':
test-system-quote-child.c:48:5: warning: implicit declaration of function 'fopen' [-Wimplicit-function-declaration]
FILE *fp = fopen (EXPECTED_DATA_FILE, "rb");
^
test-system-quote-child.c:48:16: warning: initialization makes pointer from integer without a cast [enabled by default]
FILE *fp = fopen (EXPECTED_DATA_FILE, "rb");
^

The reason is that _LARGE_FILES is in effect, <stdio.h> originally defines
#define fopen fopen64
and it declares fopen64 (but not fopen!), and after gnulib's
#define fopen rpl_fopen
and
#undef fopen
the symbol 'fopen' does not refer to a declared function any more.

This patch will fix it.


2016-10-16 Bruno Haible <***@clisp.org>

system-quote tests: Avoid compiler warning on AIX.
* tests/test-system-quote-child.c (fopen): Redefine like the system's
<stdio.h> does.

diff --git a/tests/test-system-quote-child.c b/tests/test-system-quote-child.c
index 75ed87a..4e4fcdd 100644
--- a/tests/test-system-quote-child.c
+++ b/tests/test-system-quote-child.c
@@ -25,6 +25,10 @@
#undef fopen
#undef fprintf
#undef fread
+/* Restore the original fopen definition on AIX. */
+#if defined _AIX && defined _LARGE_FILES
+# define fopen fopen64
+#endif

#define EXPECTED_DATA_FILE "t-sq-data.tmp"

Loading...