diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-5.1/backport/0001-PR65801.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-5.1/backport/0001-PR65801.patch | 89 |
1 files changed, 89 insertions, 0 deletions
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 | |||