bug-gnulib
[Top][All Lists]
Advanced

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

glob: fix warnings on AIX


From: Bruno Haible
Subject: glob: fix warnings on AIX
Date: Sun, 25 Mar 2007 21:36:11 +0200
User-agent: KMail/1.5.4

On AIX 5.1, the compiler shows these warnings:

"glob.c", line 666.47: 1506-280 (E) Function argument assignment between types 
"struct stat*" and "struct stat64*" is not allowed.
"glob.c", line 1016.42: 1506-280 (E) Function argument assignment between types 
"struct stat*" and "struct stat64*" is not allowed.
"glob.c", line 1066.43: 1506-280 (E) Function argument assignment between types 
"struct stat*" and "struct stat64*" is not allowed.

This warning sounds more dangerous than it is. Nevertheless, it's good to
silence it.

What's happening, is that config.h defines
   #define _LARGE_FILES 1
which instructs sys/stat.h to enable LFS variants of the structs and functions.
In particular it defines 'struct stat64' and then does
   #define stat stat64
Now, when glob.c is compiled, glob-libc.h defines function types that use
'struct stat' (using just a forward declaration). Then later <sys/stat.h>
is included, and further references to 'stat' macroexpand to 'stat64'.

So the fix is simply to make sure the
   #define stat stat64
is in place before glob-libc.h starts dealing with it. I'm applying this:


2007-03-25  Bruno Haible  <address@hidden>

        * lib/glob_.h: Include <sys/stat.h>. Avoids warnings on AIX 5.1.

*** lib/glob_.h 3 Mar 2007 12:35:26 -0000       1.7
--- lib/glob_.h 25 Mar 2007 19:27:58 -0000
***************
*** 27,32 ****
--- 27,37 ----
  
  #include <stddef.h>
  
+ /* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat 
stat64".
+    Make sure this definition is seen before glob-libc.h defines types that
+    rely on 'struct stat'.  */
+ #include <sys/stat.h>
+ 
  #ifndef __BEGIN_DECLS
  # define __BEGIN_DECLS
  # define __END_DECLS





reply via email to

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