From 8500403b66fbe203bf072735c9e7fb110a49da37 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 5 Jan 2020 18:52:11 +0000 Subject: 45245: _gcc: add some clang specific warnings --- Completion/Unix/Command/_gcc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_gcc') 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 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 -- cgit v1.2.3 From 4858e868dcf809016a1cb5680327d66d551353ae Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 8 Jan 2020 17:54:46 -0600 Subject: 45261: _gcc: Detect clang-as-gcc --- ChangeLog | 4 ++++ Completion/Unix/Command/_gcc | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'Completion/Unix/Command/_gcc') diff --git a/ChangeLog b/ChangeLog index 804332db7..2e1bfb8ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-01-08 dana + + * 45261: Completion/Unix/Command/_gcc: Detect clang-as-gcc + 2020-01-07 Daniel Shahaf * unposted: Test/X04zlehighlight.ztst: internal: Remove Vim 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 -- cgit v1.2.3