Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] _gcc: add some clang specific warnings



On 5 Jan 2020, at 12:52, Eitan Adler <lists@xxxxxxxxxxxxxx> wrote:
> This adds some missing completions to the _gcc completer for clang.
> Sadly clang does not support --help=warnings so it is not complete.

Merged. It occurred to me that it won't work quite accurately on macOS,
though, because gcc is actually clang there.

I think this should address it. Or should we go even further and try to be
clever about which options to provide for CFLAGS, &al.? All we could do with
that is guess, i suppose.

dana


diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index bbfbc2b9e..9ec09200e 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -13,6 +13,11 @@ if [[ "$service" = -value-* ]]; then
     args2=()
   fi
 else
+  # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly
+  [[ $service != clang* ]] &&
+  _pick_variant clang=clang unix --version &&
+  service=clang-$service
+
   args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cpp|cxx|ii|k[ih])(-.)"' )
 fi
 



Messages sorted by: Reverse Date, Date, Thread, Author