From: Jacob Gelbman <gelbman@gmail.com>
To: Jun T <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: Improvements to the gcc completion script
Date: Sun, 21 Mar 2021 22:28:29 -0400 [thread overview]
Message-ID: <476D5028-52A7-4850-98E7-95ADFA69367A@gmail.com> (raw)
In-Reply-To: <AC21C9E9-1941-46D4-80D6-89CFA0DE4D97@kba.biglobe.ne.jp>
> On Mar 18, 2021, at 11:51 PM, Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> Thank you for lots of improvements!
>
> Please consider the following points (some of them already existed
> before your improvements):
>
>
> In args for clang (line 509 and below), there are several duplicated options
> such as -fshow-source-location, -lazy_framework, etc.
Thanks, not sure how I completely missed some of these duplicates. -fshow-source-location, -lazy_framework, -fcaret-diagnostics, -fdiagnostics-fixit-info, -fdiagnostics-print-source-range-info, -init, -install_name, -interface-stub-version, -keep_private_externs, -lazy_library.
>
> Some options (such as -fauto-profile) can take optional argument.
> For these, it would be better to use
> --fauto-profile=-::message:action
> instead of duplicating it with and without arg.
>
I combined these options into one option with an optional argument: -fauto-profile, -fcf-protection, -fmemory-profile, -fprofile-instr-generate, -fprofile-instr-use, -fprofile-sample-use, -fsanitize-memory-track-origins, -fsanitize-recover, -fsanitize-trap, -fsave-optimization-record, -gz
I made sure -ftemplate-depth takes the extra - at the end, this option should look like -ftemplate-depth-5 not -ftemplate-depth5.
>
> I think LD_LIBRARY_PATH is not used at link time (it is used only at run time),
> and we can ignore it when completing libraries ( -l<TAB> ). Is this correct?
I thought the same but wasn't 100% sure, so I left it in, but I tried it and it doesn't work, so I removed using this variable.
>
> TODO (you can left this for someone else):
> Add directories specified by -L/path/to/dir on the command line to library_path.
I did it.
>
>
>> Added the -framework option, and completed the names of frameworks it can take. frameworks are macOS's style of library.
>
> -F, -iframework and -iframeworkwithsysroot can be specified multiple times.
> Please use '*-F' etc for optspec.
> For -iframework you can use '_files -/' as action (like -F).
Okay.
> # -iframeworkwithsysroot is meaningful only with -isysroot, and, ideally,
> # '-iframeworkwithsysroot <TAB>' should offer directory relative to isysroot.
> # But I think such an elaboration would not be necessary.
>
> -framework, -lazy_framework and -weak_framework can also be specified multiple times.
> The latter two can use '->framework' as action (as -framework).
Okay.
>
> It would be better to include Framework-related stuff only if '$OSTYPE = darwin*'.
I think clang on linux would recognize the -framework option and pass it on to the linker, which would probably fail. but, I think there's a way of setting up linux to be able to compile Objective-C programs with frameworks using gnustep or some other collection. I've never done it though.
>
> I don't have any detailed knowledge of how Apple's command line tools work,
> but probably it would better to use the output of 'xcrun --show-sdk-path' instead of
> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.
I would use use clang -Wl,-v but it could be a bit tricky to get it to cache correctly, so I left that one be for now.
>
> TODO: Add directory specified by -F/path/to/dir to framework_path
I did this.
>
>> I changed the input file type because sometimes it's useful to include library files on the command line, and these have extensions .so*, .a, .dylib, or even with no extension like in mac's frameworks. I thought it better if it just completed all files and not just .c, .cpp, .m, etc.
>
> I believe most users will not like this. Instead, please use something like
> zstyle ':completion:*:*:gcc:argument-rest:*' file-patterns '*'
> for your personal customization.
I put it back to the way it was, but my vote is to change it.
>
>
>> I removed the matchspec "r:|[_-]=*" from the _arguments call because there were certain options where I would try to complete them, and they positioned the cursor elsewhere unexpectedly. for example, I wrote "clang --opt<tab>" and after it completed up until --optimiz, it positioned me on the second - when I expected to be at the end of the fully completed option, --optimize=. also it didn't fully complete, it left it at --optimiz.
>
> I can't reproduce your problem.
> The matcher 'r:|[_-]=*' is quite useful and better not to be removed since it allows
> gcc -fd-s-l<TAB>
> to be completed to
> gcc -fdiagnostics-show-location=
>
I miswrote how to reproduce it. You type --opti<tab>, not --opt<tab>, then you'll see it position the cursor -<here>-optimiz. This sort of thing is especially annoying if you bind tab to expand-or-complete-prefix.
>
>> I added a completion for arguments to -Werror= ... (snip)
>
> Thanks. I think -Werror can also be specified multiple times ('*-Werror=-').
I fixed it.
>
> ----
> Jun
next prev parent reply other threads:[~2021-03-22 2:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 4:07 Jacob Gelbman
2021-03-19 3:51 ` Jun T
2021-03-22 2:28 ` Jacob Gelbman [this message]
2021-03-22 2:29 ` Jacob Gelbman
2021-03-22 15:18 ` Jun. T
2021-03-31 12:31 ` Oliver Kiddle
2021-03-31 14:53 ` Jun. T
2021-03-31 15:06 ` Jun. T
2021-03-31 18:37 ` two anchor forms of matching control (was Re: Improvements to the gcc completion script) Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=476D5028-52A7-4850-98E7-95ADFA69367A@gmail.com \
--to=gelbman@gmail.com \
--cc=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).