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 5117 invoked from network); 30 Apr 2020 17:58:09 -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; 30 Apr 2020 17:58:09 -0000 Received: (qmail 13217 invoked by alias); 30 Apr 2020 17:57:57 -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: 45744 Received: (qmail 28773 invoked by uid 1010); 30 Apr 2020 17:57:57 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f47.google.com 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(209.85.210.47):SA:0(-1.9/5.0):. Processed in 4.005528 secs); 30 Apr 2020 17:57:57 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.210.47 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=GQ4jPRsrdD8xkrLsE+mONqEzI4gKbyym1iQlZFQfvPA=; b=SxHLTrdmxoUqHxi8TPQPlYrL0NHrnrsWccYPy7c0hgR71kzXnknmsGnJcW+HRSrtHG OSJx22eIdZsPRdUsXbm4HnMXHTrkve5Pz+X37Djwm0v9Wm7Er7rlST9dsc61jNdXQyb8 zJms2pyBqYKY/KXt8PKInaowPaEq2bI4vc8DYOBcJ4UXZCA26XLe5lvfbLg12VJJTQJS cvy5FJhZ+MI/Fo9ykXzXPnWujBOEQj/y6ierpsWSwpRPdydJ4oyNEZs+JBGyazzm+oz1 NscTza6X+Qyu8uciH0fg6VIitEfV/sr3+UMTyhIbUnya5WTT0KCJu3Gs+syaa2uLTBbR iy7A== X-Gm-Message-State: AGi0PuZQhSIQd2ZaaUn3wNrV2x/PXQOfvaM6s6ixh51ZASaZ3TwTTVRp HMPp0gnomBw5HKQjXn/xAQcQ0vwM1M7/5Wm9kdZrTK+H5lqu7g== X-Google-Smtp-Source: APiQypKiePl2/jpRAipg4IOBol88TE3/rQXW4unfT4MjN0uVVEV+mvgCkipfbSfocGCJ15pi8IhT/RIshe2ydByxzuo= X-Received: by 2002:a9d:6b11:: with SMTP id g17mr230725otp.161.1588269437447; Thu, 30 Apr 2020 10:57:17 -0700 (PDT) MIME-Version: 1.0 References: <20200430085111.GA1649750@zira.vinc17.org> In-Reply-To: <20200430085111.GA1649750@zira.vinc17.org> From: Bart Schaefer Date: Thu, 30 Apr 2020 10:57:06 -0700 Message-ID: Subject: Re: completion for compilers (cc, gcc...) and -o To: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" On Thu, Apr 30, 2020 at 1:52 AM Vincent Lefevre wrote: > > 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. > > Moreover, if I have a C source "myprogram.c", I generally want the > output file (program name) to be "myprogram", or if I need several > versions (e.g. because I test several options [...] > > cc -o my[TAB] > > I'd like the "myprogram" to be taken into account. That seems pretty simple: zstyle :completion::complete:gcc:option-o-1: file-patterns \ "^*.(c|h|cc|C|cxx|i)(-.) *.(c|cc|C|cxx)(N\:r)" Interesting tidbit, you have to backslash the colon there because _files is parsing this in pattern:tag format, and it's not clever about parens. If we think this is useful enough to fold in to the default (pardon likely line wrapping by gmail): diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 9ec09200e..7437b96c0 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -390,7 +390,7 @@ languages=( # generic options (from --help) args+=( '-###[print commands to run this compilation]' - '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' + '-o:output file:_files -g "^*.(c|h|cc|C|cxx|i)(-.) *.(c|cc|C|cxx)(N\:r)"' '-x[Specify the language of the following input files]:input file language:('"$languages"')' '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' '-d-:dump:->dump'