Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ifdef out code which is not used#9491

Closed
dpelle wants to merge 1 commit intovim:masterfrom
dpelle:ifdef-out-unused-code
Closed

ifdef out code which is not used#9491
dpelle wants to merge 1 commit intovim:masterfrom
dpelle:ifdef-out-unused-code

Conversation

@dpelle
Copy link
Member

@dpelle dpelle commented Jan 8, 2022

ifdef out code which is not used.

Unused function were found by compiling and linking with gcc options -fdata-sections -ffunction-sections -Wl,--gc-sections,--print-gc-sections. gcc then reports unused functions at link time. I built vim with tiny/small/normal/big/huge features, with various guis and disabled unused code.

Not done:

  • many symbols could be ifdef out in errors.h. I can do it as a separate PR if deemed useful enough
  • many symbols are also unused in xdiff/*.c as when FEAT_DIFF is not enabled.
  • for a few symbols, the expression to disable symbols could be too complex so I did not disable them.

@codecov
Copy link

codecov bot commented Jan 8, 2022

Codecov Report

Merging #9491 (3323cdd) into master (d844862) will increase coverage by 0.32%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9491      +/-   ##
==========================================
+ Coverage   90.08%   90.40%   +0.32%     
==========================================
  Files         154      154              
  Lines      173452   173439      -13     
==========================================
+ Hits       156251   156796     +545     
+ Misses      17201    16643     -558     
Flag Coverage Δ
huge-clang-none 89.42% <ø> (+<0.01%) ⬆️
huge-gcc-none 89.86% <ø> (+<0.01%) ⬆️
huge-gcc-testgui 88.44% <ø> (?)
huge-gcc-unittests 2.45% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/alloc.c 89.51% <ø> (ø)
src/buffer.c 92.64% <ø> (+2.30%) ⬆️
src/charset.c 89.80% <ø> (ø)
src/clipboard.c 83.78% <ø> (+0.73%) ⬆️
src/cmdhist.c 97.02% <ø> (ø)
src/crypt.c 85.00% <ø> (ø)
src/edit.c 93.39% <ø> (+0.68%) ⬆️
src/eval.c 96.62% <ø> (+0.36%) ⬆️
src/evalbuffer.c 97.00% <ø> (ø)
src/evalfunc.c 96.71% <ø> (+0.63%) ⬆️
... and 66 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d844862...3323cdd. Read the comment docs.

@brammool
Copy link
Contributor

brammool commented Jan 8, 2022

Thanks for looking into this. When moving messages to errors.h I only added the most obvious #ifdefs. I was wondering what the best way was to do the rest. If you can do this with gcc that would be best.

@brammool brammool closed this in 748b308 Jan 8, 2022
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 14, 2022
Problem:    Various code not used when features are disabled.
Solution:   Add #ifdefs. (Dominique Pellé, closes vim/vim#9491)

vim/vim@748b308

N/A patches for version.c:

vim-patch:8.2.2186: Vim9: error when using 'opfunc'

Problem:    Vim9: error when using 'opfunc'.
Solution:   Do not expect a return value from 'opfunc'. (closes vim/vim#7510)

vim/vim@5b3d1bb
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 14, 2022
Problem:    Various code not used when features are disabled.
Solution:   Add #ifdefs. (Dominique Pellé, closes vim/vim#9491)

vim/vim@748b308

N/A patches for version.c:

vim-patch:8.2.2186: Vim9: error when using 'opfunc'

Problem:    Vim9: error when using 'opfunc'.
Solution:   Do not expect a return value from 'opfunc'. (closes vim/vim#7510)

vim/vim@5b3d1bb
zeertzjq added a commit to neovim/neovim that referenced this pull request Nov 14, 2022
…21049)

Problem:    Various code not used when features are disabled.
Solution:   Add #ifdefs. (Dominique Pellé, closes vim/vim#9491)

vim/vim@748b308

N/A patches for version.c:

vim-patch:8.2.2186: Vim9: error when using 'opfunc'

Problem:    Vim9: error when using 'opfunc'.
Solution:   Do not expect a return value from 'opfunc'. (closes vim/vim#7510)

vim/vim@5b3d1bb
yesean pushed a commit to yesean/neovim that referenced this pull request Mar 25, 2023
…eovim#21049)

Problem:    Various code not used when features are disabled.
Solution:   Add #ifdefs. (Dominique Pellé, closes vim/vim#9491)

vim/vim@748b308

N/A patches for version.c:

vim-patch:8.2.2186: Vim9: error when using 'opfunc'

Problem:    Vim9: error when using 'opfunc'.
Solution:   Do not expect a return value from 'opfunc'. (closes vim/vim#7510)

vim/vim@5b3d1bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants