Guest User

Patch to solve issue with compiling GCC4.4.7 with GCC5

a guest
Mar 2nd, 2016
296
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From b08c89d503fe6fc5c3faf5cb896a4e6bcd837a4f Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
  3. Date: Tue, 15 Sep 2015 10:57:48 +0200
  4. Subject: [PATCH] Avoid floor_log2() redefinition with C99
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8.  
  9. GCC 5.1 defaults to gnu11 which forbirs redefinitions. This patch
  10. comes from <https://gcc.gnu.org/ml/gcc-patches/2009-06/msg01249.html>.
  11.  
  12. <https://github.com/gccxml/gccxml/issues/11>
  13.  
  14. Signed-off-by: Petr Písař <ppisar@redhat.com>
  15. ---
  16. GCC/gcc/toplev.c | 4 ++--
  17.  GCC/gcc/toplev.h | 7 ++++---
  18.  2 files changed, 6 insertions(+), 5 deletions(-)
  19.  
  20. diff --git a/GCC/gcc/toplev.c b/GCC/gcc/toplev.c
  21. index 3526010..419dc00 100644
  22. --- a/GCC/gcc/toplev.c
  23. +++ b/GCC/gcc/toplev.c
  24. @@ -537,7 +537,7 @@ read_integral_parameter (const char *p, const char *pname, const int  defval)
  25.     for floor_log2 and exact_log2; see toplev.h.  That construct, however,
  26.     conflicts with the ISO C++ One Definition Rule.   */
  27.  
  28. -#if GCC_VERSION < 3004 || !defined (__cplusplus)
  29. +#if GCC_VERSION < 3004
  30.  
  31.  /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
  32.     If X is 0, return -1.  */
  33. @@ -589,7 +589,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
  34.  #endif
  35.  }
  36.  
  37. -#endif /*  GCC_VERSION < 3004 || !defined (__cplusplus)  */
  38. +#endif /*  GCC_VERSION < 3004 */
  39.  
  40.  /* Handler for fatal signals, such as SIGSEGV.  These are transformed
  41.     into ICE messages, which is much more user friendly.  In case the
  42. diff --git a/GCC/gcc/toplev.h b/GCC/gcc/toplev.h
  43. index c935f7e..1edd5e5 100644
  44. --- a/GCC/gcc/toplev.h
  45. +++ b/GCC/gcc/toplev.h
  46. @@ -151,6 +151,7 @@ extern void decode_d_option     (const char *);
  47.  /* Return true iff flags are set as if -ffast-math.  */
  48.  extern bool fast_math_flags_set_p  (void);
  49.  
  50. +#if GCC_VERSION < 3004
  51.  /* Return log2, or -1 if not exact.  */
  52.  extern int exact_log2                  (unsigned HOST_WIDE_INT);
  53.  
  54. @@ -158,7 +159,7 @@ extern int exact_log2                  (unsigned HOST_WIDE_INT);
  55.  extern int floor_log2                  (unsigned HOST_WIDE_INT);
  56.  
  57.  /* Inline versions of the above for speed.  */
  58. -#if GCC_VERSION >= 3004
  59. +#else /* GCC_VERSION >= 3004 */
  60.  # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
  61.  #  define CLZ_HWI __builtin_clzl
  62.  #  define CTZ_HWI __builtin_ctzl
  63. @@ -170,13 +171,13 @@ extern int floor_log2                  (unsigned HOST_WIDE_INT);
  64.  #  define CTZ_HWI __builtin_ctz
  65.  # endif
  66.  
  67. -extern inline int
  68. +static inline int
  69.  floor_log2 (unsigned HOST_WIDE_INT x)
  70.  {
  71.    return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
  72.  }
  73.  
  74. -extern inline int
  75. +static inline int
  76.  exact_log2 (unsigned HOST_WIDE_INT x)
  77.  {
  78.    return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
  79. --
  80. 2.4.3
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×