zsh-workers
 help / color / mirror / code / Atom feed
From: Eitan Adler <lists@eitanadler.com>
To: zsh-workers@zsh.org
Cc: Eitan Adler <lists@eitanadler.com>
Subject: [PATCH] _gcc: add some clang specific warnings
Date: Sun,  5 Jan 2020 18:52:11 +0000	[thread overview]
Message-ID: <20200105185211.11610-1-lists@eitanadler.com> (raw)

This adds some missing completions to the _gcc completer for clang.
Sadly clang does not support --help=warnings so it is not complete.

Signed-off-by: Eitan Adler <lists@eitanadler.com>
---
 Completion/Unix/Command/_gcc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 0061cfa3b..bbfbc2b9e 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -350,10 +350,12 @@ if [[ "$service" = clang* ]]; then
         "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]"
         "-nostdlibinc[Do not search standard system directories for include files]"
         "-nobuiltininc[Do not search builtin directory for include files]"
+        "--help[Display this information]"
     )
 else
     args+=(
       '-flto=-[Enable link-time optimization]::jobs:'
+      '*--help=-[Display this information]:class:->help'
     )
 fi
 
@@ -427,7 +429,6 @@ args+=(
   '*-isystem:second include path directory (system):_files -/'
   '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/'
   '-pass-exit-codes[Exit with highest error code from a phase]'
-  '*--help=-[Display this information]:class:->help'
   '--target-help[Display target specific command line options]'
   '-dumpspecs[Display all of the built in spec strings]'
   '-dumpversion[Display the version of the compiler]'
@@ -676,7 +677,6 @@ args+=(
   '-Wunderflow[Warn about underflow of numerical constant expressions]'
   '-Wuninitialized[Warn about uninitialized automatic variables]'
   '-Wunknown-pragmas[Warn about unrecognized pragmas]'
-  '-Wunreachable-code[Does nothing. Preserved for backward compatibility]'
   '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]'
   '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]'
   '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]'
@@ -730,6 +730,20 @@ args+=(
   '-Werror=-[Treat specified warning as error (or all if none specified)]::warning:->werror'
   '-Wfatal-errors[Exit on the first error occurred]'
 )
+# clang specific warnings
+if [[ "$service" = clang* ]]; then
+  args+=(
+    '-Wunreachable-code[Warn on code that will not be executed]'
+    '-Wunreachable-code-aggressive[Controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
+    '-Wunreachable-code-break[Warn when break will never be executed]'
+    '-Wunreachable-code-loop-increment[Warn when loop will be executed only once]'
+    '-Wunreachable-code-return[Warn when return will not be executed]'
+  )
+else
+  args+=(
+    '-Wunreachable-code[Does nothing. Preserved for backward compatibility]'
+  )
+fi
 # optimizers (from --help=optimizers), except for -O
 args+=(
 # --help=optimizers,^joined
-- 
2.24.1


             reply	other threads:[~2020-01-05 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-05 18:52 Eitan Adler [this message]
2020-01-07  4:16 ` dana
2020-01-08  4:57   ` Eitan Adler

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=20200105185211.11610-1-lists@eitanadler.com \
    --to=lists@eitanadler.com \
    --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).