summaryrefslogtreecommitdiff
path: root/toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-10-15 09:17:09 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-10-17 20:11:42 +0200
commit3914d47810551fac123083f1f442055644b3e497 (patch)
tree5728b04ab0f19ea3bb6ef694ece9831972460fe2 /toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch
parent7028dfc12513746bd81e90bc03e5093f917f90fe (diff)
glibc: add buildroot patches
Diffstat (limited to 'toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch')
-rw-r--r--toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch b/toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch
new file mode 100644
index 000000000..7321eebd6
--- /dev/null
+++ b/toolchain/glibc/patches/2.26/0002-Do-not-use-generic-selection-in-C-mode.patch
@@ -0,0 +1,56 @@
+From bb21afc362a3ecba07ab386a0bc4385e75fbd4b5 Mon Sep 17 00:00:00 2001
+From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
+Date: Mon, 14 Aug 2017 17:51:51 -0300
+Subject: [PATCH] Do not use generic selection in C++ mode
+
+The logic to protect the use of generic selection (_Generic) does not
+check for C or C++ mode, however, generic selection is a C-only
+feature.
+
+Tested for powerpc64le.
+
+ * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
+ in C++ mode.
+
+(cherry picked from commit 6913ad65e00bb32417ad39c41d292b976171e27e)
+[Romain rebase on glibc 2.26]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ misc/sys/cdefs.h | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
+index 06523bf..0c80821 100644
+--- a/misc/sys/cdefs.h
++++ b/misc/sys/cdefs.h
+@@ -464,17 +464,18 @@
+ # define __glibc_macro_warning(msg)
+ #endif
+
+-/* Support for generic selection (ISO C11) is available in GCC since
+- version 4.9. Previous versions do not provide generic selection,
+- even though they might set __STDC_VERSION__ to 201112L, when in
+- -std=c11 mode. Thus, we must check for !defined __GNUC__ when
+- testing __STDC_VERSION__ for generic selection support.
++/* Generic selection (ISO C11) is a C-only feature, available in GCC
++ since version 4.9. Previous versions do not provide generic
++ selection, even though they might set __STDC_VERSION__ to 201112L,
++ when in -std=c11 mode. Thus, we must check for !defined __GNUC__
++ when testing __STDC_VERSION__ for generic selection support.
+ On the other hand, Clang also defines __GNUC__, so a clang-specific
+ check is required to enable the use of generic selection. */
+-#if __GNUC_PREREQ (4, 9) \
+- || __glibc_clang_has_extension (c_generic_selections) \
+- || (!defined __GNUC__ && defined __STDC_VERSION__ \
+- && __STDC_VERSION__ >= 201112L)
++#if !defined __cplusplus \
++ && (__GNUC_PREREQ (4, 9) \
++ || __glibc_clang_has_extension (c_generic_selections) \
++ || (!defined __GNUC__ && defined __STDC_VERSION__ \
++ && __STDC_VERSION__ >= 201112L))
+ # define __HAVE_GENERIC_SELECTION 1
+ #else
+ # define __HAVE_GENERIC_SELECTION 0
+--
+2.9.5
+