From patchwork Fri Jan 30 12:43:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tbsaunde+gcc@tbsaunde.org X-Patchwork-Id: 434846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8F3201401F0 for ; Fri, 30 Jan 2015 23:48:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=FKF1F6hWyDrR ML8UvXcrU8450jrl8KhhHMLZ3qJ+mM8YMZ0sBj6uwJQh2cv9d2G3dRwlUxOswKtu wQySFmyHC/yozn+Y8DMk2tJxih+sK7yS4/SXdkTh2/Gr/4MtVh+TjUMRp5QfLCbL XinN0iSIeuzBWpL/acwqihbb1KCPjBs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=/jFJsZW1IFhDUsE5gP 0JBYTwYF0=; b=DDIRdmdZT9N89nnX7zXuPy7uDJcEIff11BtXBFPsMiXHlEBRcS L9sXeYmIOD/sHc65sbjZE27k/nqzebHG/fnfRI5a4RceED4NmvcsELjes6tvELDp ujlOrgri5uYtyGSCKRqGriGaThNzJ23cllaaRKsTXZPi65LKl/ntCMoA0= Received: (qmail 1465 invoked by alias); 30 Jan 2015 12:48:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 1383 invoked by uid 89); 30 Jan 2015 12:47:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Jan 2015 12:47:55 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [23.233.68.71]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 01C09C0BD; Fri, 30 Jan 2015 12:47:52 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Cc: Trevor Saunders Subject: [PATCH] pr 61889 - support gcov-tool without ftw.h Date: Fri, 30 Jan 2015 07:43:33 -0500 Message-Id: <1422621813-11997-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes From: Trevor Saunders Hi, given the glibc man page claims this is in POSIX.1-2001 and SUv1, and none of the people testing on normally odd systems other than mingw have complained it doesn't seem terribly likely there's many other hosts where this is an issue, so I just did the minimal thing of not supporting clearing gcda files if the host doesn't provide ftw.h. Besides people can remove the gcda files themselves easily enough. bootstrapped on x86_64-unknown-linux-gnu, and checked compile / .ii files for both HAVE_FTW_H defined to 0 and 1, ok? Trev gcc/ PR gcov-profile/61889 * config.in: regenerate. * auto-host.h: Likewise. * configure.ac: Check for ftw.h. * gcov-tool.c: Check for ftw.h before using nftw. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f35e3c7..bb1ef0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-01-29 Trevor Saunders + + PR gcov-profile/61889 + * config.in: regenerate. + * auto-host.h: Likewise. + * configure.ac: Check for ftw.h. + * gcov-tool.c: Check for ftw.h before using nftw. + 2015-01-25 Allan Sandfeld Jensen Uros Bizjak diff --git a/gcc/config.in b/gcc/config.in index f34adb5..7bde5b1 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1098,6 +1098,12 @@ #endif +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#undef HAVE_FTW_H +#endif + + /* Define to 1 if you have the `fwrite_unlocked' function. */ #ifndef USED_FOR_TARGET #undef HAVE_FWRITE_UNLOCKED diff --git a/gcc/configure b/gcc/configure index 1bf4358..1a35d5a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8448,7 +8448,7 @@ $as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h fi for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ - fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ + fcntl.h ftw.h unistd.h sys/file.h sys/time.h sys/mman.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \ direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h do : diff --git a/gcc/configure.ac b/gcc/configure.ac index 102dab9..a553a65 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1028,7 +1028,7 @@ ACX_HEADER_STRING AC_HEADER_SYS_WAIT AC_HEADER_TIOCGWINSZ AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ - fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ + fcntl.h ftw.h unistd.h sys/file.h sys/time.h sys/mman.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \ direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h) diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c index 7de175f..36234d8 100644 --- a/gcc/gcov-tool.c +++ b/gcc/gcov-tool.c @@ -35,7 +35,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #include #include +#if HAVE_FTW_H #include +#endif #include extern int gcov_profile_merge (struct gcov_info*, struct gcov_info*, int, int); @@ -49,6 +51,8 @@ extern void gcov_set_verbose (void); /* Set to verbose output mode. */ static bool verbose; +#if HAVE_FTW_H + /* Remove file NAME if it has a gcda suffix. */ static int @@ -69,13 +73,18 @@ unlink_gcda_file (const char *name, return ret; } +#endif /* Remove the gcda files in PATH recursively. */ static int -unlink_profile_dir (const char *path) +unlink_profile_dir (const char *path ATTRIBUTE_UNUSED) { +#if HAVE_FTW_H return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS); +#else + return -1; +#endif } /* Output GCOV_INFO lists PROFILE to directory OUT. Note that