On 08-Apr.-2018 21:08, Bram Moolenaar wrote:
Patch 8.0.1677
Problem:    No compiler warning for wrong format in vim_snprintf().
Solution:   Add printf attribute for gcc.  Fix reported problems.
Files:      src/vim.h, src/proto.h, src/eval.c, src/fileio.c, src/mbyte.c,
             src/ops.c, src/spellfile.c, src/undo.c, src/json.c


After this patch (and 8.0.1679 as well) mingw (32 and 64 bit) throws these warnings:
<snip>

gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF 
-DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX
 -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD 
-DFEAT_MBYTE -pipe -march=native -Wall
 -fomit-frame-pointer -freg-struct-return -s eval.c -o gobjnative/eval.o
eval.c: In function 'get_tv_string_buf_chk':
eval.c:7107:46: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)buf, NUMBUFLEN, "%lld",
                                              ^
eval.c:7107:43: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)buf, NUMBUFLEN, "%lld",
                                           ^~~~~~

...
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF 
-DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX
 -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD 
-DFEAT_MBYTE -pipe -march=native -Wall
 -fomit-frame-pointer -freg-struct-return -s fileio.c -o gobjnative/fileio.o
fileio.c: In function 'msg_add_lines':
fileio.c:5318:12: warning: unknown conversion type character 'l' in format 
[-Wformat=]
   "%ldL, %lldC", lnum, (long long)nchars);
            ^
fileio.c:5318:3: warning: too many arguments for format [-Wformat-extra-args]
   "%ldL, %lldC", lnum, (long long)nchars);
   ^~~~~~~~~~~~~
In file included from fileio.c:14:0:
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
fileio.c:5330:7: note: in expansion of macro '_'
       _("%lld characters"), (long long)nchars);
       ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
fileio.c:5330:7: note: in expansion of macro '_'
       _("%lld characters"), (long long)nchars);
       ^

...
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF 
-DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX
 -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD 
-DFEAT_MBYTE -pipe -march=native -Wall
 -fomit-frame-pointer -freg-struct-return -s json.c -o gobjnative/json.o
json.c: In function 'json_encode_item':
json.c:219:49: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld",
                                                 ^
json.c:219:46: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld",
                                              ^~~~~~

...
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF 
-DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX
 -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD 
-DFEAT_MBYTE -pipe -march=native -Wall
 -fomit-frame-pointer -freg-struct-return -s ops.c -o gobjnative/ops.o
ops.c: In function 'do_addsub':
ops.c:5979:47: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llu",
                                               ^
ops.c:5979:44: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llu",
                                            ^~~~~~
ops.c:5982:47: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llo",
                                               ^
ops.c:5982:44: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llo",
                                            ^~~~~~
ops.c:5985:47: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llX",
                                               ^
ops.c:5985:44: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llX",
                                            ^~~~~~
ops.c:5988:47: warning: unknown conversion type character 'l' in format 
[-Wformat=]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llx",
                                               ^
ops.c:5988:44: warning: too many arguments for format [-Wformat-extra-args]
      vim_snprintf((char *)buf2, NUMBUFLEN, "%llx",
                                            ^~~~~~
In file included from ops.c:15:0:
ops.c: In function 'cursor_pos_info':
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7505:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld 
Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7505:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld 
Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7505:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld 
Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7505:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld 
Bytes"),
        ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
ops.c:7505:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld 
Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
ops.c:7514:8: note: in expansion of macro '_'
        _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld 
of %lld Bytes"),
        ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7536:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7536:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7536:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7536:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"),
    ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
ops.c:7536:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
ops.c:7544:4: note: in expansion of macro '_'
    _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte 
%lld of %lld"),
    ^
vim.h:581:24: warning: unknown conversion type character 'l' in format 
[-Wformat=]
 # define _(x) ((char *)(x))
                        ^
ops.c:7558:8: note: in expansion of macro '_'
        _("(+%lld for BOM)"), (long long)bom_count);
        ^
vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args]
 # define _(x) ((char *)(x))
                        ^
ops.c:7558:8: note: in expansion of macro '_'
        _("(+%lld for BOM)"), (long long)bom_count);
        ^
</snip>

I have tried to come up with a patch that fixes them but I don't have anything 
yet.
Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui