Deleted Added
full compact
c-opts.c (132811) c-opts.c (146908)
1/* C/ObjC/C++ command line option handling.
2 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3 Contributed by Neil Booth.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 5 unchanged lines hidden (view full) ---

14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
21
1/* C/ObjC/C++ command line option handling.
2 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3 Contributed by Neil Booth.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 5 unchanged lines hidden (view full) ---

14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
21
22/* $FreeBSD: head/contrib/gcc/c-opts.c 132811 2004-07-29 02:04:58Z kan $ */
22/* $FreeBSD: head/contrib/gcc/c-opts.c 146908 2005-06-03 04:02:20Z kan $ */
23
24#include "config.h"
25#include "system.h"
26#include "coretypes.h"
27#include "tm.h"
28#include "tree.h"
29#include "c-common.h"
30#include "c-pragma.h"

--- 152 unchanged lines hidden (view full) ---

183{
184 deferred_opts[deferred_count].code = code;
185 deferred_opts[deferred_count].arg = arg;
186 deferred_count++;
187}
188
189/* Common initialization before parsing options. */
190unsigned int
23
24#include "config.h"
25#include "system.h"
26#include "coretypes.h"
27#include "tm.h"
28#include "tree.h"
29#include "c-common.h"
30#include "c-pragma.h"

--- 152 unchanged lines hidden (view full) ---

183{
184 deferred_opts[deferred_count].code = code;
185 deferred_opts[deferred_count].arg = arg;
186 deferred_count++;
187}
188
189/* Common initialization before parsing options. */
190unsigned int
191c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
191c_common_init_options (unsigned int argc, const char **argv)
192{
193 static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
192{
193 static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
194 unsigned int result;
194 unsigned int i, result;
195
196 /* This is conditionalized only because that is the way the front
197 ends used to do it. Maybe this should be unconditional? */
198 if (c_dialect_cxx ())
199 {
200 /* By default wrap lines at 80 characters. Is getenv
201 ("COLUMNS") preferable? */
202 diagnostic_line_cutoff (global_dc) = 80;

--- 16 unchanged lines hidden (view full) ---

219 flag_const_strings = c_dialect_cxx ();
220 flag_exceptions = c_dialect_cxx ();
221 warn_pointer_arith = c_dialect_cxx ();
222
223 deferred_opts = xmalloc (argc * sizeof (struct deferred_opt));
224
225 result = lang_flags[c_language];
226
195
196 /* This is conditionalized only because that is the way the front
197 ends used to do it. Maybe this should be unconditional? */
198 if (c_dialect_cxx ())
199 {
200 /* By default wrap lines at 80 characters. Is getenv
201 ("COLUMNS") preferable? */
202 diagnostic_line_cutoff (global_dc) = 80;

--- 16 unchanged lines hidden (view full) ---

219 flag_const_strings = c_dialect_cxx ();
220 flag_exceptions = c_dialect_cxx ();
221 warn_pointer_arith = c_dialect_cxx ();
222
223 deferred_opts = xmalloc (argc * sizeof (struct deferred_opt));
224
225 result = lang_flags[c_language];
226
227 /* If potentially preprocessing Fortran we have to accept its front
228 end options since the driver passes most of them through. */
229#ifdef CL_F77
230 if (c_language == clk_c && argc > 2
231 && !strcmp (argv[2], "-traditional-cpp" ))
227 if (c_language == clk_c)
232 {
228 {
233 permit_fortran_options = true;
234 result |= CL_F77;
235 }
229 for (i = 1; i < argc; i++)
230 {
231 /* If preprocessing assembly language, accept any of the C-family
232 front end options since the driver may pass them through. */
233 if (! strcmp (argv[i], "-lang-asm"))
234 result |= CL_C | CL_ObjC | CL_CXX | CL_ObjCXX;
235#ifdef CL_F77
236 /* If potentially preprocessing Fortran we have to accept its
237 front end options since the driver may them through. */
238 else if (! strcmp (argv[i], "-traditional-cpp"))
239 {
240 permit_fortran_options = true;
241 result |= CL_F77;
242 }
236#endif
243#endif
237
244 }
245 }
238 return result;
239}
240
241/* Handle switch SCODE with argument ARG. VALUE is true, unless no-
242 form of an -f or -W option was given. Returns 0 if the switch was
243 invalid, a negative number to prevent language-independent
244 processing in toplev.c (a hack necessary for the short-term). */
245int

--- 914 unchanged lines hidden (view full) ---

1160 input_line = 0;
1161
1162 /* If an error has occurred in cpplib, note it so we fail
1163 immediately. */
1164 errorcount += cpp_errors (parse_in);
1165
1166 *pfilename = this_input_filename
1167 = cpp_read_main_file (parse_in, in_fnames[0]);
246 return result;
247}
248
249/* Handle switch SCODE with argument ARG. VALUE is true, unless no-
250 form of an -f or -W option was given. Returns 0 if the switch was
251 invalid, a negative number to prevent language-independent
252 processing in toplev.c (a hack necessary for the short-term). */
253int

--- 914 unchanged lines hidden (view full) ---

1168 input_line = 0;
1169
1170 /* If an error has occurred in cpplib, note it so we fail
1171 immediately. */
1172 errorcount += cpp_errors (parse_in);
1173
1174 *pfilename = this_input_filename
1175 = cpp_read_main_file (parse_in, in_fnames[0]);
1176 /* Don't do any compilation or preprocessing if there is no input file. */
1168 if (this_input_filename == NULL)
1177 if (this_input_filename == NULL)
1169 return true;
1178 {
1179 errorcount++;
1180 return false;
1181 }
1170
1171 if (flag_working_directory
1172 && flag_preprocess_only && ! flag_no_line_commands)
1173 pp_dir_change (parse_in, get_src_pwd ());
1174
1175 return flag_preprocess_only;
1176}
1177

--- 172 unchanged lines hidden (view full) ---

1350
1351 /* -dM and dependencies suppress normal output; do it here so that
1352 the last -d[MDN] switch overrides earlier ones. */
1353 if (flag_dump_macros == 'M')
1354 flag_no_output = 1;
1355
1356 /* Disable -dD, -dN and -dI if normal output is suppressed. Allow
1357 -dM since at least glibc relies on -M -dM to work. */
1182
1183 if (flag_working_directory
1184 && flag_preprocess_only && ! flag_no_line_commands)
1185 pp_dir_change (parse_in, get_src_pwd ());
1186
1187 return flag_preprocess_only;
1188}
1189

