summarylogtreecommitdiffstats
path: root/gcc-fix_toplevel_inlines.patch
diff options
context:
space:
mode:
authorGiovanni Santini2015-06-23 12:15:41 +0200
committerGiovanni Santini2015-06-23 12:15:41 +0200
commit63d8efe474fd2b0495a4e6c85067918c65703c7d (patch)
tree359bdd57af7c984a3be5b35ec6f91ec0355128c7 /gcc-fix_toplevel_inlines.patch
parent691975370f7baa2ce60675f40642a3851e34ff9c (diff)
downloadaur-63d8efe474fd2b0495a4e6c85067918c65703c7d.tar.gz
Fixing package stuff (version: 4.4.7-4)
* Added a patch for fixing toplevel.{c,h} compilation, thanks to carstene1ns that reviewed my patch * Using sha256 for checksums instead of md5 * Replaced spaced with tabs
Diffstat (limited to 'gcc-fix_toplevel_inlines.patch')
-rw-r--r--gcc-fix_toplevel_inlines.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/gcc-fix_toplevel_inlines.patch b/gcc-fix_toplevel_inlines.patch
new file mode 100644
index 000000000000..69e4a72ec0bf
--- /dev/null
+++ b/gcc-fix_toplevel_inlines.patch
@@ -0,0 +1,104 @@
+Patch that fixes toplevel.{c,h} defines of {floor,exact}_log2
+aur-general discussion: https://lists.archlinux.org/pipermail/aur-general/2015-June/031034.html
+Made by 'carstene1ns'
+References, taken from above mail:
+[1]: https://paste.xinu.at/f32k/ # This patch
+[2]: https://gcc.gnu.org/gcc-5/porting_to.html ("Different semantics for
+inline functions")
+[3]: https://github.com/gcc-mirror/gcc/commit/4345dfaa7260253cb0d3b10b4b466f586e9d28dc
+diff -Npur a/gcc/toplev.c b/gcc/toplev.c
+--- a/gcc/toplev.c 2010-03-31 04:51:31.000000000 +0200
++++ b/gcc/toplev.c 2015-06-21 20:23:54.025339943 +0200
+@@ -523,11 +523,11 @@ read_integral_parameter (const char *p,
+ return atoi (p);
+ }
+
+-/* When compiling with a recent enough GCC, we use the GNU C "extern inline"
+- for floor_log2 and exact_log2; see toplev.h. That construct, however,
+- conflicts with the ISO C++ One Definition Rule. */
++/* The functions floor_log2 and exact_log2 are defined as inline
++ functions in toplev.h if GCC_VERSION >= 3004. The definitions here
++ are used for older versions of gcc. */
+
+-#if GCC_VERSION < 3004 || !defined (__cplusplus)
++#if GCC_VERSION < 3004
+
+ /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
+ If X is 0, return -1. */
+@@ -540,9 +540,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
+ if (x == 0)
+ return -1;
+
+-#ifdef CLZ_HWI
+- t = HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x);
+-#else
+ if (HOST_BITS_PER_WIDE_INT > 64)
+ if (x >= (unsigned HOST_WIDE_INT) 1 << (t + 64))
+ t += 64;
+@@ -559,7 +556,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
+ t += 2;
+ if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 1))
+ t += 1;
+-#endif
+
+ return t;
+ }
+@@ -572,14 +568,10 @@ exact_log2 (unsigned HOST_WIDE_INT x)
+ {
+ if (x != (x & -x))
+ return -1;
+-#ifdef CTZ_HWI
+- return x ? CTZ_HWI (x) : -1;
+-#else
+ return floor_log2 (x);
+-#endif
+ }
+
+-#endif /* GCC_VERSION < 3004 || !defined (__cplusplus) */
++#endif /* GCC_VERSION < 3004 */
+
+ /* Handler for fatal signals, such as SIGSEGV. These are transformed
+ into ICE messages, which is much more user friendly. In case the
+diff -Npur a/gcc/toplev.h b/gcc/toplev.h
+--- a/gcc/toplev.h 2009-02-20 16:20:38.000000000 +0100
++++ b/gcc/toplev.h 2015-06-21 20:24:35.142568303 +0200
+@@ -167,14 +167,17 @@ extern void decode_d_option (const char
+ extern bool fast_math_flags_set_p (void);
+ extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
+
++#if GCC_VERSION < 3004
++
+ /* Return log2, or -1 if not exact. */
+ extern int exact_log2 (unsigned HOST_WIDE_INT);
+
+ /* Return floor of log2, with -1 for zero. */
+ extern int floor_log2 (unsigned HOST_WIDE_INT);
+
++#else /* GCC_VERSION >= 3004 */
++
+ /* Inline versions of the above for speed. */
+-#if GCC_VERSION >= 3004
+ # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+ # define CLZ_HWI __builtin_clzl
+ # define CTZ_HWI __builtin_ctzl
+@@ -186,17 +189,18 @@ extern int floor_log2 (
+ # define CTZ_HWI __builtin_ctz
+ # endif
+
+-extern inline int
++static inline int
+ floor_log2 (unsigned HOST_WIDE_INT x)
+ {
+ return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
+ }
+
+-extern inline int
++static inline int
+ exact_log2 (unsigned HOST_WIDE_INT x)
+ {
+ return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
+ }
++
+ #endif /* GCC_VERSION >= 3004 */
+
+ /* Functions used to get and set GCC's notion of in what directory