]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - pkgs/gcc/patches/gcc46-Woverlength-string.patch0
Change file layout of the makefiles.
[people/arne_f/ipfire-3.x.git] / pkgs / gcc / patches / gcc46-Woverlength-string.patch0
1 2011-01-18 Tom Tromey <tromey@redhat.com>
2
3 * c-parser.c (disable_extension_diagnostics): Save
4 warn_overlength_strings.
5 (restore_extension_diagnostics): Restore warn_overlength_strings.
6
7 * gcc.dg/Woverlength-strings-pedantic-c89-ext.c: New file.
8 * gcc.dg/Woverlength-strings-pedantic-c90-ext.c: New file.
9 * gcc.dg/Woverlength-strings-pedantic-c99-ext.c: New file.
10
11 --- gcc/c-parser.c (revision 168933)
12 +++ gcc/c-parser.c (working copy)
13 @@ -1045,13 +1045,15 @@
14 | (warn_traditional << 2)
15 | (flag_iso << 3)
16 | (warn_long_long << 4)
17 - | (warn_cxx_compat << 5));
18 + | (warn_cxx_compat << 5)
19 + | (warn_overlength_strings << 6));
20 cpp_opts->cpp_pedantic = pedantic = 0;
21 warn_pointer_arith = 0;
22 cpp_opts->cpp_warn_traditional = warn_traditional = 0;
23 flag_iso = 0;
24 cpp_opts->cpp_warn_long_long = warn_long_long = 0;
25 warn_cxx_compat = 0;
26 + warn_overlength_strings = 0;
27 return ret;
28 }
29
30 @@ -1067,6 +1069,7 @@
31 flag_iso = (flags >> 3) & 1;
32 cpp_opts->cpp_warn_long_long = warn_long_long = (flags >> 4) & 1;
33 warn_cxx_compat = (flags >> 5) & 1;
34 + warn_overlength_strings = (flags >> 6) & 1;
35 }
36
37 /* Possibly kinds of declarator to parse. */
38 --- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c89-ext.c (revision 0)
39 +++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c89-ext.c (revision 0)
40 @@ -0,0 +1,19 @@
41 +/* -Woverlength-strings complains about string constants which are too long
42 + for the C standard's "minimum maximum" limits. It is off by default,
43 + but implied by -pedantic. */
44 +
45 +/* { dg-options "-std=c89 -pedantic" } */
46 +
47 +#define TEN "xxxxxxxxxx"
48 +#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
49 +#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
50 +
51 +/* C89's minimum-maximum is 509. */
52 +const char x510[] = __extension__ HUN HUN HUN HUN HUN TEN;
53 +
54 +/* C99's minimum-maximum is 4095. */
55 +const char x4096[] = __extension__
56 + THO THO THO THO /* 4000 */
57 + TEN TEN TEN TEN TEN /* 4050 */
58 + TEN TEN TEN TEN /* 4090 */
59 + "123456";
60 --- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90-ext.c (revision 0)
61 +++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90-ext.c (revision 0)
62 @@ -0,0 +1,19 @@
63 +/* -Woverlength-strings complains about string constants which are too long
64 + for the C standard's "minimum maximum" limits. It is off by default,
65 + but implied by -pedantic. */
66 +
67 +/* { dg-options "-std=c90 -pedantic" } */
68 +
69 +#define TEN "xxxxxxxxxx"
70 +#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
71 +#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
72 +
73 +/* C89's minimum-maximum is 509. */
74 +const char x510[] = __extension__ HUN HUN HUN HUN HUN TEN;
75 +
76 +/* C99's minimum-maximum is 4095. */
77 +const char x4096[] = __extension__
78 + THO THO THO THO /* 4000 */
79 + TEN TEN TEN TEN TEN /* 4050 */
80 + TEN TEN TEN TEN /* 4090 */
81 + "123456";
82 --- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c99-ext.c (revision 0)
83 +++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c99-ext.c (revision 0)
84 @@ -0,0 +1,19 @@
85 +/* -Woverlength-strings complains about string constants which are too long
86 + for the C standard's "minimum maximum" limits. It is off by default,
87 + but implied by -pedantic. */
88 +
89 +/* { dg-options "-std=c99 -pedantic" } */
90 +
91 +#define TEN "xxxxxxxxxx"
92 +#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
93 +#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
94 +
95 +/* C89's minimum-maximum is 509. */
96 +const char x510[] = HUN HUN HUN HUN HUN TEN;
97 +
98 +/* C99's minimum-maximum is 4095. */
99 +const char x4096[] = __extension__
100 + THO THO THO THO /* 4000 */
101 + TEN TEN TEN TEN TEN /* 4050 */
102 + TEN TEN TEN TEN /* 4090 */
103 + "123456";