diff mbox

Use sscanf instead of atoll in gcov-tool.c

Message ID BLU437-SMTP106633E3F0A4D95093D51B697C00@phx.gbl
State New
Headers show

Commit Message

John David Anglin Sept. 7, 2014, 5:36 p.m. UTC
The attached patch fixes bootstrap on hpux which doesn't have the  
atoll function.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

OK for trunk?

Dave
--
John David Anglin	dave.anglin@bell.net
2014-09-07  John David Anglin  <danglin@gcc.gnu.org>

	PR gcpv-profile/61790
	* gcov-tool.c (do_rewrite): Use sscanf instead of atoll.

Comments

Richard Biener Sept. 8, 2014, 9:21 a.m. UTC | #1
On Sun, Sep 7, 2014 at 7:36 PM, John David Anglin <dave.anglin@bell.net> wrote:
> The attached patch fixes bootstrap on hpux which doesn't have the atoll
> function.
>
> Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.
>
> OK for trunk?

"ll" is not portable (it's GNU), I think BSD uses "q" and windows may
use sth else.  I think the code shouldn't use 'long long' but int64_t
and the appropriate SCNd64 macros for the sscanf format specifier.

Note that C99 has atoll and only C99 has the SCNd64 stuff
(inttypes.h).   I wonder if hpux11 has a C99 conforming inttypes.h?

Thanks,
Richard.

> Dave
> --
> John David Anglin       dave.anglin@bell.net
>
>
diff mbox

Patch

Index: gcov-tool.c
===================================================================
--- gcov-tool.c	(revision 214998)
+++ gcov-tool.c	(working copy)
@@ -308,7 +308,7 @@ 
           break;
         case 'n':
           if (!do_scaling)
-            normalize_val = atoll (optarg);
+            sscanf (optarg, "%lld", &normalize_val);
           else
             fnotice (stderr, "scaling cannot co-exist with normalization,"
                 " skipping\n");