Re: [fossil-users] Compiler warnings
On Tue, Aug 2, 2016 at 10:43 PM, Warren Youngwrote: > For example, VC++2013 lacked snprintf(), but VC++ has had _snprintf() > since at least 2003. Much harder to work around are missing format > specifiers, which were much improved by VC++2013 relative to prior versions. > fyi, if you find yourself in that boat wrt to the format specifiers, here's a drop-in impl of those missing features: https://code.google.com/archive/p/msinttypes/ https://github.com/chemeris/msinttypes -- - stephan beal http://wanderinghorse.net/home/stephan/ "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Aug 2, 2016, at 2:31 PM, Warren Youngwrote: > > On Aug 2, 2016, at 9:06 AM, Ron W wrote: >> >> This makes me wonder what the benefit of staying with the C89 specification >> instead of the C99 specification. Are there really still compilers in use >> that don't implement C99? > > Visual C++ didn’t get full C99 support until 2013. To clarify, by “full” I’m saying that with the release of VC++2013, the portability workarounds became no worse than for the wide deployed range of C compilers on POSIX systems. For example, VC++2013 lacked snprintf(), but VC++ has had _snprintf() since at least 2003. Much harder to work around are missing format specifiers, which were much improved by VC++2013 relative to prior versions. But, if you want to hold a hard line, that only goes to support my original point: Microsoft didn’t have ISO-compliant C99 support until VC++2015: https://msdn.microsoft.com/en-us/library/hh409293(v=vs.140).aspx#BK_CRT ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Aug 2, 2016, at 9:06 AM, Ron Wwrote: > > This makes me wonder what the benefit of staying with the C89 specification > instead of the C99 specification. Are there really still compilers in use > that don't implement C99? Visual C++ didn’t get full C99 support until 2013. Viewed one way, that’s three years old, but viewed another way, that’s just one major version back. Just like with GCC, there are still a lot of teams using older versions of Visual C++ on purpose. That then crates a market effect, so that all libraries that want to see widespread use also need to build on those older versions of Visual C++. More here: https://en.wikipedia.org/wiki/Visual_C%2B%2B#C99 https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/ ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Aug 2, 2016 9:12 AM, "Richard Hipp"wrote: > > On 8/2/16, Ron W wrote: > > > > Are there really still compilers in use > > that don't implement C99? > > > > I still build Fossil on a circa-2002 iBook. (See section 4 of > http://fossil-scm.org/fossil/doc/trunk/www/build.wiki). I do not know > if it implements C99 or not, but if I had to guess I would say "not". Plus SQLite is built on a number of obscure platforms where there may not be a selection of tools. What would C99 standards compliance give the project that it doesn't have with C89? > -- > D. Richard Hipp > d...@sqlite.org > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Tue, Aug 2, 2016 at 5:06 PM, Richard Hippwrote: > On 8/2/16, Johan Kuuse wrote: > > > > I would suggest adding the -Wextra flag > > anyway, to trap a lot of other existing warnings, and more important, > > future warnings. > > > > I care more about bugs than warnigns. Has -Wextra ever found a bug in > Fossil? > I cannot tell how bugs have been found in Fossil. But I dare to ask: Would it make any harm to add -Wextra? Theoretically, for example, -Wsign-compare could catch "unexpected behaviour" upon comparing. Practically, this is obviously not always the case. Anyway, if you find this all too pedantic, please ignore this thread. BR, Johan > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On 8/2/16, Ron Wwrote: > > Are there really still compilers in use > that don't implement C99? > I still build Fossil on a circa-2002 iBook. (See section 4 of http://fossil-scm.org/fossil/doc/trunk/www/build.wiki). I do not know if it implements C99 or not, but if I had to guess I would say "not". -- D. Richard Hipp d...@sqlite.org ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Tue, Aug 2, 2016 at 8:00 AM, Stephan Bealwrote: > > As i rememeber it, sqlite3 won't compile with strict C89 mode because of > its use of (long long), which is C99 (but is apparently implemented in all > C compilers when not running in strict C89 mode). > This makes me wonder what the benefit of staying with the C89 specification instead of the C99 specification. Are there really still compilers in use that don't implement C99? ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On 8/2/16, Johan Kuusewrote: > > I would suggest adding the -Wextra flag > anyway, to trap a lot of other existing warnings, and more important, > future warnings. > I care more about bugs than warnigns. Has -Wextra ever found a bug in Fossil? -- D. Richard Hipp d...@sqlite.org ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Tue, Aug 2, 2016 at 2:00 PM, Stephan Bealwrote: > > > On Tue, Aug 2, 2016 at 1:46 PM, Johan Kuuse wrote: > >> Thanks, now it works for both clang and gcc, with the added flags to >> Makefile: >> >> TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 >> -Wall* -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H >> >> Is there any special reason for *not* using the -Wextra and -Werror >> flags, like this? >> >> TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 >> -Wall** -Wextra** -Werror* -g -O2 -DHAVE_AUTOCONFIG_H >> -D_HAVE_SQLITE_CONFIG_H >> > > As i rememeber it, sqlite3 won't compile with strict C89 mode because of > its use of (long long), which is C99 (but is apparently implemented in all > C compilers when not running in strict C89 mode). > > Yes, you are right, it is because of the usage of (long long). The ,included by sha.c, also uses (long long), so even if looking for a workaround for this in sqlite3.h, the (long long) warning will still be there. What about this? TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 -Wall** -Wextra** -Werror **-Wno-long-long* -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H At the moment, adding -Wextra -Wno-long-long, I get 320 warnings all in all, but only 3 different types of warnings: -Wmissing-field-initializers -Wsign-compare -Wunused-parameter Maybe I am too pedantic, but I would suggest adding the -Wextra flag anyway, to trap a lot of other existing warnings, and more important, future warnings. BR, Johan > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of > those who insist on a perfect world, freedom will have to do." -- Bigby Wolf > > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > > ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
On Tue, Aug 2, 2016 at 1:46 PM, Johan Kuusewrote: > Thanks, now it works for both clang and gcc, with the added flags to > Makefile: > > TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 > -Wall* -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H > > Is there any special reason for *not* using the -Wextra and -Werror flags, > like this? > > TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 > -Wall** -Wextra** -Werror* -g -O2 -DHAVE_AUTOCONFIG_H > -D_HAVE_SQLITE_CONFIG_H > As i rememeber it, sqlite3 won't compile with strict C89 mode because of its use of (long long), which is C99 (but is apparently implemented in all C compilers when not running in strict C89 mode). -- - stephan beal http://wanderinghorse.net/home/stephan/ "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
Thanks, now it works for both clang and gcc, with the added flags to Makefile: TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 -Wall* -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H Is there any special reason for *not* using the -Wextra and -Werror flags, like this? TCCFLAGS =-DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include *-std=c89 -Wall** -Wextra** -Werror* -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H BR, Johan On Tue, Aug 2, 2016 at 10:47 AM, Richard Hippwrote: > Please try again with the latest code from trunk. > > On 8/2/16, Johan Kuuse wrote: > > Hi, > > > > In trunk (f475b943eb), I get a compiler warning when I use clang with > the > > default Makefile: > > > > > > cc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include-g > > -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o > bld/fshell.o > > -c bld/fshell_.c > > ./src/fshell.c:109:7: warning: implicit declaration of function 'waitpid' > > is invalid in C99 [-Wimplicit-function-declaration] > > waitpid(childPid, , 0); > > ^ > > > > I don't get that warning by default using gcc. Anyway, I can reproduce it > > with the added flag -Wall, which also gives the following warning: > > > > gcc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include -Wall > > -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o > > bld/user.o -c bld/user_.c > > ./src/user.c: In function 'prompt_for_passphrase': > > ./src/user.c:191:15: warning: unused variable 'zSecure' > [-Wunused-variable] > >const char *zSecure; > >^ > > > > BR, > > Johan > > > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Compiler warnings
Please try again with the latest code from trunk. On 8/2/16, Johan Kuusewrote: > Hi, > > In trunk (f475b943eb), I get a compiler warning when I use clang with the > default Makefile: > > > cc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include-g > -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o bld/fshell.o > -c bld/fshell_.c > ./src/fshell.c:109:7: warning: implicit declaration of function 'waitpid' > is invalid in C99 [-Wimplicit-function-declaration] > waitpid(childPid, , 0); > ^ > > I don't get that warning by default using gcc. Anyway, I can reproduce it > with the added flag -Wall, which also gives the following warning: > > gcc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include -Wall > -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o > bld/user.o -c bld/user_.c > ./src/user.c: In function 'prompt_for_passphrase': > ./src/user.c:191:15: warning: unused variable 'zSecure' [-Wunused-variable] >const char *zSecure; >^ > > BR, > Johan > -- D. Richard Hipp d...@sqlite.org ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[fossil-users] Compiler warnings
Hi, In trunk (f475b943eb), I get a compiler warning when I use clang with the default Makefile: cc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include-g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o bld/fshell.o -c bld/fshell_.c ./src/fshell.c:109:7: warning: implicit declaration of function 'waitpid' is invalid in C99 [-Wimplicit-function-declaration] waitpid(childPid, , 0); ^ I don't get that warning by default using gcc. Anyway, I can reproduce it with the added flag -Wall, which also gives the following warning: gcc -I. -I./src -Ibld -DFOSSIL_DYNAMIC_BUILD=1 -I/usr/local/include -Wall -g -O2 -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H -O2 -pipe -o bld/user.o -c bld/user_.c ./src/user.c: In function 'prompt_for_passphrase': ./src/user.c:191:15: warning: unused variable 'zSecure' [-Wunused-variable] const char *zSecure; ^ BR, Johan ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[fossil-users] compiler warnings
Cross-compiling for Windows using mingw32 gcc 4.8.2 ( -O3 -Wall ) I get: ./src/sqlite3.c: In function 'balance': ./src/sqlite3.c:57557:22: warning: array subscript is above array bounds [-Warray-bounds] pOld = apCopy[++j]; and ./src/th.c: In function 'Th_ListAppend': ./src/th.c:194:5: warning: assuming signed overflow does not occur when assuming that (X + c) = X is always true [-Wstrict-overflow] if( nReqpBuffer-nBufAlloc ){ ^ -- For confidential messages, please use my GnuPG key http://ronware.org/gpg_key.html signature.asc Description: OpenPGP digital signature ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users