On 21.04.2012 23:30, Caolán McNamara wrote:
On Sat, 2012-04-21 at 15:50 +0200, David Ostrovsky wrote:
Hi,

I'm getting build errors in crashrep and extensions modules (whith
enabled --enable-werror option).
With these patches the warnings/errors are fixed.
Looks good, pushed, thanks for these.

I wonder why *I* didn't see them before though seeing as I build with
-Werror. crashrep is disabled by default, so that's understandable, but
the scanner stuff in extensions is built by default and I've got...

export CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4"
export CXXFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4"
export ARCH_FLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4"

in my (Fedora 16) environment to generally get those extra warnings (I
thought). I knew that e.g. Ubuntu configured gcc to add some extra
warnings etc by default, but I had thought the above covered those
additions. Wonder what I'm missing to get your warnings ?, i.e. what's
your compiler version and distro ?
make -p extensions | grep T_CXXFLAGS
[...]
T_CXXFLAGS := -Wall -Wendif-labels -Wextra -fmessage-length=0 -fno-common -pipe -fPIC -Wshadow -Wsign-promo -Woverloaded-virtual -Wnon-virtual-dtor -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++0x

make -p extensions | grep gb_CXXFLAGS_WERROR
[...]
gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR
$(call gb_Helper_abbreviate_dirs, mkdir -p $(dir $(1)) $(dir $(4)) && $(gb_CXX) $(DEFS) $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) $(T_CXXFLAGS) $(if $(WARNINGS_NOT_ERRORS),,$(gb_CXXFLAGS_WERROR)) -c $(3) -o $(1) -MMD -MT $(1) -MP -MF $(4) -I$(dir $(3)) $(INCLUDE_STL) $(INCLUDE))


errors without the patch are:

/home/david/projects/libreoffice-core/git/libo/extensions/source/scanner/sane.cxx: In member function 'sal_Bool Sane::Start(BitmapTransporter&)': /home/david/projects/libreoffice-core/git/libo/extensions/source/scanner/sane.cxx:817:72: error: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result] /home/david/projects/libreoffice-core/git/libo/extensions/source/scanner/sane.cxx: In function 'sal_uInt8 _ReadValue(FILE*, int)': /home/david/projects/libreoffice-core/git/libo/extensions/source/scanner/sane.cxx:527:34: error: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result] /home/david/projects/libreoffice-core/git/libo/extensions/source/scanner/sane.cxx:531:30: error: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result]
cc1plus: all warnings being treated as errors

/home/david/projects/libreoffice-core/git/libo/extensions/source/nsplugin/source/npshell.cxx: In function 'void NPP_StreamAsFile(NPP, NPStream*, const char*)': /home/david/projects/libreoffice-core/git/libo/extensions/source/nsplugin/source/npshell.cxx:775:38: error: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Werror=unused-result]
cc1plus: all warnings being treated as errors


the full command is:

[ build CXX ] extensions/source/scanner/sane.cxx
S=/home/david/projects/libreoffice-core/git/libo && O=$S/solver/unxlngx6.pro && W=$S/workdir/unxlngx6.pro && mkdir -p $W/CxxObject/extensions/source/scanner/ $W/Dep/CxxObject/extensions/source/scanner/ && /usr/bin/ccache g++ -DCPPU_ENV=gcc3 -DENABLE_GRAPHITE -DENABLE_GTK -DGCC -DGXX_INCLUDE_PATH=/usr/include/c++/4.6 -DHAVE_GCC_VISIBILITY_FEATURE -DHAVE_THREADSAFE_STATICS -DLINUX -DNDEBUG -DOPTIMIZE -DOSL_DEBUG_LEVEL=0 -DSOLAR_JAVA -DSUPD=360 -DUNIX -DUNX -DX86_64 -D_PTHREADS -D_REENTRANT -Wall -Wendif-labels -Wextra -fmessage-length=0 -fno-common -pipe -fPIC -Wshadow -Wsign-promo -Woverloaded-virtual -Wnon-virtual-dtor -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++0x -DEXCEPTIONS_ON -fexceptions -fno-enforce-eh-specs -O2 -Werror -DLIBO_WERROR -c $S/extensions/source/scanner/sane.cxx -o $W/CxxObject/extensions/source/scanner/sane.o -MMD -MT $W/CxxObject/extensions/source/scanner/sane.o -MP -MF $W/Dep/CxxObject/extensions/source/scanner/sane.d -I$S/extensions/source/scanner/ -I$O/inc/external -I$O/inc -I$S/solenv/inc -I/usr/lib/jvm/java-6-sun-1.6.0.26/include -I/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux -I/usr/lib/jvm/java-6-sun-1.6.0.26/include/native_threads/include -I$W/UnoApiHeadersTarget/udkapi/normal -I$W/UnoApiHeadersTarget/offapi/normal


OS: Ubuntu oneiric, 11.10,
Compiler: gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

For the second patch I added a follow up commit of
e37ae322b07a02714b22cb663e1d7ab4f2072730 to fill in the "todos". e.g. I
reckon it's best to compare how many bytes/members were written/read
with write/read fread/fwrite vs what was requested to detect partial
failure short read/write as well as the added detection of out and out
utter failure.



Ciao
David
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to