bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix a warning on AIX


From: Bruno Haible
Subject: fix a warning on AIX
Date: Mon, 17 Oct 2016 02:18:05 +0200
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

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  <address@hidden>

        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"
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]