On Fri, Sep 29, 2017 at 11:58 AM, J Decker <d3c...@gmail.com> wrote: > > > On Fri, Sep 29, 2017 at 1:07 AM, Denis V. Razumovsky <t...@denis.im> wrote: > >> >> SQLite3.c:55734:10: warning: cast discards ‘__attribute__((noreturn))’ >> qualifier from pointer target type [-Wcast-qual] >> memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr)); >> >> 768 warnings “may change the sign of the result” like: >> >> SQLite3.c:19330:11: warning: conversion to ‘unsigned int’ from ‘int’ may >> change the sign of the result [-Wsign-conversion] >> >> 75 warnings “signed overflow” like: >> SQLite3.c:61116:3: warning: assuming signed overflow does not occur when >> reducing constant in comparison [-Wstrict-overflow] >> >> As a result I would like to recommend to build SQLite with all extra >> warning options. In total, I have counted unbelievable 2628 warnings of >> potential errors without any efforts from my side. >> >> > As for the above... those can be catastrophic; and I'm surprised there are > so many sign conversion warnings generated... >
I see; I wondered how it complied so cleanly; I don't enable a lot of no warning flags on my code... so there's these for MSVC :) #pragma warning(disable : 4054) #pragma warning(disable : 4055) #pragma warning(disable : 4100) #pragma warning(disable : 4127) #pragma warning(disable : 4130) #pragma warning(disable : 4152) #pragma warning(disable : 4189) #pragma warning(disable : 4206) #pragma warning(disable : 4210) #pragma warning(disable : 4232) #pragma warning(disable : 4244) #pragma warning(disable : 4305) #pragma warning(disable : 4306) #pragma warning(disable : 4702) #pragma warning(disable : 4706) I guess GCC by default is just quieter. > > >> 3. How to reproduce: >> >> a) amalgamation SQLite version 3.20.0 >> >> b) gcc version: >> $ gcc -v >> Using built-in specs. >> COLLECT_GCC=gcc >> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper >> Target: x86_64-linux-gnu >> Configured with: ../src/configure -v --with-pkgversion='Ubuntu >> 5.4.0-6ubuntu1~16.04.4' >> --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs >> --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ >> --prefix=/usr --program-suffix=-5 --enable-shared >> --enable-linker-build-id --libexecdir=/usr/lib >> --without-included-gettext --enable-threads=posix --libdir=/usr/lib >> --enable-nls --with-sysroot=/ --enable-clocale=gnu >> --enable-libstdcxx-debug --enable-libstdcxx-time=yes >> --with-default-libstdcxx-abi=new --enable-gnu-unique-object >> --disable-vtable-verify --enable-libmpx --enable-plugin >> --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk >> --enable-gtk-cairo >> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre >> --enable-java-home >> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 >> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 >> --with-arch-directory=amd64 >> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc >> --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 >> --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic >> --enable-checking=release --build=x86_64-linux-gnu >> --host=x86_64-linux-gnu --target=x86_64-linux-gnu >> Thread model: posix >> gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) >> >> с) Lubuntu 16.04 >> >> d) Files: >> $ ls >> main.c Makefile sqlite3.c sqlite3.h >> >> $ cat Makefile >> # Compiler flags >> # >> CC ?= cc >> >> CFLAGS += -pipe -std=c11 >> CFLAGS += -fbuiltin >> SQLITEFLAGS += -DSQLITE_THREADSAFE=0 >> SQLITEFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION >> CFLAGS += $(SQLITEFLAGS) >> EXE = sqlite_test >> STATIC = -static >> STRIP = -s >> >> WFLAGS += -Wall -Wextra -Wpedantic -Wshadow >> WFLAGS += -Wconversion -Wsign-conversion -Winit-self -Wunreachable-code >> -Wformat-y2k >> WFLAGS += -Wformat-nonliteral -Wformat-security -Wmissing-include-dirs >> WFLAGS += -Wswitch-default -Wtrigraphs -Wstrict-overflow=5 >> WFLAGS += -Wfloat-equal -Wundef -Wshadow >> WFLAGS += -Wbad-function-cast -Wcast-qual -Wcast-align >> WFLAGS += -Wwrite-strings >> WFLAGS += -Winline >> >> ifneq ($(CC), clang) >> WFLAGS += -Wlogical-op >> CFLAGS += -finline-functions >> CFLAGS += -flto >> # Perform a number of minor optimizations that are relatively expensive. >> CFLAGS += -fexpensive-optimizations >> # Attempt to remove redundant extension instructions. This is especially >> helpful for the x86-64 architecture, which implicitly zero-extends in >> 64-bit registers after writing to their lower 32-bit half. >> CFLAGS += -free >> endif >> >> # >> # Project files >> # >> SRCS = $(wildcard *.c) >> HDRS = $(wildcard *.h) >> # Exclude a file >> OBJS = $(SRCS:.c=.o) >> >> # >> # Release build settings >> # >> RELDIR = release >> RELEXE = $(RELDIR)/$(EXE) >> RELOBJS = $(addprefix $(RELDIR)/, $(OBJS)) >> RELCFLAGS = -O3 -funroll-loops -DNDEBUG >> RELCFLAGS += -march=native >> # GCC only options >> ifneq ($(CC), clang) >> RELWFLAGS += -Wsuggest-attribute=const -Wsuggest-attribute=pure >> -Wsuggest-attribute=noreturn -Wsuggest-attribute=format >> -Wmissing-format-attribute >> endif >> >> .PHONY: all clean release >> >> # Default build >> all: release >> >> # >> # Release rules >> # >> release: $(RELEXE) >> >> $(RELEXE): $(RELOBJS) >> $(CC) $(CFLAGS) $(WFLAGS) $(RELWFLAGS) $(RELCFLAGS) $(STATIC) >> $(STRIP) -o $(RELEXE) $^ $(LDFLAGS) $(RELLDFLAGS) $(TCMALLOC) >> echo "$(RELEXE) linked." >> >> $(RELDIR)/%.o: %.c $(HDRS) >> mkdir -p $(RELDIR) >> $(CC) -c $(CFLAGS) $(WFLAGS) $(RELWFLAGS) $(RELCFLAGS) -o $@ $< >> echo $<" compiled." >> >> >> clean: >> rm -rf $(RELEXE) $(RELOBJS) >> test -d $(RELDIR) && rm -d $(RELDIR) || true >> >> >> $ cat ./main.c >> #include "sqlite3.h" >> #include <stdio.h> >> >> int main(void){ >> >> printf("SQLite version: %s\n",sqlite3_libversion()); >> >> return 0; >> >> } >> >> e) Run: >> $ ./release/sqlite_test >> SQLite version: 3.21.0 >> >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >> > > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users