From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31876 invoked by alias); 25 Nov 2014 00:39:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 31864 invoked by uid 89); 25 Nov 2014 00:39:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-HELO: BLU004-OMC3S31.hotmail.com Received: from blu004-omc3s31.hotmail.com (HELO BLU004-OMC3S31.hotmail.com) (65.55.116.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Tue, 25 Nov 2014 00:39:18 +0000 Received: from BLU437-SMTP2 ([65.55.116.74]) by BLU004-OMC3S31.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Mon, 24 Nov 2014 16:39:16 -0800 X-TMN: [zWarz1JXMD9IUZ+EODNOjuOorkl9ah6U] Message-ID: CC: GCC Patches From: John David Anglin To: Richard Biener In-Reply-To: Content-Type: multipart/mixed; boundary="Apple-Mail-18-482074623" Subject: Re: [PATCH v3] Use strtoll instead of atoll in gcov-tool.c MIME-Version: 1.0 (Apple Message framework v936) Date: Tue, 25 Nov 2014 01:36:00 -0000 References: X-SW-Source: 2014-11/txt/msg03076.txt.bz2 --Apple-Mail-18-482074623 Content-Type: text/plain; charset="US-ASCII"; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-length: 411 On 15-Sep-14, at 5:40 AM, Richard Biener wrote: > Let's wait for other opinions. We now have implementations of strtol and strtoll in libiberty. So, it's better to use these than atoll. As suggested by Jakub, the patch now falls back to int64_t if the host doesn't have long long. Tested on hppa2.0w-hpux11.11 and hppa64-hp-hpux11.11. Okay for trunk? Dave -- John David Anglin dave.anglin@bell.net --Apple-Mail-18-482074623 Content-Disposition: attachment; filename="gcov-tool.c.d.3" Content-Type: application/octet-stream; x-unix-mode=0644; name="gcov-tool.c.d.3" Content-Transfer-Encoding: 7bit Content-length: 1183 2014-11-24 John David Anglin PR gcov-profile/61790 * gcov-tool.c (do_rewrite): Use strtoll instead of atoll if host has long long. Fallback to int64_t if host doesn't have long long and use strtol if int64_t is long. Otherwise, use sscanf for conversion. Index: gcov-tool.c =================================================================== --- gcov-tool.c (revision 217745) +++ gcov-tool.c (working copy) @@ -289,7 +289,11 @@ int opt; int ret; const char *output_dir = 0; +#ifdef HAVE_LONG_LONG long long normalize_val = 0; +#else + int64_t normalize_val = 0; +#endif float scale = 0.0; int numerator = 1; int denominator = 1; @@ -309,7 +313,13 @@ break; case 'n': if (!do_scaling) - normalize_val = atoll (optarg); +#if defined(HAVE_LONG_LONG) + normalize_val = strtoll (optarg, (char **)NULL, 10); +#elif defined(INT64_T_IS_LONG) + normalize_val = strtol (optarg, (char **)NULL, 10); +#else + sscanf (optarg, "%" SCNd64, &normalize_val); +#endif else fnotice (stderr, "scaling cannot co-exist with normalization," " skipping\n"); --Apple-Mail-18-482074623--