As you can see above, youcompleteme can not correctly complete sigaction struct which may have the following members(Of course I know that the sa_restorer element is obsolete and should not be used):
So, is there anything wrong with my youcompleteme? How to make it work correctly?
Note:What I really want to ask is why can't youcompleteme show me more members of sigaction like sa_hander for me but just sa_restorer,sa_mask and sa_flags.
Read carefully signal(7), signal-safety(7) and sigaction(2).
sa_restorer
is obsolete and you are forbidden to use it.So YouCompleteMe is correct (and clever!) in not showing it.
(your question should be: "How is YouCompleteMe clever enough to hide
sa_restorer
?")The more interesting question is why it does not show it while
sa_restorer
apparently appear in e.g./usr/include/x86_64-linux-gnu/bits/sigaction.h
, but this is a different question (and I don't know its answer). I won't be surprised if youcompleteme handed specifically standard functions (e.g. has some configuration files about them). BTW YouCompleteMe is free software or open source so you can study its source code.The type of
sa_restorer
is__sigrestore_t
(see/usr/include/asm-generic/signal.h
) and identifiers starting with underscores are reserved to the implementation and should not be used by user code so YouCompleteMe is perhaps skipping such fields or data. This is only a guess. Please check YouCompleteMe source code yourself (and perhaps also the code of other tools, such aslibclang
, used by it).On my Linux system,
sa_handler
is a macro, since/usr/include/x86_64-linux-gnu/bits/sigaction.h
(internally included from<signal.h>
) contains:I won't be surprised if YouCompleteMe don't bother showing all macros in completion menus. There are too many of them! This (only a guess) might explain why
sa_handler
is not explicitly proposed for completion.(perhaps if you type
siga.sa_
the completer could be more wise and proposesa_handler
but I did not try)Your
struct sigaction
is only what the documentation tells. The actual implementation is more complex. Study it if you want to understand then improve the behavior of YouCompleteMe. Propose a patch (by working on it a few weeks or months) to YouCompleteMe to improve its behavior.Your future patch on YouCompleteMe might handle specifically identifiers starting with underscores and preprocessor macros using them. That is an interesting project, but could take you a few months.