https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66319

            Bug ID: 66319
           Summary: [6 Regression] gcov-tool.c:84:65: error: invalid
                    conversion from 'int (*)(const c har*, const stat*,
                    int, FTW*)' to 'int (*)(const char*, const stat*, int,
                    FTW)'
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
                CC: tsaunders at mozilla dot com
  Target Milestone: ---
              Host: hppa2.0w-hp-hpux11.11
            Target: hppa2.0w-hp-hpux11.11
             Build: hppa2.0w-hp-hpux11.11

g++ -std=c++98 -c   -g -DIN_GCC    -fno-exceptions -fno-rtti
-fasynchronous-unwi
nd-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -fno-common -Wno-error
-DHAVE_CONFIG_H -I. -I. -
I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include
-I../../gcc/gcc/../l
ibcpp/include -I/opt/gnu/gcc/gmp/include  -I../../gcc/gcc/../libdecnumber
-I../.
./gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace 
  -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include
-I../../gcc/gcc/../libcpp/include -I/opt/gnu/gcc/gmp/include 
-I../../gcc/gcc/../libdecnu
mber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber
-I../../gcc/gcc/../li
bbacktrace  -o libgcov-util.o ../../gcc/gcc/../libgcc/libgcov-util.c
../../gcc/gcc/gcov-tool.c: In function 'int unlink_profile_dir(const char*)':
../../gcc/gcc/gcov-tool.c:84:65: error: invalid conversion from 'int (*)(const
c
har*, const stat*, int, FTW*)' to 'int (*)(const char*, const stat*, int, FTW)' 
[-fpermissive]
     return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
                                                                 ^
In file included from ../../gcc/gcc/gcov-tool.c:39:0:
/usr/include/ftw.h:240:13: note:   initializing argument 2 of 'int nftw(const
ch
ar*, int (*)(const char*, const stat*, int, FTW), int, int)'
  inline int nftw(const char *a,int (*b)(const char *, const struct
             ^
make[3]: *** [gcov-tool.o] Error 1

The problem is function declaration of unlink_gcda_file doesn't match
declaration in In file included from ../../gcc/gcc/gcov-tool.c:39:0:
/usr/include/ftw.h:240.  Whether the fourth argument is "struct FTW *"
or "struct FTW" depends on compilation defines:

#ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED
        /*
         * Do Mapping of nftw()         */
#if (defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE)) ||
defined(_XOPE
N_SOURCE_EXTENDED)
        inline int nftw(const char *a,int (*b)(const char *,
                const struct stat *, int, struct FTW *), int c, int d)
                        {return __nftw64(a,b,c,d);}
#else /* (defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE)) ||
defined(
_XOPEN_SOURCE_EXTENDED) */
        inline int nftw(const char *a,int (*b)(const char *, const struct
                stat *, int, struct FTW), int c, int d)
                        {return __nftw64(a,b,c,d);}
#endif /* (defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE)) ||
defined
(_XOPEN_SOURCE_EXTENDED) */
#endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */

Sadly, unlink_gcda_file doesn't use this argument.

Probably introduced by

2015-02-09  Trevor Saunders  <tsaund...@mozilla.com>

        PR gcov-profile/61889
        * config.in: regenerate.
        * configure.in: Likewise.
        * configure.ac: Check for ftw.h.
        * gcov-tool.c: Check for ftw.h before using nftw.

and my switch to building with gcc-5.  There were numerous successful builds
after the above change was applied.

Reply via email to