summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/glibc/glibc/0026-assert-Suppress-pedantic-warning-caused-by-statement.patch90
-rw-r--r--meta/recipes-core/glibc/glibc/0029-assert-Support-types-without-operator-int-BZ-21972.patch194
-rw-r--r--meta/recipes-core/glibc/glibc_2.26.bb4
3 files changed, 1 insertions, 287 deletions
diff --git a/meta/recipes-core/glibc/glibc/0026-assert-Suppress-pedantic-warning-caused-by-statement.patch b/meta/recipes-core/glibc/glibc/0026-assert-Suppress-pedantic-warning-caused-by-statement.patch
deleted file mode 100644
index b2bb96b818..0000000000
--- a/meta/recipes-core/glibc/glibc/0026-assert-Suppress-pedantic-warning-caused-by-statement.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1From 037283cbc74739b72f36dfec827d120faa243406 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer at redhat dot com>
3Date: Thu, 6 Jul 2017 11:50:55 +0200
4Subject: [PATCH 26/26] assert: Suppress pedantic warning caused by statement
5 expression [BZ# 21242]
6
7On 07/05/2017 10:15 PM, Zack Weinberg wrote:
8> On Wed, Jul 5, 2017 at 11:51 AM, Florian Weimer <fweimer@redhat.com> wrote:
9>> On 07/05/2017 05:46 PM, Zack Weinberg wrote:
10>>> A problem occurs to me: expressions involving VLAs _are_ evaluated
11>>> inside sizeof.
12>>
13>> The type of the sizeof argument would still be int (due to the
14>> comparison against 0), so this doesn't actually occur.
15>
16> I rechecked what C99 says about sizeof and VLAs, and you're right -
17> the operand of sizeof is only evaluated when sizeof is _directly_
18> applied to a VLA. So this is indeed safe, but I think this wrinkle
19> should be mentioned in the comment. Perhaps
20>
21> /* The first occurrence of EXPR is not evaluated due to the sizeof,
22> but will trigger any pedantic warnings masked by the __extension__
23> for the second occurrence. The explicit comparison against zero
24> ensures that sizeof is not directly applied to a function pointer or
25> bit-field (which would be ill-formed) or VLA (which would be evaluated). */
26>
27> zw
28
29What about the attached patch?
30
31Siddhesh, is this okay during the freeze? I'd like to backport it to
322.25 as well.
33
34Thanks,
35Florian
36
37assert: Suppress pedantic warning caused by statement expression
38
392017-07-06 Florian Weimer <fweimer@redhat.com>
40
41 [BZ #21242]
42 * assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert):
43 Suppress pedantic warning resulting from statement expression.
44 (__ASSERT_FUNCTION): Add missing __extendsion__.
45---
46
47Upstream-Status: Submitted
48Signed-off-by: Khem Raj <raj.khem@gmail.com>
49
50 assert/assert.h | 12 +++++++++---
51 1 file changed, 9 insertions(+), 3 deletions(-)
52
53diff --git a/assert/assert.h b/assert/assert.h
54index 22f019537c..6801cfeb10 100644
55--- a/assert/assert.h
56+++ b/assert/assert.h
57@@ -91,13 +91,19 @@ __END_DECLS
58 ? __ASSERT_VOID_CAST (0) \
59 : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
60 # else
61+/* The first occurrence of EXPR is not evaluated due to the sizeof,
62+ but will trigger any pedantic warnings masked by the __extension__
63+ for the second occurrence. The explicit comparison against zero is
64+ required to support function pointers and bit fields in this
65+ context, and to suppress the evaluation of variable length
66+ arrays. */
67 # define assert(expr) \
68- ({ \
69+ ((void) sizeof ((expr) == 0), __extension__ ({ \
70 if (expr) \
71 ; /* empty */ \
72 else \
73 __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
74- })
75+ }))
76 # endif
77
78 # ifdef __USE_GNU
79@@ -113,7 +119,7 @@ __END_DECLS
80 C9x has a similar variable called __func__, but prefer the GCC one since
81 it demangles C++ function names. */
82 # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
83-# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
84+# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__
85 # else
86 # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
87 # define __ASSERT_FUNCTION __func__
88--
892.13.3
90
diff --git a/meta/recipes-core/glibc/glibc/0029-assert-Support-types-without-operator-int-BZ-21972.patch b/meta/recipes-core/glibc/glibc/0029-assert-Support-types-without-operator-int-BZ-21972.patch
deleted file mode 100644
index 3c7050f078..0000000000
--- a/meta/recipes-core/glibc/glibc/0029-assert-Support-types-without-operator-int-BZ-21972.patch
+++ /dev/null
@@ -1,194 +0,0 @@
1Upstream-Status: Backport
2
3* fixes "lambda-expression in unevaluated context" compile failures such as
4 https://github.com/nlohmann/json/issues/705
5
6* fixes "no match for 'operator==" compile failures such as
7 https://bugzilla.redhat.com/show_bug.cgi?id=1482990
8
9* Changelog edit was removed from upstream commit because it caused conflict
10
11Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
12
13From b5889d25e9bf944a89fdd7bcabf3b6c6f6bb6f7c Mon Sep 17 00:00:00 2001
14From: Florian Weimer <fweimer@redhat.com>
15Date: Mon, 21 Aug 2017 13:03:29 +0200
16Subject: [PATCH] assert: Support types without operator== (int) [BZ #21972]
17
18---
19 assert/Makefile | 11 ++++++-
20 assert/assert.h | 16 ++++++----
21 assert/tst-assert-c++.cc | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
22 assert/tst-assert-g++.cc | 19 ++++++++++++
23 4 files changed, 128 insertions(+), 7 deletions(-)
24 create mode 100644 assert/tst-assert-c++.cc
25 create mode 100644 assert/tst-assert-g++.cc
26
27diff --git a/assert/Makefile b/assert/Makefile
28index 1c3be9b..9ec1be8 100644
29--- a/assert/Makefile
30+++ b/assert/Makefile
31@@ -25,6 +25,15 @@ include ../Makeconfig
32 headers := assert.h
33
34 routines := assert assert-perr __assert
35-tests := test-assert test-assert-perr
36+tests := test-assert test-assert-perr tst-assert-c++ tst-assert-g++
37
38 include ../Rules
39+
40+ifeq ($(have-cxx-thread_local),yes)
41+CFLAGS-tst-assert-c++.o = -std=c++11
42+LDLIBS-tst-assert-c++ = -lstdc++
43+CFLAGS-tst-assert-g++.o = -std=gnu++11
44+LDLIBS-tst-assert-g++ = -lstdc++
45+else
46+tests-unsupported += tst-assert-c++ tst-assert-g++
47+endif
48diff --git a/assert/assert.h b/assert/assert.h
49index 6801cfe..640c95c 100644
50--- a/assert/assert.h
51+++ b/assert/assert.h
52@@ -85,7 +85,12 @@ __END_DECLS
53 /* When possible, define assert so that it does not add extra
54 parentheses around EXPR. Otherwise, those added parentheses would
55 suppress warnings we'd expect to be detected by gcc's -Wparentheses. */
56-# if !defined __GNUC__ || defined __STRICT_ANSI__
57+# if defined __cplusplus
58+# define assert(expr) \
59+ (static_cast <bool> (expr) \
60+ ? void (0) \
61+ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
62+# elif !defined __GNUC__ || defined __STRICT_ANSI__
63 # define assert(expr) \
64 ((expr) \
65 ? __ASSERT_VOID_CAST (0) \
66@@ -93,12 +98,11 @@ __END_DECLS
67 # else
68 /* The first occurrence of EXPR is not evaluated due to the sizeof,
69 but will trigger any pedantic warnings masked by the __extension__
70- for the second occurrence. The explicit comparison against zero is
71- required to support function pointers and bit fields in this
72- context, and to suppress the evaluation of variable length
73- arrays. */
74+ for the second occurrence. The ternary operator is required to
75+ support function pointers and bit fields in this context, and to
76+ suppress the evaluation of variable length arrays. */
77 # define assert(expr) \
78- ((void) sizeof ((expr) == 0), __extension__ ({ \
79+ ((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
80 if (expr) \
81 ; /* empty */ \
82 else \
83diff --git a/assert/tst-assert-c++.cc b/assert/tst-assert-c++.cc
84new file mode 100644
85index 0000000..12a5e69
86--- /dev/null
87+++ b/assert/tst-assert-c++.cc
88@@ -0,0 +1,78 @@
89+/* Tests for interactions between C++ and assert.
90+ Copyright (C) 2017 Free Software Foundation, Inc.
91+ This file is part of the GNU C Library.
92+
93+ The GNU C Library is free software; you can redistribute it and/or
94+ modify it under the terms of the GNU Lesser General Public
95+ License as published by the Free Software Foundation; either
96+ version 2.1 of the License, or (at your option) any later version.
97+
98+ The GNU C Library is distributed in the hope that it will be useful,
99+ but WITHOUT ANY WARRANTY; without even the implied warranty of
100+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
101+ Lesser General Public License for more details.
102+
103+ You should have received a copy of the GNU Lesser General Public
104+ License along with the GNU C Library; if not, see
105+ <http://www.gnu.org/licenses/>. */
106+
107+#include <assert.h>
108+
109+/* The C++ standard requires that if the assert argument is a constant
110+ subexpression, then the assert itself is one, too. */
111+constexpr int
112+check_constexpr ()
113+{
114+ return (assert (true), 1);
115+}
116+
117+/* Objects of this class can be contextually converted to bool, but
118+ cannot be compared to int. */
119+struct no_int
120+{
121+ no_int () = default;
122+ no_int (const no_int &) = delete;
123+
124+ explicit operator bool () const
125+ {
126+ return true;
127+ }
128+
129+ bool operator! () const; /* No definition. */
130+ template <class T> bool operator== (T) const; /* No definition. */
131+ template <class T> bool operator!= (T) const; /* No definition. */
132+};
133+
134+/* This class tests that operator== is not used by assert. */
135+struct bool_and_int
136+{
137+ bool_and_int () = default;
138+ bool_and_int (const no_int &) = delete;
139+
140+ explicit operator bool () const
141+ {
142+ return true;
143+ }
144+
145+ bool operator! () const; /* No definition. */
146+ template <class T> bool operator== (T) const; /* No definition. */
147+ template <class T> bool operator!= (T) const; /* No definition. */
148+};
149+
150+static int
151+do_test ()
152+{
153+ {
154+ no_int value;
155+ assert (value);
156+ }
157+
158+ {
159+ bool_and_int value;
160+ assert (value);
161+ }
162+
163+ return 0;
164+}
165+
166+#include <support/test-driver.c>
167diff --git a/assert/tst-assert-g++.cc b/assert/tst-assert-g++.cc
168new file mode 100644
169index 0000000..8c06402
170--- /dev/null
171+++ b/assert/tst-assert-g++.cc
172@@ -0,0 +1,19 @@
173+/* Tests for interactions between C++ and assert. GNU C++11 version.
174+ Copyright (C) 2017 Free Software Foundation, Inc.
175+ This file is part of the GNU C Library.
176+
177+ The GNU C Library is free software; you can redistribute it and/or
178+ modify it under the terms of the GNU Lesser General Public
179+ License as published by the Free Software Foundation; either
180+ version 2.1 of the License, or (at your option) any later version.
181+
182+ The GNU C Library is distributed in the hope that it will be useful,
183+ but WITHOUT ANY WARRANTY; without even the implied warranty of
184+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
185+ Lesser General Public License for more details.
186+
187+ You should have received a copy of the GNU Lesser General Public
188+ License along with the GNU C Library; if not, see
189+ <http://www.gnu.org/licenses/>. */
190+
191+#include <tst-assert-c++.cc>
192--
1931.9.4
194
diff --git a/meta/recipes-core/glibc/glibc_2.26.bb b/meta/recipes-core/glibc/glibc_2.26.bb
index 7dd025ae68..5213a6a942 100644
--- a/meta/recipes-core/glibc/glibc_2.26.bb
+++ b/meta/recipes-core/glibc/glibc_2.26.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
7 7
8DEPENDS += "gperf-native" 8DEPENDS += "gperf-native"
9 9
10SRCREV ?= "1c9a5c270d8b66f30dcfaf1cb2d6cf39d3e18369" 10SRCREV ?= "77f921dac17c5fa99bd9e926d926c327982895f7"
11 11
12SRCBRANCH ?= "release/${PV}/master" 12SRCBRANCH ?= "release/${PV}/master"
13 13
@@ -40,10 +40,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
40 file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \ 40 file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \
41 file://0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ 41 file://0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
42 file://0025-locale-fix-hard-coded-reference-to-gcc-E.patch \ 42 file://0025-locale-fix-hard-coded-reference-to-gcc-E.patch \
43 file://0026-assert-Suppress-pedantic-warning-caused-by-statement.patch \
44 file://0027-glibc-reset-dl-load-write-lock-after-forking.patch \ 43 file://0027-glibc-reset-dl-load-write-lock-after-forking.patch \
45 file://0028-Bug-4578-add-ld.so-lock-while-fork.patch \ 44 file://0028-Bug-4578-add-ld.so-lock-while-fork.patch \
46 file://0029-assert-Support-types-without-operator-int-BZ-21972.patch \
47" 45"
48 46
49NATIVESDKFIXES ?= "" 47NATIVESDKFIXES ?= ""