RFC: bash completion

Martin Liška mliska@suse.cz
Tue Apr 24 15:00:00 GMT 2018


Hi.

Some time ago, I investigated quite new feature of clang which
is support of --autocomplete argument. That can be run from bash completion
script and one gets more precise completion hints:

http://blog.llvm.org/2017/09/clang-bash-better-auto-completion-is.html
https://www.youtube.com/watch?v=zLPwPdZBpSY

I like the idea and I would describe how is that better to current GCC completion
script sitting here:
https://github.com/scop/bash-completion/blob/master/completions/gcc

1) gcc -fsanitize=^ - no support for option enum values
2) gcc -fno-sa^ - no support for negative options
3) gcc --param=^ - no support for param names

These are main limitations I see. I'm attaching working prototype, which you
can test by installed GCC, setting it on $PATH and doing:
$ source gcc.sh

Then bash completion is provided via the newly added option. Some examples:

1)
$ gcc -fsanitize=
address                    bounds                     enum                       integer-divide-by-zero     nonnull-attribute          pointer-compare            return                     shift-base                 thread                     vla-bound
alignment                  bounds-strict              float-cast-overflow        kernel-address             null                       pointer-overflow           returns-nonnull-attribute  shift-exponent             undefined                  vptr
bool                       builtin                    float-divide-by-zero       leak                       object-size                pointer-subtract           shift                      signed-integer-overflow    unreachable                

2)
$ gcc -fno-ipa-
-fno-ipa-bit-cp         -fno-ipa-cp-alignment   -fno-ipa-icf            -fno-ipa-icf-variables  -fno-ipa-profile        -fno-ipa-pure-const     -fno-ipa-reference      -fno-ipa-struct-reorg   
-fno-ipa-cp             -fno-ipa-cp-clone       -fno-ipa-icf-functions  -fno-ipa-matrix-reorg   -fno-ipa-pta            -fno-ipa-ra             -fno-ipa-sra            -fno-ipa-vrp            

3)
$ gcc --param=lto-
lto-max-partition  lto-min-partition  lto-partitions    

4)
gcc --param lto-
lto-max-partition  lto-min-partition  lto-partitions     

The patch is quite lean and if people like, I will prepare a proper
patch submission. I know about some limitations that can be then
handled incrementally.

Thoughts?
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-First-version-of-prototype.patch
Type: text/x-patch
Size: 6620 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20180424/d7c7640e/attachment.bin>


More information about the Gcc mailing list