#332 wrong vswprintf signature

closed-wont-fix
Jacek Caban
crt (84)
5
2013-02-20
2013-02-20
Jan Nijtmans
No

When compiling Tcl 8.6.0 with the latest mingw-w64 headers, the following warning arises. See below.

I traced this problem to the following commit, done by cjacek:
<http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64?view=revision&revision=5481>

The signature of vswprintf in the newly added swprintf.inl file is not correct: It's
second argument is size_t __count, but this functions doesn't have a count argument.

Regards,
Jan Nijtmans

=================================================================================
tclWinDde.c: In function ‘DdeSetServerName’:
tclWinDde.c:388:3: warning: passing argument 2 of ‘swprintf’ makes integer from pointer without a cast
/usr/i686-w64-mingw32/sys-root/mingw/include/swprintf.inl:30:5: note: expected ‘size_t’ but argument is of type ‘short unsigned int *’
tclWinDde.c:388:3: warning: passing argument 3 of ‘swprintf’ makes pointer from integer without a cast
/usr/i686-w64-mingw32/sys-root/mingw/include/swprintf.inl:30:5: note: expected ‘const wchar_t *’ but argument is of type ‘int’

Discussion

  • Jan Nijtmans
    Jan Nijtmans
    2013-02-20

    • assigned_to: nobody --> cjacek
     
  • Jonathan Yong
    Jonathan Yong
    2013-02-20

    Yes it does, the C99 spec requires it, this change was deliberate to support C++11.

    Define _CRT_NON_CONFORMING_SWPRINTFS to 1 to use the old behavior, likewise if you use MSVC.

     
  • Jonathan Yong
    Jonathan Yong
    2013-02-20

    • status: open --> closed-wont-fix
     
  • Jacek Caban
    Jacek Caban
    2013-02-20

    Instead of defining _CRT_NON_CONFORMING_SWPRINTFS, you may prefere use _swprintf instead of swprintf. There is nothing more we can do on mingw-w64 side, the non-backward compatible change was unavoidable.