Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make emsg() take variable arguments #3302

Closed
wants to merge 2 commits into from
Closed

Conversation

ichizok
Copy link
Contributor

@ichizok ichizok commented Aug 9, 2018

I think current emsg() family is complicated.
i.e. emsg(), emsg2(), emsg3(), emsgn(), iemsg(), iemsg2(), iemsg()

This patch proposes to add emsgf() and iemsgf() which takes printf-like variable arguments,
and remain emsg() and iemsg() since they can omit formatting strings.

@codecov-io
Copy link

codecov-io commented Aug 9, 2018

Codecov Report

Merging #3302 into master will decrease coverage by 0.06%.
The diff coverage is 37.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3302      +/-   ##
==========================================
- Coverage   78.47%   78.41%   -0.07%     
==========================================
  Files         103      103              
  Lines      141822   141882      +60     
==========================================
- Hits       111298   111254      -44     
- Misses      30524    30628     +104
Impacted Files Coverage Δ
src/if_ruby.c 90.29% <ø> (ø) ⬆️
src/if_tcl.c 86.42% <ø> (ø) ⬆️
src/if_lua.c 85.33% <ø> (ø) ⬆️
src/mbyte.c 62.93% <ø> (ø) ⬆️
src/regexp.c 84.53% <ø> (ø) ⬆️
src/gui_gtk_x11.c 48.03% <0%> (-0.25%) ⬇️
src/hardcopy.c 65.85% <0%> (-0.49%) ⬇️
src/ex_getln.c 76.09% <0%> (ø) ⬆️
src/misc1.c 84.49% <0%> (ø) ⬆️
src/main.c 65.2% <0%> (ø) ⬆️
... and 55 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 8c8b8bb...33744ae. Read the comment docs.

@brammool
Copy link
Contributor

brammool commented Aug 9, 2018 via email

@ichizok ichizok changed the title Add emsgf() which can use variable arguments Make emsg() take variable arguments Jan 10, 2019
@ichizok
Copy link
Contributor Author

ichizok commented Jan 10, 2019

Updated patch.

  • Replace/Rename:

    • emsg() -> emsg1() (1 argument)
    • emsg2(), emsg3(), emsgn() -> emsg() (variable arguments)
      (also iemsg() family)
  • Remove EMSG macro, use emsg() directly

@brammool
Copy link
Contributor

brammool commented Jan 10, 2019 via email

@ichizok
Copy link
Contributor Author

ichizok commented Jan 11, 2019

Updated patch:

  • Rename: emsg2() / emsg3() / emsgn() -> semsg(),
    also iemsgX() -> siemsg()

@brammool
Copy link
Contributor

brammool commented Jan 11, 2019 via email

@ichizok ichizok force-pushed the fix/emsg-va branch 2 times, most recently from fc1efa6 to d42927e Compare January 12, 2019 19:33
@ichizok
Copy link
Contributor Author

ichizok commented Jan 12, 2019

Updated patch:

  • Use macro EMSG/IEMSG

Since semsg() takes a "char *" argument, it's weird that
smsg() takes a "char_u *" argument. While in most places we need a type
cast.

I intended to make consistency with the prototype of msg(). Will it be better to use "char *"?

@brammool
Copy link
Contributor

brammool commented Jan 12, 2019 via email

@ichizok ichizok force-pushed the fix/emsg-va branch 2 times, most recently from e1ef8e7 to f9328b2 Compare January 13, 2019 15:03
* Rename emsgX()/iemsgX() into semsg()/siemsg() and make them take
  variable arguments
* Remove EMSG macro
@ichizok
Copy link
Contributor Author

ichizok commented Jan 13, 2019

Currently emsg() takes the argument "char_u *" variable or string literal ("const char *"), so using "char *" argument needs always type cast. Therefore should take "const char *" argument.
But when using "const char *" argument, still need type-cast "const char *" for "char_u *" variable.

@ichizok
Copy link
Contributor Author

ichizok commented Jan 13, 2019

Additionally: I changed the type of smsg() 1st argument to "const char *"

@ichizok
Copy link
Contributor Author

ichizok commented Jan 13, 2019

When making emsg() (and msg()) take "const char *" argument, in their procedures some functions take "char_u *" argument so needs type-cast, a bit complicated.

@brammool brammool closed this in f9e3e09 Jan 13, 2019
@ichizok ichizok deleted the fix/emsg-va branch January 14, 2019 02:00
jamessan added a commit to jamessan/neovim that referenced this pull request Oct 23, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
jamessan added a commit to jamessan/neovim that referenced this pull request Oct 24, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
jamessan added a commit to jamessan/neovim that referenced this pull request Oct 24, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
jamessan added a commit to jamessan/neovim that referenced this pull request Oct 24, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
jamessan added a commit to jamessan/neovim that referenced this pull request Nov 1, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
lewis6991 pushed a commit to lewis6991/neovim that referenced this pull request Dec 12, 2021
Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            vim/vim#3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
vim/vim@f9e3e09
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.

3 participants