I think Nathan might've been asking not only about what currently
happens, but what we think should happen?

On Mon, Dec 12, 2022 at 7:11 PM chuanqi.xcq <yedeng...@linux.alibaba.com> wrote:
>
> Hi Nathan,
>
> > 1) Are these flags silently ignored, if no module output is to be 
> > generated? Or  is some kind of diagnostic generated?
>
> Currently, clang will generate the unused-command-line-argument warning for 
> this case:
>
> ```
> argument unused during compilation: '-fmodule-output' 
> [-Wunused-command-line-argument]
> ```

Is that consistent with `-o`? (I assume so, but don't know - I guess
there aren't many cases where `-o` is unused (maybe `-fsyntax-only`),
so that behavior might be a bit less well specified)

> > 2) what happens if you specify both -- do you get two outputs, a 
> > diagnostic, or
> is one silently selected?
>
> If someone specify both `-fmodule-output` and `-fmodule-output=/path`,
> the `-fmodule-output=/path` will be selected always no matter what the order 
> is.

This seems surprising/possibly wrong to me - do we have precedent from
other flags to draw from?

> And if multiple `-fmodule-output=/path` are specified, the last one will be 
> selected.
>
> > 3) What is the behaviour if compilation fails?  Does nothing happen to the 
> > file
> indicated (potentially leaving an older version there), or does the equivalent
> of 'rm -f $MODULE.pcm' happen?
>
> The module file will be deleted. The behavior is the same with `-o`.
>
> Thanks,
> Chuanqi
>
>
> ------------------------------------------------------------------
> From:Nathan Sidwell <nat...@acm.org>
> Send Time:2022年12月12日(星期一) 22:30
> To:Iain Sandoe <i...@sandoe.co.uk>; GCC Development <gcc@gcc.gnu.org>
> Cc:Nathan Sidwell <nathanmsidw...@gmail.com>; Jonathan Wakely 
> <jwakely....@gmail.com>; David Blaikie <dblai...@gmail.com>; ben.boeckel 
> <ben.boec...@kitware.com>; chuanqi.xcq <yedeng...@linux.alibaba.com>
> Subject:Re: Naming flag for specifying the output file name for Binary Module 
> Interface files
>
> On 12/9/22 12:33, Iain Sandoe wrote:
> > Hello all.
> >
> >> On 9 Dec 2022, at 01:58, chuanqi.xcq <yedeng...@linux.alibaba.com> wrote:
> >>
> >> It looks like `-fmodule-file` is better from the discussion. So let's take 
> >> it. Thanks for everyone here
> >
> > So FAOD (after this discussion) Chuanqi's current patchset implements the 
> > following in clang:
> >
> > -fmodule-output
> >
> >    - this causes the BMI to be saved in the CWG with the basename of the 
> > source file and a suffix of .pcm.
> >
> > -fmodule-output=<path>
> >
> >   - this causes the BMI to be saved at the path specified.
> >
>
> 1) Are these flags silently ignored, if no module output is to be generated? 
> Or
> is some kind of diagnostic generated?
>
> 2) what happens if you specify both -- do you get two outputs, a diagnostic, 
> or
> is one silently selected?
>
> 3) What is the behaviour if compilation fails?  Does nothing happen to the 
> file
> indicated (potentially leaving an older version there), or does the equivalent
> of 'rm -f $MODULE.pcm' happen?
>
> nathan
>
> --
> Nathan Sidwell
>
>

Reply via email to