[PATCH] Do not abort compilation when dump file is /dev/*
Richard Biener
rguenther@suse.de
Fri Nov 19 09:35:26 GMT 2021
On Fri, 19 Nov 2021, Alexandre Oliva wrote:
> On Nov 18, 2021, Richard Biener <rguenther@suse.de> wrote:
>
> > IMHO a more reasonable thing to do would be to not treat
> > -o /dev/null as a source for -dumpdir and friends. Alex?
>
> +1
>
> I think we already have some special-casing for /dev/null somewhere.
Grepping finds me the following in system.h which is already checked
for in gcc.c in a few places indeed.
/* Provide a default for the HOST_BIT_BUCKET.
This suffices for POSIX-like hosts. */
#ifndef HOST_BIT_BUCKET
#define HOST_BIT_BUCKET "/dev/null"
#endif
> > You did the last re-org, where'd we put such special casing?
>
> I think we're missing something like this, to avoid messing with dumpdir
> with -o /dev/null. We already use the same function when computing
> outbase just below this.
Ah yeah, not_actual_file_p should do the trick indeed. Giuliano, can
you update the patch like below? I think we should still adjust
documentation as you did.
> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index 506c2acc282d6..a986728fb91d6 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -5098,7 +5098,8 @@ process_command (unsigned int decoded_options_count,
>
> bool explicit_dumpdir = dumpdir;
>
> - if (!save_temps_overrides_dumpdir && explicit_dumpdir)
> + if ((!save_temps_overrides_dumpdir && explicit_dumpdir)
> + || (output_file != NULL && not_actual_file_p (output_file)))
> {
> /* Do nothing. */
> }
>
More information about the Gcc-patches
mailing list