Mongoose strtoll definition
On OpenSuse Leap 42.2 boxes we get the following error when compiling
/home/nberger/online/modules/midas/include/mongoose6.h:323:45: error: declaration of ‘long long int strtoll(const char*, char**, int)’ has a different exception specifier
long long strtoll(const char , char , int);
^
In file included from /usr/include/c++/4.8/cstdlib:72:0,
from /usr/include/c++/4.8/bits/stl_algo.h:59,
from /usr/include/c++/4.8/algorithm:62,
from /home/nberger/online/modules/midas/progs/mhttpd.cxx:13:
/usr/include/stdlib.h:209:22: error: from previous declaration ‘long long int strtoll(const char, char, int) throw ()’
extern long long int strtoll (const char *__restrict __nptr,
Commenting out the moongose definition fixes this, but I guess that is not a clean solution - I guess the define around it should be adapted, however no idea how…
Comments (6)
-
-
to unhide, the c++ compiler command line, run “make VERBOSE=1”. K.O.
-
reporter gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 4.8.5 (SUSE Linux)
grep strtoll /usr/include/c++/*/cstdlib:
#undef strtoll
(strtoll)(const char * __restrict, char ** __restrict, int) throw ();
using ::strtoll;
using ::__gnu_cxx::strtoll;the full output actually truncates at _nptr and then continues with a warning (also with VERBOSE)
And command line:
/usr/bin/c++ -D_LARGEFILE64_SOURCE -I/home/nberger/online/modules/midas/mscb/include -I/home/nberger/online/modules/midas/drivers -I/home/nberger/online/modules/midas/mxml -I/home/nberger/online/modules/midas/include -O3 -DNDEBUG -Wpedantic -Wall -Wextra -Wformat=2 -Wno-strict-aliasing -Wuninitialized -Wno-unused-function -DHAVE_MSCB -DHAVE_MONGOOSE6 -DMG_ENABLE_THREADS -DMG_DISABLE_CGI -DMG_ENABLE_SSL -std=c++11 -o CMakeFiles/mhttpd.dir/mhttpd.cxx.o -c /home/nberger/online/modules/midas/progs/mhttpd.cxx
Thanks for looking into this (btw, it goes away with newer OpenSuses…)
Nik
-
Ok. Reproduced. The problem is -Wpedantic. Please remove it. Two reasons:
- MIDAS is not written to the C++11 standard as your Makefile requires by specifying “-std=c++11 -Wpedantic”. Actually we cannot be “strictly c++11 or newer” as we have to support el6 (RHEL6/SL6/CentOS6) which has a pre-c++11 gcc.
- gcc 4.8.5 -Wpedantic is clearly broken, documentation says it is supposed to generate warnings, and here it generates a compile error. (I notice -Werror to promote warnings to errors is absent)
- -std=c++11 should probably also removed, but I think it makes no difference in practice.
K.O.
-
reporter Thanks for looking into this; removing -Wpedantic indeed helps. Bug thus is in gcc…
-
reporter - changed status to resolved
- Log in to comment
This is very strange. I would like to understand what is happening. I guess it is a mismatch between “throw” and “nothrow” definitions. The library strtoll() seems to be defined “throw()”. According to http://www.cplusplus.com/reference/cstdlib/strtoll/ is is supposed to be defined “nothrow()”. mongoose does not specify throwability, so why does my c++ compiler not complain about any mismatch? But yours does. I do not want to sweep this under the carpet, let’s try to understand this.
Please attach the following:
K.O.