bug-coreutils
[Top][All Lists]
Advanced

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

fts.c doesn't compile with C89 compiler


From: Bruno Haible
Subject: fts.c doesn't compile with C89 compiler
Date: Tue, 24 Oct 2006 14:29:09 +0200
User-agent: KMail/1.9.1

Hi,

Compiling coreutils-6.4 with gcc-4.1 and

./configure --prefix=/packages/gnu \
  CPPFLAGS="-Wall -Wformat=2 -Wmissing-field-initializers 
-Wmissing-format-attribute -Wpointer-arith -Wstrict-aliasing=2 -Wwrite-strings" 
\
  CFLAGS="-O2 -g -Wbad-function-cast -Wdeclaration-after-statement"

yields a warning:

fts.c:1076: warning: ISO C90 forbids mixed declarations and code

gnulib still assumes C89 only. Here is a fix.

Jim, OK to apply?


2006-10-23  Bruno Haible  <address@hidden>

        * fts.c (fts_build): Move variable declaration, for C89 compliance.

*** fts.c.bak   2006-10-13 15:41:20.000000000 +0200
--- fts.c       2006-10-24 01:43:38.000000000 +0200
***************
*** 1008,1013 ****
--- 1008,1015 ----
        /* Read the directory, attaching each entry to the `link' pointer. */
        doadjust = false;
        for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+               bool is_dir;
+ 
                if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
                        continue;
  
***************
*** 1073,1079 ****
                } else
                        p->fts_accpath = p->fts_name;
  
-               bool is_dir;
                if (sp->fts_compar == NULL || ISSET(FTS_DEFER_STAT)) {
                        /* Record what fts_read will have to do with this
                           entry. In many cases, it will simply fts_stat it,
--- 1075,1080 ----




reply via email to

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