zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _gcc: Improve completer for _clang and _gcc
@ 2018-06-18  5:14 Eitan Adler
  2018-06-18  7:44 ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Eitan Adler @ 2018-06-18  5:14 UTC (permalink / raw)
  To: zsh-workers; +Cc: Eitan Adler

clang - add additional sanitizers
both - add additional standards (basically, aliases)
both - fix -flto

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

diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index a552bb2db..9690df79f 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -338,16 +338,31 @@ h8/300)
   ;;
 esac
 
+local -a sanitizers
 if [[ "$service" = clang* ]]; then
     args=(
         $args
-        -flto -emit-llvm
+        "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
+        -emit-llvm
         "-Qunused-arguments[don't emit warning for unused driver arguments]"
         --analyze
         -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
         -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
         -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
     )
+    sanitizers=(
+        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
+        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
+        nullability-return object-size pointer-overflow return unsigned-integer-overflow
+        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
+    )
+else
+    args=(
+      '-flto=-[Enable link-time optimization]::jobs:'
+    )
+    sanitizers=(
+        address memory
+    )
 fi
 
 local -a languages
@@ -399,7 +414,7 @@ args+=(
   '-print-file-name=-[Display the full path to library <library>]:library:->library'
   '-print-prog-name=-[Display the full path to compiler component <program>]:program:'
   '*-specs=-[Override built-in specs with the contents of <file>]:file:_files'
-  '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 gnu++17 c++2a gnu++2a)'
+  '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899:1990 iso9899:199409 c99 iso9899:1999 c11 iso9899:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899:2017 gnu++17 c++2a gnu++2a)'
   '*-include:include file:_files -g \*.h\(-.\)'
   '*-imacros:macro input file:_files -g \*.h\(-.\)'
   '*-idirafter:second include path directory:_files -/'
@@ -1034,7 +1049,6 @@ args+=(
   '-flto-odr-type-merging[Merge C++ types using One Definition Rule]'
   '-flto-partition=-[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
   '-flto-report[Report various link-time optimization statistics]'
-  '-flto=-[Enable link-time optimization]::jobs:'
   '-fmax-errors=-[Maximum number of errors to report]:errors: '
   '-fmem-report-wpa[Report on permanent memory allocation in WPA only]'
   '-fmem-report[Report on permanent memory allocation]'
@@ -1061,7 +1075,7 @@ args+=(
   '-freciprocal-math[Same as -fassociative-math for expressions which include division]'
   '-frecord-gcc-switches[Record gcc command line switches in the object file]'
   '-free[Turn on Redundant Extensions Elimination pass]'
-  '-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:(address thread)'
+  "-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
   '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: '
   '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: '
   '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: '
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] _gcc: Improve completer for _clang and _gcc
  2018-06-18  5:14 [PATCH] _gcc: Improve completer for _clang and _gcc Eitan Adler
@ 2018-06-18  7:44 ` Mikael Magnusson
  2018-06-18  7:49   ` Eitan Adler
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2018-06-18  7:44 UTC (permalink / raw)
  To: Eitan Adler; +Cc: zsh workers

On Mon, Jun 18, 2018 at 7:14 AM, Eitan Adler <lists@eitanadler.com> wrote:
> clang - add additional sanitizers
> both - add additional standards (basically, aliases)
> both - fix -flto
>
> Signed-off-by: Eitan Adler <lists@eitanadler.com>
> ---
>  Completion/Unix/Command/_gcc | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
> index a552bb2db..9690df79f 100644
> --- a/Completion/Unix/Command/_gcc
> +++ b/Completion/Unix/Command/_gcc
> @@ -338,16 +338,31 @@ h8/300)
>    ;;
>  esac
>
> +local -a sanitizers
>  if [[ "$service" = clang* ]]; then
>      args=(
>          $args
> -        -flto -emit-llvm
> +        "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
> +        -emit-llvm
>          "-Qunused-arguments[don't emit warning for unused driver arguments]"
>          --analyze
>          -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
>          -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
>          -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
>      )
> +    sanitizers=(
> +        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
> +        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
> +        nullability-return object-size pointer-overflow return unsigned-integer-overflow
> +        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr

Did you mean to add this list under the gcc case?

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] _gcc: Improve completer for _clang and _gcc
  2018-06-18  7:44 ` Mikael Magnusson
@ 2018-06-18  7:49   ` Eitan Adler
  2018-06-18 12:37     ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Eitan Adler @ 2018-06-18  7:49 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

On 18 June 2018 at 00:44, Mikael Magnusson <mikachu@gmail.com> wrote:
> On Mon, Jun 18, 2018 at 7:14 AM, Eitan Adler <lists@eitanadler.com> wrote:
>> clang - add additional sanitizers
>> both - add additional standards (basically, aliases)
>> both - fix -flto
>>
>> Signed-off-by: Eitan Adler <lists@eitanadler.com>
>> ---
>>  Completion/Unix/Command/_gcc | 22 ++++++++++++++++++----
>>  1 file changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
>> index a552bb2db..9690df79f 100644
>> --- a/Completion/Unix/Command/_gcc
>> +++ b/Completion/Unix/Command/_gcc
>> @@ -338,16 +338,31 @@ h8/300)
>>    ;;
>>  esac
>>
>> +local -a sanitizers
>>  if [[ "$service" = clang* ]]; then
>>      args=(
>>          $args
>> -        -flto -emit-llvm
>> +        "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
>> +        -emit-llvm
>>          "-Qunused-arguments[don't emit warning for unused driver arguments]"
>>          --analyze
>>          -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
>>          -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
>>          -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
>>      )
>> +    sanitizers=(
>> +        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
>> +        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
>> +        nullability-return object-size pointer-overflow return unsigned-integer-overflow
>> +        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
>
> Did you mean to add this list under the gcc case?

No. Those are the list supported by clang. I didn't do a full audit,
but gcc supports fewer of them. It may support more than the list I
included, but this is not a regression.

Its hard to test gcc since it just errors out with "/usr/local/bin/ld:
cannot find -lubsan" when testing and I don't want to go down the
rabbit hole of debugging that right now.



-- 
Eitan Adler


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] _gcc: Improve completer for _clang and _gcc
  2018-06-18  7:49   ` Eitan Adler
@ 2018-06-18 12:37     ` Mikael Magnusson
  2018-06-19  5:27       ` Eitan Adler
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2018-06-18 12:37 UTC (permalink / raw)
  To: Eitan Adler; +Cc: zsh workers

On Mon, Jun 18, 2018 at 9:49 AM, Eitan Adler <lists@eitanadler.com> wrote:
> On 18 June 2018 at 00:44, Mikael Magnusson <mikachu@gmail.com> wrote:
>> On Mon, Jun 18, 2018 at 7:14 AM, Eitan Adler <lists@eitanadler.com> wrote:
>>> clang - add additional sanitizers
>>> both - add additional standards (basically, aliases)
>>> both - fix -flto
>>>
>>> Signed-off-by: Eitan Adler <lists@eitanadler.com>
>>> ---
>>>  Completion/Unix/Command/_gcc | 22 ++++++++++++++++++----
>>>  1 file changed, 18 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
>>> index a552bb2db..9690df79f 100644
>>> --- a/Completion/Unix/Command/_gcc
>>> +++ b/Completion/Unix/Command/_gcc
>>> @@ -338,16 +338,31 @@ h8/300)
>>>    ;;
>>>  esac
>>>
>>> +local -a sanitizers
>>>  if [[ "$service" = clang* ]]; then
>>>      args=(
>>>          $args
>>> -        -flto -emit-llvm
>>> +        "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
>>> +        -emit-llvm
>>>          "-Qunused-arguments[don't emit warning for unused driver arguments]"
>>>          --analyze
>>>          -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
>>>          -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
>>>          -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
>>>      )
>>> +    sanitizers=(
>>> +        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
>>> +        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
>>> +        nullability-return object-size pointer-overflow return unsigned-integer-overflow
>>> +        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
>>
>> Did you mean to add this list under the gcc case?
>
> No. Those are the list supported by clang. I didn't do a full audit,
> but gcc supports fewer of them. It may support more than the list I
> included, but this is not a regression.
>
> Its hard to test gcc since it just errors out with "/usr/local/bin/ld:
> cannot find -lubsan" when testing and I don't want to go down the
> rabbit hole of debugging that right now.

Well, you remove "thread" and add "memory" instead for gcc, and the
manpage does list all values supported by gcc.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] _gcc: Improve completer for _clang and _gcc
  2018-06-18 12:37     ` Mikael Magnusson
