~ubuntu-branches/ubuntu/hardy/gcj-4.2/hardy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/gcc-directives-only.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-08-27 19:03:56 UTC
  • Revision ID: james.westby@ubuntu.com-20070827190356-mhz77izmwht6vcx7
Tags: 4.2.1-4ubuntu1
Upload as gcj-4.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        * c.opt (fdirectives-only): New.
43
43
        * doc/cppopts.texi (fdirectives-only): New.
44
44
 
 
45
2007-08-23  Ollie Wild  <aaw@google.com> 
 
46
 
 
47
        * c-opts.c (c_common_handle_option): Support -fno-directives-only. 
 
48
        * gcc.c (default_compilers): Add -fno-directives-only to 
 
49
        @assembler-with-cpp. 
 
50
 
45
51
libcpp/
46
52
 
47
53
2007-07-30  Ollie Wild  <aaw@google.com>
68
74
 
69
75
2007-07-30  Ollie Wild  <aaw@google.com>
70
76
 
71
 
        * gcc.dg/cpp/counter-2.c: New test.
72
 
        * gcc.dg/cpp/counter-3.c: New test.
73
77
        * gcc.dg/cpp/dir-only-1.c: New test.
74
78
        * gcc.dg/cpp/dir-only-1.h: New file.
75
79
        * gcc.dg/cpp/dir-only-2.c: New test.
80
84
        * gcc.dg/cpp/dir-only-5.c: New test.
81
85
        * gcc.dg/cpp/dir-only-6.c: New test.
82
86
 
 
87
2007-05-22  Janis Johnson  <janis187@us.ibm.com>
 
88
            Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
89
 
 
90
        * lib/gcc-dg.exp(process_message): New proc.
 
91
        (dg-message): New test directive.
 
92
 
83
93
 
84
94
Index: gcc/doc/cppopts.texi
85
95
===================================================================
114
124
 @item -fdollars-in-identifiers
115
125
 @opindex fdollars-in-identifiers
116
126
 @anchor{fdollars-in-identifiers}
117
 
Index: gcc/testsuite/gcc.dg/cpp/counter-2.c
118
 
===================================================================
119
 
--- gcc/testsuite/gcc.dg/cpp/counter-2.c        (revision 0)
120
 
+++ gcc/testsuite/gcc.dg/cpp/counter-2.c        (revision 0)
121
 
@@ -0,0 +1,14 @@
122
 
+/* Copyright 2007 Free Software Foundation, Inc.
123
 
+   Contributed by Ollie Wild <aaw@google.com>.  */
124
 
+
125
 
+/* { dg-do preprocess } */
126
 
+/* { dg-options -fdirectives-only } */
127
 
+
128
 
+/* Tests __COUNTER__ macro expansion is disabled inside directives with
129
 
+   -fdirectives-only. */
130
 
+
131
 
+#ifdef __COUNTER__  /* Macro not expanded. */
132
 
+#endif
133
 
+
134
 
+#if __COUNTER__ == 0  /* { dg-error "__COUNTER__ expanded inside directive with -fdirectives-only" } */
135
 
+#endif
136
 
Index: gcc/testsuite/gcc.dg/cpp/counter-3.c
137
 
===================================================================
138
 
--- gcc/testsuite/gcc.dg/cpp/counter-3.c        (revision 0)
139
 
+++ gcc/testsuite/gcc.dg/cpp/counter-3.c        (revision 0)
140
 
@@ -0,0 +1,10 @@
141
 
+/* Copyright 2007 Free Software Foundation, Inc.
142
 
+   Contributed by Ollie Wild <aaw@google.com>.  */
143
 
+
144
 
+/* { dg-do preprocess } */
145
 
+/* { dg-options "-fdirectives-only -fpreprocessed" } */
146
 
+
147
 
+/* Tests __COUNTER__ macro expansion is enabled outside directives with
148
 
+   -fdirectives-only. */
149
 
+
150
 
+int zero = __COUNTER__;
 
127
Index: gcc/testsuite/lib/gcc-dg.exp
 
128
===================================================================
 
129
--- gcc/testsuite/lib/gcc-dg.exp        (revision 124951)
 
