diff options
author | Khem Raj <raj.khem@gmail.com> | 2015-07-09 10:52:39 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:55:39 +0100 |
commit | 671a00b977e26ed460ec21d29055e0c32a195075 (patch) | |
tree | ab1d3b39c585bd278ec349868738feb4030cf25f /meta | |
parent | ee9e365eca225a1885ca1ebf41912768394cb9f2 (diff) | |
download | poky-671a00b977e26ed460ec21d29055e0c32a195075.tar.gz |
gcc-5: Backport patches for -Wno-narrowing behaviour fixes
Chromium/CEF reveals these warnings which are then treated as errors
which has been fixed on gcc_5 branch upsteam. We backport the relevant
commits
Change-Id: I088a1480d49cdb439c72f0e159bee6de8ba94258
(From OE-Core rev: a8a5c58ec753a8bddc824eb15b06ad4cc8bd021e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
4 files changed, 232 insertions, 1 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.1.inc b/meta/recipes-devtools/gcc/gcc-5.1.inc index 1d64f9e4e4..255e9573fd 100644 --- a/meta/recipes-devtools/gcc/gcc-5.1.inc +++ b/meta/recipes-devtools/gcc/gcc-5.1.inc | |||
@@ -10,7 +10,7 @@ PV = "5.1.0" | |||
10 | 10 | ||
11 | BINV = "5.1.0" | 11 | BINV = "5.1.0" |
12 | 12 | ||
13 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-5.1:" | 13 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-5.1:${FILE_DIRNAME}/gcc-5.1/backport:" |
14 | 14 | ||
15 | DEPENDS =+ "mpfr gmp libmpc zlib" | 15 | DEPENDS =+ "mpfr gmp libmpc zlib" |
16 | NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native" | 16 | NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native" |
@@ -32,6 +32,7 @@ SRC_URI[sha256sum] = "b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89 | |||
32 | 32 | ||
33 | SRC_URI = "\ | 33 | SRC_URI = "\ |
34 | ${BASEURI} \ | 34 | ${BASEURI} \ |
35 | ${BACKPORTS} \ | ||
35 | file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ | 36 | file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ |
36 | file://0002-uclibc-conf.patch \ | 37 | file://0002-uclibc-conf.patch \ |
37 | file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \ | 38 | file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \ |
@@ -72,6 +73,11 @@ SRC_URI = "\ | |||
72 | file://0038-fix-g++-sysroot.patch \ | 73 | file://0038-fix-g++-sysroot.patch \ |
73 | " | 74 | " |
74 | 75 | ||
76 | BACKPORTS = "\ | ||
77 | file://0001-PR65801.patch \ | ||
78 | file://0002-PR65858.patch \ | ||
79 | file://0003-PR66007.patch \ | ||
80 | " | ||
75 | #S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${SNAP}" | 81 | #S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${SNAP}" |
76 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" | 82 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" |
77 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" | 83 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" |
diff --git a/meta/recipes-devtools/gcc/gcc-5.1/backport/0001-PR65801.patch b/meta/recipes-devtools/gcc/gcc-5.1/backport/0001-PR65801.patch new file mode 100644 index 0000000000..9474287033 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.1/backport/0001-PR65801.patch | |||
@@ -0,0 +1,89 @@ | |||
1 | From 346ee8b5c2bf3bf0f0e681b2df5755f299aa1a68 Mon Sep 17 00:00:00 2001 | ||
2 | From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Thu, 30 Apr 2015 16:31:36 +0000 | ||
4 | Subject: [PATCH] /cp 2015-04-30 Paolo Carlini <paolo.carlini@oracle.com> | ||
5 | |||
6 | PR c++/65801 | ||
7 | * typeck2.c (check_narrowing): In C++11 mode too, -Wno-narrowing | ||
8 | suppresses the diagnostic. | ||
9 | |||
10 | 2015-04-30 Paolo Carlini <paolo.carlini@oracle.com> | ||
11 | |||
12 | PR c++/65801 | ||
13 | * doc/invoke.texi ([-Wnarrowing]): Update. | ||
14 | |||
15 | /testsuite | ||
16 | 2015-04-30 Paolo Carlini <paolo.carlini@oracle.com> | ||
17 | |||
18 | PR c++/65801 | ||
19 | * g++.dg/cpp0x/Wnarrowing2.C: New. | ||
20 | |||
21 | |||
22 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222636 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
23 | --- | ||
24 | Upstream-Status: Backport | ||
25 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
26 | |||
27 | gcc/ChangeLog | 5 +++++ | ||
28 | gcc/cp/ChangeLog | 6 ++++++ | ||
29 | gcc/cp/typeck2.c | 10 +++++++--- | ||
30 | gcc/doc/invoke.texi | 8 ++++---- | ||
31 | gcc/testsuite/ChangeLog | 5 +++++ | ||
32 | gcc/testsuite/g++.dg/cpp0x/Wnarrowing2.C | 5 +++++ | ||
33 | 6 files changed, 32 insertions(+), 7 deletions(-) | ||
34 | create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing2.C | ||
35 | |||
36 | diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c | ||
37 | index 80a6939..884957b 100644 | ||
38 | --- a/gcc/cp/typeck2.c | ||
39 | +++ b/gcc/cp/typeck2.c | ||
40 | @@ -957,9 +957,13 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) | ||
41 | } | ||
42 | } | ||
43 | else if (complain & tf_error) | ||
44 | - error_at (EXPR_LOC_OR_LOC (init, input_location), | ||
45 | - "narrowing conversion of %qE from %qT to %qT inside { }", | ||
46 | - init, ftype, type); | ||
47 | + { | ||
48 | + global_dc->pedantic_errors = 1; | ||
49 | + pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, | ||
50 | + "narrowing conversion of %qE from %qT to %qT inside { }", | ||
51 | + init, ftype, type); | ||
52 | + global_dc->pedantic_errors = flag_pedantic_errors; | ||
53 | + } | ||
54 | } | ||
55 | |||
56 | return cxx_dialect == cxx98 || ok; | ||
57 | diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi | ||
58 | index 520c2c5..4ef8f7f 100644 | ||
59 | --- a/gcc/doc/invoke.texi | ||
60 | +++ b/gcc/doc/invoke.texi | ||
61 | @@ -2703,10 +2703,10 @@ int i = @{ 2.2 @}; // error: narrowing from double to int | ||
62 | |||
63 | This flag is included in @option{-Wall} and @option{-Wc++11-compat}. | ||
64 | |||
65 | -With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for | ||
66 | -non-constants the diagnostic required by the standard. Note that this | ||
67 | -does not affect the meaning of well-formed code; narrowing conversions | ||
68 | -are still considered ill-formed in SFINAE context. | ||
69 | +With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic | ||
70 | +required by the standard. Note that this does not affect the meaning | ||
71 | +of well-formed code; narrowing conversions are still considered | ||
72 | +ill-formed in SFINAE context. | ||
73 | |||
74 | @item -Wnoexcept @r{(C++ and Objective-C++ only)} | ||
75 | @opindex Wnoexcept | ||
76 | diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing2.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing2.C | ||
77 | new file mode 100644 | ||
78 | index 0000000..fc806f9 | ||
79 | --- /dev/null | ||
80 | +++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing2.C | ||
81 | @@ -0,0 +1,5 @@ | ||
82 | +// PR c++/65801 | ||
83 | +// { dg-do compile { target c++11 } } | ||
84 | +// { dg-options "-Wno-narrowing" } | ||
85 | + | ||
86 | +static struct zai { unsigned int x; } x = {-1}; | ||
87 | -- | ||
88 | 2.1.4 | ||
89 | |||
diff --git a/meta/recipes-devtools/gcc/gcc-5.1/backport/0002-PR65858.patch b/meta/recipes-devtools/gcc/gcc-5.1/backport/0002-PR65858.patch new file mode 100644 index 0000000000..e7a4fd792c --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.1/backport/0002-PR65858.patch | |||
@@ -0,0 +1,63 @@ | |||
1 | From 82e461dc9d53927de7dae667880b63c2d497172d Mon Sep 17 00:00:00 2001 | ||
2 | From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Fri, 1 May 2015 18:47:55 +0000 | ||
4 | Subject: [PATCH] /cp 2015-05-01 Paolo Carlini <paolo.carlini@oracle.com> | ||
5 | Prathamesh Kulharni <prathamesh.kulkarni@linaro.org> | ||
6 | |||
7 | PR c++/65858 | ||
8 | * typeck2.c (check_narrowing): Set ok = true when pedwarn returns | ||
9 | false. | ||
10 | |||
11 | /testsuite | ||
12 | 2015-05-01 Paolo Carlini <paolo.carlini@oracle.com> | ||
13 | Prathamesh Kulharni <prathamesh.kulkarni@linaro.org> | ||
14 | |||
15 | PR c++/65858 | ||
16 | * g++.dg/cpp0x/Wnarrowing3.C: New. | ||
17 | |||
18 | |||
19 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222700 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
20 | --- | ||
21 | Upstream-Status: Backport | ||
22 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
23 | |||
24 | gcc/cp/ChangeLog | 7 +++++++ | ||
25 | gcc/cp/typeck2.c | 7 ++++--- | ||
26 | gcc/testsuite/ChangeLog | 6 ++++++ | ||
27 | gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C | 6 ++++++ | ||
28 | 4 files changed, 23 insertions(+), 3 deletions(-) | ||
29 | create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C | ||
30 | |||
31 | diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c | ||
32 | index 884957b..9a491aa 100644 | ||
33 | --- a/gcc/cp/typeck2.c | ||
34 | +++ b/gcc/cp/typeck2.c | ||
35 | @@ -959,9 +959,10 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) | ||
36 | else if (complain & tf_error) | ||
37 | { | ||
38 | global_dc->pedantic_errors = 1; | ||
39 | - pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, | ||
40 | - "narrowing conversion of %qE from %qT to %qT inside { }", | ||
41 | - init, ftype, type); | ||
42 | + if (!pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, | ||
43 | + "narrowing conversion of %qE from %qT to %qT " | ||
44 | + "inside { }", init, ftype, type)) | ||
45 | + ok = true; | ||
46 | global_dc->pedantic_errors = flag_pedantic_errors; | ||
47 | } | ||
48 | } | ||
49 | diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C | ||
50 | new file mode 100644 | ||
51 | index 0000000..d2dd383 | ||
52 | --- /dev/null | ||
53 | +++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C | ||
54 | @@ -0,0 +1,6 @@ | ||
55 | +// PR c++/65858 | ||
56 | +// { dg-do compile { target c++11 } } | ||
57 | +// { dg-require-effective-target lto } | ||
58 | +// { dg-options "-flto -Wno-narrowing" } | ||
59 | + | ||
60 | +int x { 0.5 }; | ||
61 | -- | ||
62 | 2.1.4 | ||
63 | |||
diff --git a/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch b/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch new file mode 100644 index 0000000000..7c1a19cd7f --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch | |||
@@ -0,0 +1,73 @@ | |||
1 | From 3b1253116b7cb98da33c997bffa5fa2616aee40a Mon Sep 17 00:00:00 2001 | ||
2 | From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Mon, 4 May 2015 20:59:03 +0000 | ||
4 | Subject: [PATCH] /cp 2015-05-04 Paolo Carlini <paolo.carlini@oracle.com> | ||
5 | Jakub Jelinek <jakub@redhat.com> | ||
6 | |||
7 | PR c++/66007 | ||
8 | * typeck2.c (check_narrowing): Check by-hand that the pedwarn didn't | ||
9 | result in an actual error. | ||
10 | |||
11 | /testsuite | ||
12 | 2015-05-04 Paolo Carlini <paolo.carlini@oracle.com> | ||
13 | Jakub Jelinek <jakub@redhat.com> | ||
14 | |||
15 | PR c++/66007 | ||
16 | * g++.dg/cpp0x/Wnarrowing4.C: New. | ||
17 | |||
18 | |||
19 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222779 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
20 | --- | ||
21 | Upstream-Status: Backport | ||
22 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
23 | |||
24 | gcc/cp/ChangeLog | 7 +++++++ | ||
25 | gcc/cp/typeck2.c | 8 +++++--- | ||
26 | gcc/testsuite/ChangeLog | 6 ++++++ | ||
27 | gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | 14 ++++++++++++++ | ||
28 | 4 files changed, 32 insertions(+), 3 deletions(-) | ||
29 | create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | ||
30 | |||
31 | diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c | ||
32 | index 9a491aa..c0df823 100644 | ||
33 | --- a/gcc/cp/typeck2.c | ||
34 | +++ b/gcc/cp/typeck2.c | ||
35 | @@ -958,10 +958,12 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) | ||
36 | } | ||
37 | else if (complain & tf_error) | ||
38 | { | ||
39 | + int savederrorcount = errorcount; | ||
40 | global_dc->pedantic_errors = 1; | ||
41 | - if (!pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, | ||
42 | - "narrowing conversion of %qE from %qT to %qT " | ||
43 | - "inside { }", init, ftype, type)) | ||
44 | + pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, | ||
45 | + "narrowing conversion of %qE from %qT to %qT " | ||
46 | + "inside { }", init, ftype, type); | ||
47 | + if (errorcount == savederrorcount) | ||
48 | ok = true; | ||
49 | global_dc->pedantic_errors = flag_pedantic_errors; | ||
50 | } | ||
51 | diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | ||
52 | new file mode 100644 | ||
53 | index 0000000..7defce3 | ||
54 | --- /dev/null | ||
55 | +++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | ||
56 | @@ -0,0 +1,14 @@ | ||
57 | +// PR c++/66007 | ||
58 | +// { dg-do run { target c++11 } } | ||
59 | +// { dg-options "-Wno-error=narrowing" } | ||
60 | + | ||
61 | +extern "C" void abort(); | ||
62 | + | ||
63 | +int main() | ||
64 | +{ | ||
65 | + unsigned foo[] = { 1, -1, 3 }; | ||
66 | + if (foo[0] != 1 || foo[1] != __INT_MAX__ * 2U + 1 || foo[2] != 3) | ||
67 | + abort(); | ||
68 | +} | ||
69 | + | ||
70 | +// { dg-prune-output "narrowing conversion" } | ||
71 | -- | ||
72 | 2.1.4 | ||
73 | |||