And the script: > On Mar 21, 2021, at 10:28 PM, Jacob Gelbman wrote: > > > >> On Mar 18, 2021, at 11:51 PM, Jun T > 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 ). 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 ' 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" 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 >> to be completed to >> gcc -fdiagnostics-show-location= >> > > I miswrote how to reproduce it. You type --opti, not --opt, then you'll see it position the cursor --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