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)
122
+/* Copyright 2007 Free Software Foundation, Inc.
123
+ Contributed by Ollie Wild <aaw@google.com>. */
125
+/* { dg-do preprocess } */
126
+/* { dg-options -fdirectives-only } */
128
+/* Tests __COUNTER__ macro expansion is disabled inside directives with
129
+ -fdirectives-only. */
131
+#ifdef __COUNTER__ /* Macro not expanded. */
134
+#if __COUNTER__ == 0 /* { dg-error "__COUNTER__ expanded inside directive with -fdirectives-only" } */
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)
141
+/* Copyright 2007 Free Software Foundation, Inc.
142
+ Contributed by Ollie Wild <aaw@google.com>. */
144
+/* { dg-do preprocess } */
145
+/* { dg-options "-fdirectives-only -fpreprocessed" } */
147
+/* Tests __COUNTER__ macro expansion is enabled outside directives with
148
+ -fdirectives-only. */
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)
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.
141
+proc process-message { msgproc msgprefix dgargs } {
142
+ upvar dg-messages dg-messages
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 }
149
+ # If the target expression wasn't satisfied there is no new message.
150
+ if { [llength ${dg-messages}] == $msgcnt } {
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
164
+# Look for messages that don't have standard prefixes.
166
+proc dg-message { args } {
167
+ upvar dg-messages dg-messages
168
+ process-message dg-warning "" $args
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 *);
882
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
885
@@ -619,7 +619,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
888
case OPT_fdirectives_only:
889
- cpp_opts->directives_only = 1;
890
+ cpp_opts->directives_only = value;
893
case OPT_fdollars_in_identifiers:
894
diff --git a/gcc/gcc.c b/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 }}}}"
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 }}}}"