-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Honza, Jan, sorry for my late reply. I'm under heavy workload at the moment.

Am 19.10.2014 12:02, schrieb Jan Hubicka:
>> Honza, not sure if this patch is idea, but this will unblock mingw build
>> problems. Can this one get in?
It's important to have a solution for the mingw build problems!

> 
> Hmm, the patch is somewhat ugly and I do not know why MingW32 defines
> mkdir macro and how. If Kai Tietz or other MingW32 maintainer is OK about
> it, the patch is OK.
The first part of the patch changing gcov-tool.c is correct IMHO.
For the second part the situation is more complex, see below.
And no, mingw doesn't define the mkdir macro, it's in system.h, see below.

> 
> Honza
>> 
>> thanks,
>> 
>> David
>> 
>> On Wed, Sep 24, 2014 at 8:22 AM, Rainer Emrich 
>> <rai...@emrich-ebersheim.de> wrote:
>>> The following patch fixes PR61889 for x86_64-w64-mingw32. Details can
>>> be found on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61889
>>> 
>>> The patch was bootstrapped on x86_64-w64-mingw32.
>>> 
>>> If patch the patch is ok, Kai would you apply, please?
>>> 
>>> Rainer
>>> 
>>> 2014-09-24  Rainer Emrich  <rai...@emrich-ebersheim.de>
>>> 
>>> PR gcov-profile/61889 * gcc/gcov-tool.c: Remove wrong #if
>>> !defined(_WIN32) * libgcc/libgcov-driver-system.c: undefine clashing
>>> macro for mkdir
>>> 
>>> 
>>> 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);
This part is correct IMHO. gov-tool.c includes system.h which has:

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

MKDIR_TAKES_ONE_ARG is defined for mingw!


>>> 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.  */
For this part the systuation is more complex.
libgcov-driver-system.c is included by libgcov-driver.c which compiled in the
gcc subdirectory for linking with the gcov-tool and in the libgcc subdirectory
for inclusion in the libgcov.a archive.

libgcov-driver.c includes libgcov.h, which has the following:

#ifndef IN_GCOV_TOOL
/* About the target.  */
/* This path will be used by libgcov runtime.  */

#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
#include "libgcc_tm.h"
.
.
.

#else /* IN_GCOV_TOOL */
/* About the host.  */
/* This path will be compiled for the host and linked into
   gcov-tool binary.  */

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"

So, in the case compiling for gcov-tool system.h get's included which defines
the offending mkdir marco. In the case compiling for libgcov.a system.h is not
included so ther's no issue.

I don't know how to solve this in a clean way. This design looks a little bit
ugly.

Cheers
Rainer

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJUXL/WAAoJEB3HOsWs+KJbjfwIAKvwvWwYqwHR08JyWSEyxXkX
psSPwpbwE8WYc6CVYb9nGpGG+zgRpUqxoTXvKS5HuTH81y8Y+/CffFdpSLUCGMMV
OjpDOVwE6EUhusdZ6FKX94/vkKlF9L9HPpPAf3+045tyqqrHcVfBtujBTwG8ftiK
qHCo1I7ZK8cTn3x4bnoe5nHUGFnBZ0Iz4Ch0MjdPzdhDwd5DHgJmr/BUHFIJOWSR
m/Fd9oGmHrhKgG0NbuWUNTed6sgmPrb3rFZm22d4q4xHyiRZvoVkvpxvz3FY5HWE
XJRtbEPPiYrXgJzqAxOiTw6IpHtUR9mXSBOTdm7TMkUl5or1H+96XuHSojCvgDE=
=Hz1j
-----END PGP SIGNATURE-----

Reply via email to