@ 2018-06-19  5:27       ` Eitan Adler
  0 siblings, 0 replies; 5+ messages in thread
From: Eitan Adler @ 2018-06-19  5:27 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

On 18 June 2018 at 05:37, Mikael Magnusson <mikachu@gmail.com> wrote:
> On Mon, Jun 18, 2018 at 9:49 AM, Eitan Adler <lists@eitanadler.com> wrote:
>> On 18 June 2018 at 00:44, Mikael Magnusson <mikachu@gmail.com> wrote:
>>> On Mon, Jun 18, 2018 at 7:14 AM, Eitan Adler <lists@eitanadler.com> wrote:
>>>> clang - add additional sanitizers
>>>> both - add additional standards (basically, aliases)
>>>> both - fix -flto
>>>>
>>>> Signed-off-by: Eitan Adler <lists@eitanadler.com>
>>>> ---
>>>>  Completion/Unix/Command/_gcc | 22 ++++++++++++++++++----
>>>>  1 file changed, 18 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
>>>> index a552bb2db..9690df79f 100644
>>>> --- a/Completion/Unix/Command/_gcc
>>>> +++ b/Completion/Unix/Command/_gcc
>>>> @@ -338,16 +338,31 @@ h8/300)
>>>>    ;;
>>>>  esac
>>>>
>>>> +local -a sanitizers
>>>>  if [[ "$service" = clang* ]]; then
>>>>      args=(
>>>>          $args
>>>> -        -flto -emit-llvm
>>>> +        "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
>>>> +        -emit-llvm
>>>>          "-Qunused-arguments[don't emit warning for unused driver arguments]"
>>>>          --analyze
>>>>          -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
>>>>          -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
>>>>          -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
>>>>      )
>>>> +    sanitizers=(
>>>> +        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
>>>> +        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
>>>> +        nullability-return object-size pointer-overflow return unsigned-integer-overflow
>>>> +        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
>>>
>>> Did you mean to add this list under the gcc case?
>>
>> No. Those are the list supported by clang. I didn't do a full audit,
>> but gcc supports fewer of them. It may support more than the list I
>> included, but this is not a regression.
>>
>> Its hard to test gcc since it just errors out with "/usr/local/bin/ld:
>> cannot find -lubsan" when testing and I don't want to go down the
>> rabbit hole of debugging that right now.
>
> Well, you remove "thread" and add "memory" instead for gcc,

That was a pure mistake. I intended to keep the original

> and the
> manpage does list all values supported by gcc.

Good to know. I see this was committed already, but perhaps let's move
it out of the conditional?


-- 
Eitan Adler


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-19  5:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18  5:14 [PATCH] _gcc: Improve completer for _clang and _gcc Eitan Adler
2018-06-18  7:44 ` Mikael Magnusson
2018-06-18  7:49   ` Eitan Adler
2018-06-18 12:37     ` Mikael Magnusson
2018-06-19  5:27       ` Eitan Adler

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).