From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 27127 invoked from network); 1 May 2020 01:11:59 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 1 May 2020 01:11:59 -0000 Received: (qmail 8718 invoked by alias); 1 May 2020 01:11:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45756 Received: (qmail 26362 invoked by uid 1010); 1 May 2020 01:11:52 -0000 X-Qmail-Scanner-Diagnostics: from joooj.vinc17.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25793. spamassassin: 3.4.4. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 0.843352 secs); 01 May 2020 01:11:52 -0000 X-Envelope-From: vincent@vinc17.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Fri, 1 May 2020 03:11:16 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: completion for compilers (cc, gcc...) and -o Message-ID: <20200501011116.GE818727@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20200430085111.GA1649750@zira.vinc17.org> <20200430181459.051d3fd1@tarpaulin.shahaf.local2> <20200430201747.GA818727@zira.vinc17.org> <5a4631d6-578e-4362-b0b3-e397f0990ebb@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5a4631d6-578e-4362-b0b3-e397f0990ebb@www.fastmail.com> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.13.5+143 (0fdc8668) vl-126968 (2020-04-29) On 2020-04-30 22:05:32 +0000, Daniel Shahaf wrote: > Vincent Lefevre wrote on Thu, 30 Apr 2020 20:17 +00:00: > > On 2020-04-30 18:14:59 +0000, Daniel Shahaf wrote: > > > Vincent Lefevre wrote on Thu, 30 Apr 2020 10:51 +0200: > > > > The -o option is currently handled by > > > > > > > > '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' > > > > > > > > I wonder whether .i files (preprocessed files, e.g. for bug reports) > > > > should be excluded too. One can choose such files for output with > > > > "gcc -E", but: > > > > * in this case, one generally chooses to use the shorter ">" (or a > > > > pipe) rather than "-o" (gcc -E file.c > file.i); > > > > > > I don't see how the existence of other ways to create .i files is > > > a reason not to complete .i files after -o. > > > > I've googled a bit, and most examples with -E and storage in a file > > used the redirection. > > You've got your conditional probabilities backwards. The _a priori_ > likelihood that -o should be used to create a .i file is irrelevant to > what should be completed after -o. The issue is that with a completion result on -o that is unexpected by the user, there is a risk of destroying a source file, while the user may expect something more sensible. And note that after all, filename extensions are just conventions, and the whole completion system is based on it, so that for instance, completion on "xz -c" will not propose filenames that do not end with ".xz" (except when there are no other candidates), even though there may be unlikely candidates without a ".xz" suffix. > > BTW, all examples used the -E first, so perhaps > > accept .i files for -o only when -E is present. > > > > Note that GCC describes .i files as source files (among other > > extensions of source files). > > They're _intermediate_ files; they can be either input or output. But > they _can_ be output, so we should complete them, shouldn't we? I would say only with -E, then. Typing "gcc file.i -o f[TAB]" and getting "gcc file.i -o file.i" does not make any sense. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)