public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix bootstrap on hppa*-*-hpux*
@ 2016-05-18  0:31 John David Anglin
  2016-05-18  6:21 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2016-05-18  0:31 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

r235550 introduced the use of long long, and the macros LLONG_MIN and LLONG_MAX.  These macros
are not defined by default and we need to include <climits> when compiling with c++ to define them.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.  Okay for trunk?

Dave
--
John David Anglin	dave.anglin@bell.net



[-- Attachment #2: system.h.d.txt --]
[-- Type: text/plain, Size: 557 bytes --]

2016-05-17  John David Anglin  <danglin@gcc.gnu.org>

	PR bootstrap/71014
	* system.h: Include climits instead of limits.h when compiling with c++.

Index: system.h
===================================================================
--- system.h	(revision 236287)
+++ system.h	(working copy)
@@ -301,8 +301,12 @@
 # undef m_slot
 #endif
 
-#if HAVE_LIMITS_H
-# include <limits.h>
+#ifdef __cplusplus
+# include <climits>
+#else
+# if HAVE_LIMITS_H
+#  include <limits.h>
+# endif
 #endif
 
 /* A macro to determine whether a VALUE lies inclusively within a

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix bootstrap on hppa*-*-hpux*
  2016-05-18  0:31 [PATCH] Fix bootstrap on hppa*-*-hpux* John David Anglin
@ 2016-05-18  6:21 ` Jakub Jelinek
  2016-05-20 18:09   ` John David Anglin
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2016-05-18  6:21 UTC (permalink / raw)
  To: John David Anglin; +Cc: GCC Patches

On Tue, May 17, 2016 at 08:31:00PM -0400, John David Anglin wrote:
> r235550 introduced the use of long long, and the macros LLONG_MIN and LLONG_MAX.  These macros
> are not defined by default and we need to include <climits> when compiling with c++ to define them.

IMNSHO we should get rid of those long long uses instead and just use
int64_t and INTTYPE_MINIMUM (int64_t) and INTTYPE_MAXIMUM (int64_t).

There is also another use of long long in libcpp, we should also replace
that.

> 2016-05-17  John David Anglin  <danglin@gcc.gnu.org>
> 
> 	PR bootstrap/71014
> 	* system.h: Include climits instead of limits.h when compiling with c++.
> 
> Index: system.h
> ===================================================================
> --- system.h	(revision 236287)
> +++ system.h	(working copy)
> @@ -301,8 +301,12 @@
>  # undef m_slot
>  #endif
>  
> -#if HAVE_LIMITS_H
> -# include <limits.h>
> +#ifdef __cplusplus
> +# include <climits>
> +#else
> +# if HAVE_LIMITS_H
> +#  include <limits.h>
> +# endif
>  #endif
>  
>  /* A macro to determine whether a VALUE lies inclusively within a


	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix bootstrap on hppa*-*-hpux*
  2016-05-18  6:21 ` Jakub Jelinek
@ 2016-05-20 18:09   ` John David Anglin
  2016-06-21 22:20     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2016-05-20 18:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]

On 2016-05-18 2:20 AM, Jakub Jelinek wrote:
> On Tue, May 17, 2016 at 08:31:00PM -0400, John David Anglin wrote:
>> >r235550 introduced the use of long long, and the macros LLONG_MIN and LLONG_MAX.  These macros
>> >are not defined by default and we need to include <climits> when compiling with c++ to define them.
> IMNSHO we should get rid of those long long uses instead and just use
> int64_t and INTTYPE_MINIMUM (int64_t) and INTTYPE_MAXIMUM (int64_t).
>
> There is also another use of long long in libcpp, we should also replace
> that.
>
The attached change implements the above.  There is an implicit 
assumption that int64_t
is long long if it is not long.

The patch also changes gcov-tool.c.  This affects the interface somewhat but
I think consistently using int64_t better.

Tested on hppa2.0w-hp-hpux11.11.  Okay for trunk?

Dave

-- 
John David Anglin  dave.anglin@bell.net


[-- Attachment #2: longlong.d.txt --]
[-- Type: text/plain, Size: 3994 bytes --]

2016-05-20  John David Anglin  <danglin@gcc.gnu.org>

	PR bootstrap/71014
	* c-common.c (get_source_date_epoch): Use int64_t instead of long long.

	* gcov-tool.c (profile_rewrite): Use int64_t instead of long long.
	(do_rewrite): likewise.

	* line-map.c (location_adhoc_data_update): Use int64_t instead of
	long long.
	(get_combined_adhoc_loc): Likewise.

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 236418)
+++ gcc/c-family/c-common.c	(working copy)
@@ -12798,7 +12798,7 @@
 get_source_date_epoch ()
 {
   char *source_date_epoch;
-  long long epoch;
+  int64_t epoch;
   char *endptr;
 
   source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
@@ -12806,8 +12806,13 @@
     return (time_t) -1;
 
   errno = 0;
+#if defined(INT64_T_IS_LONG)
+  epoch = strtol (source_date_epoch, &endptr, 10);
+#else
   epoch = strtoll (source_date_epoch, &endptr, 10);
-  if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN))
+#endif
+  if ((errno == ERANGE && (epoch == INTTYPE_MAXIMUM (int64_t)
+			   || epoch == INTTYPE_MINIMUM (int64_t)))
       || (errno != 0 && epoch == 0))
     fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: "
 		 "strtoll: %s\n", xstrerror(errno));
@@ -12819,7 +12824,7 @@
 		 "trailing garbage: %s\n", endptr);
   if (epoch < 0)
     fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: "
-		 "value must be nonnegative: %lld \n", epoch);
+		 "value must be nonnegative: %" SCNd64 "\n", epoch);
 
   return (time_t) epoch;
 }
Index: gcc/gcov-tool.c
===================================================================
--- gcc/gcov-tool.c	(revision 236418)
+++ gcc/gcov-tool.c	(working copy)
@@ -232,7 +232,7 @@
    Otherwise, multiply the all counters by SCALE.  */
 
 static int
-profile_rewrite (const char *d1, const char *out, long long n_val,
+profile_rewrite (const char *d1, const char *out, int64_t n_val,
                  float scale, int n, int d)
 {
   struct gcov_info * d1_profile;
@@ -261,7 +261,7 @@
   fnotice (file, "    -v, --verbose                       Verbose mode\n");
   fnotice (file, "    -o, --output <dir>                  Output directory\n");
   fnotice (file, "    -s, --scale <float or simple-frac>  Scale the profile counters\n");
-  fnotice (file, "    -n, --normalize <long long>         Normalize the profile\n");
+  fnotice (file, "    -n, --normalize <int64_t>           Normalize the profile\n");
 }
 
 static const struct option rewrite_options[] =
@@ -291,11 +291,7 @@
   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;
@@ -315,12 +311,10 @@
           break;
         case 'n':
           if (!do_scaling)
-#if defined(HAVE_LONG_LONG)
-	    normalize_val = strtoll (optarg, (char **)NULL, 10);
-#elif defined(INT64_T_IS_LONG)
+#if defined(INT64_T_IS_LONG)
 	    normalize_val = strtol (optarg, (char **)NULL, 10);
 #else
-	    sscanf (optarg, "%" SCNd64, &normalize_val);
+	    normalize_val = strtoll (optarg, (char **)NULL, 10);
 #endif
           else
             fnotice (stderr, "scaling cannot co-exist with normalization,"
Index: libcpp/line-map.c
===================================================================
--- libcpp/line-map.c	(revision 236418)
+++ libcpp/line-map.c	(working copy)
@@ -102,7 +102,7 @@
 static int
 location_adhoc_data_update (void **slot, void *data)
 {
-  *((char **) slot) += *((long long *) data);
+  *((char **) slot) += *((int64_t *) data);
   return 1;
 }
 
@@ -224,7 +224,7 @@
 	  set->location_adhoc_data_map.allocated)
 	{
 	  char *orig_data = (char *) set->location_adhoc_data_map.data;
-	  long long offset;
+	  int64_t offset;
 	  /* Cast away extern "C" from the type of xrealloc.  */
 	  line_map_realloc reallocator = (set->reallocator
 					  ? set->reallocator

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix bootstrap on hppa*-*-hpux*
  2016-05-20 18:09   ` John David Anglin
@ 2016-06-21 22:20     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2016-06-21 22:20 UTC (permalink / raw)
  To: John David Anglin, Jakub Jelinek; +Cc: GCC Patches

On 05/20/2016 12:09 PM, John David Anglin wrote:
> On 2016-05-18 2:20 AM, Jakub Jelinek wrote:
>> On Tue, May 17, 2016 at 08:31:00PM -0400, John David Anglin wrote:
>>> >r235550 introduced the use of long long, and the macros LLONG_MIN
>>> and LLONG_MAX.  These macros
>>> >are not defined by default and we need to include <climits> when
>>> compiling with c++ to define them.
>> IMNSHO we should get rid of those long long uses instead and just use
>> int64_t and INTTYPE_MINIMUM (int64_t) and INTTYPE_MAXIMUM (int64_t).
>>
>> There is also another use of long long in libcpp, we should also replace
>> that.
>>
> The attached change implements the above.  There is an implicit
> assumption that int64_t
> is long long if it is not long.
>
> The patch also changes gcov-tool.c.  This affects the interface somewhat
> but
> I think consistently using int64_t better.
>
> Tested on hppa2.0w-hp-hpux11.11.  Okay for trunk?
>
> Dave
>
> --
> John David Anglin  dave.anglin@bell.net
>
>
> longlong.d.txt
>
>
> 2016-05-20  John David Anglin  <danglin@gcc.gnu.org>
>
> 	PR bootstrap/71014
> 	* c-common.c (get_source_date_epoch): Use int64_t instead of long long.
>
> 	* gcov-tool.c (profile_rewrite): Use int64_t instead of long long.
> 	(do_rewrite): likewise.
>
> 	* line-map.c (location_adhoc_data_update): Use int64_t instead of
> 	long long.
> 	(get_combined_adhoc_loc): Likewise.
OK.  Please install if you haven't already.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-21 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  0:31 [PATCH] Fix bootstrap on hppa*-*-hpux* John David Anglin
2016-05-18  6:21 ` Jakub Jelinek
2016-05-20 18:09   ` John David Anglin
2016-06-21 22:20     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).