summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/c-opts.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/c-opts.c')
-rw-r--r--contrib/gcc/c-opts.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/contrib/gcc/c-opts.c b/contrib/gcc/c-opts.c
index 93637a2..2a61744 100644
--- a/contrib/gcc/c-opts.c
+++ b/contrib/gcc/c-opts.c
@@ -186,10 +186,10 @@ defer_opt (enum opt_code code, const char *arg)
/* Common initialization before parsing options. */
unsigned int
-c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
+c_common_init_options (unsigned int argc, const char **argv)
{
static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
- unsigned int result;
+ unsigned int i, result;
/* This is conditionalized only because that is the way the front
ends used to do it. Maybe this should be unconditional? */
@@ -222,17 +222,25 @@ c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
result = lang_flags[c_language];
- /* If potentially preprocessing Fortran we have to accept its front
- end options since the driver passes most of them through. */
-#ifdef CL_F77
- if (c_language == clk_c && argc > 2
- && !strcmp (argv[2], "-traditional-cpp" ))
+ if (c_language == clk_c)
{
- permit_fortran_options = true;
- result |= CL_F77;
- }
+ for (i = 1; i < argc; i++)
+ {
+ /* If preprocessing assembly language, accept any of the C-family
+ front end options since the driver may pass them through. */
+ if (! strcmp (argv[i], "-lang-asm"))
+ result |= CL_C | CL_ObjC | CL_CXX | CL_ObjCXX;
+#ifdef CL_F77
+ /* If potentially preprocessing Fortran we have to accept its
+ front end options since the driver may them through. */
+ else if (! strcmp (argv[i], "-traditional-cpp"))
+ {
+ permit_fortran_options = true;
+ result |= CL_F77;
+ }
#endif
-
+ }
+ }
return result;
}
@@ -1160,8 +1168,12 @@ c_common_post_options (const char **pfilename)
*pfilename = this_input_filename
= cpp_read_main_file (parse_in, in_fnames[0]);
+ /* Don't do any compilation or preprocessing if there is no input file. */
if (this_input_filename == NULL)
- return true;
+ {
+ errorcount++;
+ return false;
+ }
if (flag_working_directory
&& flag_preprocess_only && ! flag_no_line_commands)
@@ -1350,11 +1362,13 @@ sanitize_cpp_opts (void)
/* Disable -dD, -dN and -dI if normal output is suppressed. Allow
-dM since at least glibc relies on -M -dM to work. */
+ /* Also, flag_no_output implies flag_no_line_commands, always. */
if (flag_no_output)
{
if (flag_dump_macros != 'M')
flag_dump_macros = 0;
flag_dump_includes = 0;
+ flag_no_line_commands = 1;
}
cpp_opts->unsigned_char = !flag_signed_char;
OpenPOWER on IntegriCloud