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

Bug#178960: libc6-dev: sys/stat.h: lstat declaration omitted with -ansi compiler option



Package: libc6-dev
Version: 2.2.5-14.3
Severity: normal

Hi,

When I include <sys/stat.h> and also specify the "-ansi" option to
the C compiler, then the declaration for the "lstat" function is
omitted.

Note that the declaration for the "fstat" function is properly
generated, regardless of whether the "-ansi" option is specified
or not.

Here is the simplest test case that I could come up with,

    227 jeff ~ $  echo '#include <sys/stat.h>' | gcc-2.95  -c - -E | grep
    -e [fl]stat
    extern int fstat (int __fd, struct stat *__buf)  ;
    extern int lstat (__const char *__restrict __file,
    extern __inline__ int lstat (__const char *__path,
    extern __inline__ int fstat (int __fd, struct stat *__statbuf)

    228 jeff ~ $  echo '#include <sys/stat.h>' | gcc-2.95 -ansi -c - -E |
    grep  -e [fl]stat
    extern int fstat (int __fd, struct stat *__buf)  ;
    extern __inline__ int fstat (int __fd, struct stat *__statbuf)

Here is an excerpt from "/usr/include/sys/stat.h", where the
declarations for "[fl]stat" are (supposed to be) generated,

 198: #ifndef __USE_FILE_OFFSET64
 199: /* Get file attributes for FILE and put them in BUF.  */
 200: extern int stat (__const char *__restrict __file,
 201:                  struct stat *__restrict __buf) __THROW;
 202:
 203: /* Get file attributes for the file, device, pipe, or socket
 204:    that file descriptor FD is open on and put them in BUF.  */
 205: extern int fstat (int __fd, struct stat *__buf) __THROW;
 206: #else
 207: # ifdef __REDIRECT
 208: extern int __REDIRECT (stat,
 209:                        (__const char *__restrict __file,
 210:                         struct stat *__restrict __buf) __THROW,
 211:                        stat64);
 212: extern int __REDIRECT (fstat, (int __fd, struct stat *__buf) __THROW, fsta
t64);
 213: # else
 214: #  define stat stat64
 215: #  define fstat fstat64
 216: # endif
 217: #endif
 218: #ifdef __USE_LARGEFILE64
 219: extern int stat64 (__const char *__restrict __file,
 220:                    struct stat64 *__restrict __buf) __THROW;
 221: extern int fstat64 (int __fd, struct stat64 *__buf) __THROW;
 222: #endif
 223:
 224: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 225: # ifndef __USE_FILE_OFFSET64
 226: /* Get file attributes about FILE and put them in BUF.
 227:    If FILE is a symbolic link, do not follow it.  */
 228: extern int lstat (__const char *__restrict __file,
 229:                   struct stat *__restrict __buf) __THROW;
 230: # else
 231: #  ifdef __REDIRECT
 232: extern int __REDIRECT (lstat,
 233:                        (__const char *__restrict __file,
 234:                         struct stat *__restrict __buf) __THROW,
 235:                        lstat64);
 236: #  else
 237: #   define lstat lstat64
 238: #  endif
 239: # endif
 240: # ifdef __USE_LARGEFILE64
 241: extern int lstat64 (__const char *__restrict __file,
 242:                     struct stat64 *__restrict __buf) __THROW;
 243: # endif
 244: #endif

Note that I also tried the same test case as above, but in
addition, I also included <unistd.h> as the first include
statement, and I got the same same results, ie, the "lstat"
declaration was not generated.

I found this bug by using the C compiler's "-Wmissing-prototypes"
option.

Thanks,
-- 
Jeff Sheinberg


-- System Information
Debian Release: testing/sarge
Kernel Version: Linux l1.bsrd.net 2.4.19-1 #1 Sat Aug 24 17:01:11 EDT 2002 i586 AMD-K6(tm) 3D processor AuthenticAMD GNU/Linux


Versions of the packages libc6-dev depends on:
ii  libc6          2.2.5-14.3     GNU C Library: Shared libraries and Timezone





Reply to: