summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch')
-rw-r--r--meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch151
1 files changed, 151 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch
new file mode 100644
index 0000000000..ea2ea2abcc
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.1/debian/pr28322.dpatch
@@ -0,0 +1,151 @@
1#! /bin/sh -e
2
3# DP: Fix PR other/28322, GCC new warnings and compatibility.
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26gcc/
27
282008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
29
30 PR other/28322
31 * toplev.c (toplev_main): If there are warnings or error, print
32 errors for ignored options.
33 * opts.c (ignored_options): New static variable.
34 (postpone_unknown_option_error): New.
35 (print_ignored_options): New.
36 (handle_option): Postpone errors for unknown -Wno-* options.
37 * opts.h (print_ignored_options): Declare.
38
39gcc/testsuite/
40
412008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
42
43 PR other/28322
44 * gcc.dg/pr28322.c: New.
45 * gcc.dg/pr28322-2.c: New.
46 * lib/prune.exp: Ignore "At top level" even if there is no ':'
47 preceding it.
48
49Index: gcc/toplev.c
50===================================================================
51--- gcc/toplev.c (revision 132801)
52+++ gcc/toplev.c (working copy)
53@@ -2278,6 +2278,9 @@
54 if (!exit_after_options)
55 do_compile ();
56
57+ if (warningcount || errorcount)
58+ print_ignored_options ();
59+
60 if (errorcount || sorrycount)
61 return (FATAL_EXIT_CODE);
62
63Index: gcc/testsuite/lib/prune.exp
64===================================================================
65--- gcc/testsuite/lib/prune.exp (revision 132801)
66+++ gcc/testsuite/lib/prune.exp (working copy)
67@@ -21,7 +21,7 @@
68 #send_user "Before:$text\n"
69
70 regsub -all "(^|\n)(\[^\n\]*: )?In ((static member )?function|member|method|(copy )?constructor|destructor|instantiation|program|subroutine|block-data) \[^\n\]*" $text "" text
71- regsub -all "(^|\n)\[^\n\]*: At (top level|global scope):\[^\n\]*" $text "" text
72+ regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
73 regsub -all "(^|\n)\[^\n\]*: instantiated from \[^\n\]*" $text "" text
74 regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text
75 regsub -all "(^|\n)collect2: ld returned \[^\n\]*" $text "" text
76Index: gcc/opts.c
77===================================================================
78--- gcc/opts.c (revision 132801)
79+++ gcc/opts.c (working copy)
80@@ -356,6 +356,12 @@
81 static VEC(char_p,heap) *flag_instrument_functions_exclude_functions;
82 static VEC(char_p,heap) *flag_instrument_functions_exclude_files;
83
84+typedef const char *const_char_p; /* For DEF_VEC_P. */
85+DEF_VEC_P(const_char_p);
86+DEF_VEC_ALLOC_P(const_char_p,heap);
87+
88+static VEC(const_char_p,heap) *ignored_options;
89+
90 /* Input file names. */
91 const char **in_fnames;
92 unsigned num_in_fnames;
93@@ -434,6 +440,33 @@
94 free (bad_lang);
95 }
96
97+/* Buffer the unknown option described by the string OPT. Currently,
98+ we only complain about unknown -Wno-* options if they may have
99+ prevented a diagnostic. Otherwise, we just ignore them. */
100+
101+static void postpone_unknown_option_error(const char *opt)
102+{
103+ VEC_safe_push (const_char_p, heap, ignored_options, opt);
104+}
105+
106+/* Produce an error for each option previously buffered. */
107+
108+void print_ignored_options (void)
109+{
110+ location_t saved_loc = input_location;
111+
112+ input_location = 0;
113+
114+ while (!VEC_empty (const_char_p, ignored_options))
115+ {
116+ const char *opt;
117+ opt = VEC_pop (const_char_p, ignored_options);
118+ error ("unrecognized command line option \"%s\"", opt);
119+ }
120+
121+ input_location = saved_loc;
122+}
123+
124 /* Handle the switch beginning at ARGV for the language indicated by
125 LANG_MASK. Returns the number of switches consumed. */
126 static unsigned int
127@@ -463,6 +496,14 @@
128 opt = dup;
129 value = 0;
130 opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
131+ if (opt_index == cl_options_count && opt[1] == 'W')
132+ {
133+ /* We don't generate errors for unknown -Wno-* options
134+ unless we issue diagnostics. */
135+ postpone_unknown_option_error (argv[0]);
136+ result = 1;
137+ goto done;
138+ }
139 }
140
141 if (opt_index == cl_options_count)
142Index: gcc/opts.h
143===================================================================
144--- gcc/opts.h (revision 132801)
145+++ gcc/opts.h (working copy)
146@@ -105,4 +105,5 @@
147
148 extern void enable_warning_as_error (const char *arg, int value,
149 unsigned int lang_mask);
150+extern void print_ignored_options (void);
151 #endif