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

--- Comment #8 from Rainer Emrich <rai...@emrich-ebersheim.de> ---
(In reply to xur from comment #7)
> OK. I'll fix this and submit another patch.
What is the status for that?

> 
> On Wed, Aug 20, 2014 at 11:26 AM, ktietz at gcc dot gnu.org
> <gcc-bugzi...@gcc.gnu.org> wrote:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61889
> >
> > --- Comment #6 from Kai Tietz <ktietz at gcc dot gnu.org> ---
> > Yes, I remember.  I didn't comment on it.
> > The following checks aren't ok.
> > '#if !defined(_WIN32)'
> >
> > you should disable those parts *only* if ftw API isn't present. This you 
> > should
> > check by a HAVE_FTW_H configure-check-macro.  To disable it just because 
> > _WIN32
> > is defined is wrong.
> >
Quoting Kai Tietz:
Issue got fixed on mingw-w64's side by providing on trunk ftw/nftw API.

Nevertheless there is still an issue with the use of "mkdir":
g++ -c   -g -DIN_GCC    -fno-exceptions -fno-rtti -fasynchronous-unwind-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   -DHAVE_CONFIG_H -I. -I.
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/.
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/../include
-I./../intl
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/../libcpp/include
-I/opt/devel/SCRATCH/tmp.Yed3qsDdVp/install/include
-I/opt/devel/SCRATCH/tmp.Yed3qsDdVp/install/include
-I/opt/devel/SCRATCH/tmp.Yed3qsDdVp/install/include 
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/../libdecnumber
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/../libdecnumber/bid
-I../libdecnumber
-I../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/../libbacktrace
-DCLOOG_INT_GMP -I/opt/devel/SCRATCH/tmp.Yed3qsDdVp/install/include
-DCLOOG_INT_GMP -I/opt/devel/SCRATCH/tmp.Yed3qsDdVp/install/include  -o
gcov-tool.o -MT gcov-tool.o -MMD -MP -MF ./.deps/gcov-tool.TPo
../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/gcov-tool.c
../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/gcov-tool.c:95:21:
error: macro "mkdir" requires 2 arguments, but only 1 given
       if (mkdir (out) == -1 && errno != EEXIST)
                     ^
../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/gcov-tool.c:
In function 'void gcov_output_files(const char*, gcov_info*)':
../../../../../../../opt/devel/gnu/src/gcc-mingw-w64/gcc-5.0.0/gcc/gcov-tool.c:95:27:
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
       if (mkdir (out) == -1 && errno != EEXIST)
                           ^

This clashes with the macro definition for mkdir in system.h:

/* Some systems have mkdir that takes a single argument.  */
#ifdef MKDIR_TAKES_ONE_ARG
# define mkdir(a,b) mkdir (a)
#endif 

Removing the wrong #if !defined(_WIN32) solves the issue for gcov-tool.c:

Index: gcc/gcov-tool.c
===================================================================
--- gcc/gcov-tool.c    (Revision 215554)
+++ gcc/gcov-tool.c    (Arbeitskopie)
@@ -89,11 +89,7 @@ gcov_output_files (const char *out, stru
   /* Try to make directory if it doesn't already exist.  */
   if (access (out, F_OK) == -1)
     {
-#if !defined(_WIN32)
       if (mkdir (out, S_IRWXU | S_IRWXG | S_IRWXO) == -1 && errno != EEXIST)
-#else
-      if (mkdir (out) == -1 && errno != EEXIST)
-#endif
         fatal_error ("Cannot make directory %s", out);
     } else
       unlink_profile_dir (out); 

At a second point the issue is more complex. In libgcc/libgcov-driver-system.c
there is the following code:

#ifdef TARGET_POSIX_IO
            && mkdir (filename, 0755) == -1
#else
            && mkdir (filename) == -1
#endif

libgcov-driver-system.c is used in two places, in the gcc directory and in the
the libgcc directory for libgcov. In the first case the macro for mkdir is
defined in the second it isn't.

An ugly hack solves this issue and lets me at least build gcc-5.0.0 on
x86_64-w64-mingw32.

Index: libgcc/libgcov-driver-system.c
===================================================================
--- libgcc/libgcov-driver-system.c    (Revision 215554)
+++ libgcc/libgcov-driver-system.c    (Arbeitskopie)
@@ -66,6 +66,9 @@ create_file_directory (char *filename)
 #ifdef TARGET_POSIX_IO
             && mkdir (filename, 0755) == -1
 #else
+#ifdef mkdir
+#undef mkdir
+#endif
             && mkdir (filename) == -1
 #endif
             /* The directory might have been made by another process.  */ 


Someone with more insight should have a look on this, please!

Reply via email to