130
+++ gcc/testsuite/lib/gcc-dg.exp        (revision 124952)
 
131
@@ -559,4 +559,40 @@
 
132
     }
 
133
 }
 
134
 
 
135
+# Modify the regular expression saved by a DejaGnu message directive to
 
136
+# include a prefix and to force the expression to match a single line.
 
137
+# MSGPROC is the procedure to call.
 
138
+# MSGPREFIX is the prefix to prepend.
 
139
+# DGARGS is the original argument list.
 
140
+
 
141
+proc process-message { msgproc msgprefix dgargs } {
 
142
+    upvar dg-messages dg-messages
 
143
+
 
144
+    # Process the dg- directive, including adding the regular expression
 
145
+    # to the new message entry in dg-messages.
 
146
+    set msgcnt [llength ${dg-messages}]
 
147
+    catch { eval $msgproc $dgargs }
 
148
+
 
149
+    # If the target expression wasn't satisfied there is no new message.
 
150
+    if { [llength ${dg-messages}] == $msgcnt } {
 
151
+       return;
 
152
+    }
 
153
+
 
154
+    # Prepend the message prefix to the regular expression and make
 
155
+    # it match a single line.
 
156
+    set newentry [lindex ${dg-messages} end]
 
157
+    set expmsg [lindex $newentry 2]
 
158
+    set expmsg "$msgprefix\[^\n]*$expmsg"
 
159
+    set newentry [lreplace $newentry 2 2 $expmsg]
 
160
+    set dg-messages [lreplace ${dg-messages} end end $newentry]
 
161
+    verbose "process-message:\n${dg-messages}" 2
 
162
+}
 
163
+
 
164
+# Look for messages that don't have standard prefixes.
 
165
+
 
166
+proc dg-message { args } {
 
167
+    upvar dg-messages dg-messages
 
168
+    process-message dg-warning "" $args
 
169
+}
 
170
+
 
171
 set additional_prunes ""
151
172
Index: gcc/testsuite/gcc.dg/cpp/dir-only-1.c
152
173
===================================================================
153
174
--- gcc/testsuite/gcc.dg/cpp/dir-only-1.c       (revision 0)
857
878
 /* In traditional.c.  */
858
879
 extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *);
859
880
 extern bool _cpp_read_logical_line_trad (cpp_reader *);
 
881
 
 
882
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
 
883
--- gcc/c-opts.c
 
884
+++ gcc/c-opts.c
 
885
@@ -619,7 +619,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
 
886
       break;
 
887
 
 
888
     case OPT_fdirectives_only:
 
889
-      cpp_opts->directives_only = 1;
 
890
+      cpp_opts->directives_only = value;
 
891
       break;
 
892
 
 
893
     case OPT_fdollars_in_identifiers:
 
894
diff --git a/gcc/gcc.c b/gcc/gcc.c
 
895
--- gcc/gcc.c
 
896
+++ gcc/gcc.c
 
897
@@ -1025,12 +1025,12 @@ static const struct compiler default_compilers[] =
 
898
   {".S", "@assembler-with-cpp", 0, 1, 0},
 
899
   {"@assembler-with-cpp",
 
900
 #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT
 
901
-   "%(trad_capable_cpp) -lang-asm %(cpp_options)\
 
902
+   "%(trad_capable_cpp) -lang-asm %(cpp_options) -fno-directives-only\
 
903
       %{E|M|MM:%(cpp_debug_options)}\
 
904
       %{!M:%{!MM:%{!E:%{!S:-o %|.s |\n\
 
905
        as %(asm_debug) %(asm_options) %|.s %A }}}}"
 
906
 #else
 
907
-   "%(trad_capable_cpp) -lang-asm %(cpp_options)\
 
908
+   "%(trad_capable_cpp) -lang-asm %(cpp_options) -fno-directives-only\
 
909
       %{E|M|MM:%(cpp_debug_options)}\
 
910
       %{!M:%{!MM:%{!E:%{!S:-o %|.s |\n\
 
911
        as %(asm_debug) %(asm_options) %m.s %A }}}}"