--- 172 unchanged lines hidden (view full) ---

1362
1363 /* -dM and dependencies suppress normal output; do it here so that
1364 the last -d[MDN] switch overrides earlier ones. */
1365 if (flag_dump_macros == 'M')
1366 flag_no_output = 1;
1367
1368 /* Disable -dD, -dN and -dI if normal output is suppressed. Allow
1369 -dM since at least glibc relies on -M -dM to work. */
1370 /* Also, flag_no_output implies flag_no_line_commands, always. */
1358 if (flag_no_output)
1359 {
1360 if (flag_dump_macros != 'M')
1361 flag_dump_macros = 0;
1362 flag_dump_includes = 0;
1371 if (flag_no_output)
1372 {
1373 if (flag_dump_macros != 'M')
1374 flag_dump_macros = 0;
1375 flag_dump_includes = 0;
1376 flag_no_line_commands = 1;
1363 }
1364
1365 cpp_opts->unsigned_char = !flag_signed_char;
1366 cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
1367
1368 /* We want -Wno-long-long to override -pedantic -std=non-c99
1369 and/or -Wtraditional, whatever the ordering. */
1370 cpp_opts->warn_long_long

--- 214 unchanged lines hidden ---
1377 }
1378
1379 cpp_opts->unsigned_char = !flag_signed_char;
1380 cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
1381
1382 /* We want -Wno-long-long to override -pedantic -std=non-c99
1383 and/or -Wtraditional, whatever the ordering. */
1384 cpp_opts->warn_long_long

--- 214 unchanged lines hidden ---