[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/8] Update snprintf.c
From: |
Ladislav Michl |
Subject: |
Re: [PATCH v2 3/8] Update snprintf.c |
Date: |
Fri, 7 Dec 2018 00:04:34 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Fabrizio,
On Thu, Dec 06, 2018 at 11:34:31PM +0100, Fabrizio Gennari wrote:
> A possible (unconfirmed) explanation of why it broke. Maybe old version of
> MinGW, from the time common/snprintf.c was added, did not define vsnprintf
> and snprintf, but only _vsnprintf and _snprintf. Now things break because
> vsnprintf and snprintf clash with those in common/snprintf.c (and
> common/snprintf.c is included in the build because vsnprintf and snprintf
> provided by Windows are not C99-compliant). In the new version of
> common/snprintf.c from Samba there is no such clash any more.
>
> If making Samba's version of snprintf part of gnokii API is unacceptable,
> the only alternative is that both gnokii and libgnokii link
> common/snprintf.c directly, which will result in some code duplication in
> the resulting binaries, but sounds like the best compromise.
Please browse thru:
http://git.savannah.gnu.org/cgit/gnokii.git/log/common/snprintf.c
to see GNOKII_API story... (which also shows why is good explanation
in commit log important)
Daniele, you did quite a good whitespace cleanup in this very file, which
is lost by this update. I do still think it is worth updating, see samba's
git for changes.
I suggest sending patch to samba with white space cleanup, so it is
preserved in the source (and I'll do it). Hope that helps at least
partially.
ladis
> Il 06-12-18 23:14, Fabrizio Gennari ha scritto:
> >
> > Il 04-12-18 23:34, Daniele Forsi ha scritto:
> > > Il giorno mar 4 dic 2018 alle ore 22:22 Ladislav Michl ha scritto:
> > > > From: Fabrizio Gennari <address@hidden>
> > > >
> > > > Update to the latest version from Samba's repository,
> > > > https://git.samba.org/?p=samba.git;a=blob;f=lib/replace/snprintf.c;hb=9f03cf91235641d017e31abc3856df994e6d1cf2
> > > >
> > > why?
> > > Did anybody report a bug against the current snprintf in libgnokii?
> > >
> > No bug, it just did not compile (details about the error is below).
> > Since the old version was taken from Samba, and the new version taken
> > from Samba compiled, it was a good reason to replace the old version
> > with the new one.
> >
> > Regards,
> >
> > Fabrizio
> >
> > /bin/bash ../libtool --tag=CC --mode=compile i686-w64-mingw32-gcc
> > -DLOCALEDIR=\"/usr/local/share/locale\" -DCOMPILING_LIBGNOKII -I.
> > -I../include -DLIBDIR="\"/usr/local/lib\"" -I../include -mms-bitfields
> > -I/home/fabrizio/dev/gnokii/glibwin/include/glib-2.0
> > -I/home/fabrizio/dev/gnokii/glibwin/lib/glib-2.0/include -g -O2 -Wall
> > -Wno-pointer-sign -fvisibility=hidden -fno-strict-aliasing -MT
> > libgnokii_la-snprintf.lo -MD -MP -MF .deps/libgnokii_la-snprintf.Tpo -c
> > -o libgnokii_la-snprintf.lo `test -f 'snprintf.c' || echo
> > './'`snprintf.c
> > libtool: compile: i686-w64-mingw32-gcc
> > -DLOCALEDIR=\"/usr/local/share/locale\" -DCOMPILING_LIBGNOKII -I.
> > -I../include -DLIBDIR=\"/usr/local/lib\" -I../include -mms-bitfields
> > -I/home/fabrizio/dev/gnokii/glibwin/include/glib-2.0
> > -I/home/fabrizio/dev/gnokii/glibwin/lib/glib-2.0/include -g -O2 -Wall
> > -Wno-pointer-sign -fvisibility=hidden -fno-strict-aliasing -MT
> > libgnokii_la-snprintf.lo -MD -MP -MF .deps/libgnokii_la-snprintf.Tpo -c
> > snprintf.c -DDLL_EXPORT -DPIC -o .libs/libgnokii_la-snprintf.o
> > snprintf.c:772:5: error: redefinition of ‘vsnprintf’
> > int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
> > ^~~~~~~~~
> > In file included from ../include/compat.h:22:0,
> > from snprintf.c:62:
> > /usr/share/mingw-w64/include/stdio.h:558:7: note: previous definition of
> > ‘vsnprintf’ was here
> > int vsnprintf (char * __restrict__ __stream, size_t __n, const char *
> > __restrict__ __format, va_list __local_argv)
> > ^~~~~~~~~
> > snprintf.c:787:5: error: redefinition of ‘snprintf’
> > int snprintf(char *str,size_t count,const char *fmt,...)
> > ^~~~~~~~
> > In file included from ../include/compat.h:22:0,
> > from snprintf.c:62:
> > /usr/share/mingw-w64/include/stdio.h:569:5: note: previous definition of
> > ‘snprintf’ was here
> > int snprintf (char * __restrict__ __stream, size_t __n, const char *
> > __restrict__ __format, ...)
> > ^~~~~~~~
> > make[2]: *** [Makefile:866: libgnokii_la-snprintf.lo] Error 1
> > make[2]: uscita dalla directory "/home/fabrizio/dev/gnokii/common"
> > make[1]: *** [Makefile:927: all-recursive] Error 1
> > make[1]: uscita dalla directory "/home/fabrizio/dev/gnokii/common"
> > make: *** [Makefile:501: all-recursive] Error 1
> >
> >
> > _______________________________________________
> > gnokii-users mailing list
> > address@hidden
> > https://lists.nongnu.org/mailman/listinfo/gnokii-users
>
> _______________________________________________
> gnokii-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/gnokii-users
[PATCH v2 4/8] Test for number of mkdir() arguments, Ladislav Michl, 2018/12/04
[PATCH 8/8] Remove cfg_foreach, Ladislav Michl, 2018/12/04
[PATCH v2 6/8] Refactor devices build, Ladislav Michl, 2018/12/04
[PATCH v2 7/8] Use posix_spawn to run external scripts, Ladislav Michl, 2018/12/04
[PATCH 5/8] Fix compat.c compilation with mingw32, Ladislav Michl, 2018/12/04