This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [[ noreturn ]]
- From: Martin Sebor <msebor at redhat dot com>
- To: "Hotmail (ArbolOne)" <ArbolOne at hotmail dot ca>, gcc-help Mailing List <gcc-help at gcc dot gnu dot org>, MinGW-64 Mailinglist <mingw-w64-public at lists dot sourceforge dot net>
- Date: Fri, 29 May 2015 10:43:19 -0600
- Subject: Re: [[ noreturn ]]
- Authentication-results: sourceware.org; auth=none
- References: <SNT150-DS8E262EAC98F643CECCCE2BAC90 at phx dot gbl>
On 05/28/2015 08:46 PM, Hotmail (ArbolOne) wrote:
Hi!
When using this the [[ noreturn ]] attribute like this: - void f [[
noreturn ]] (); - I get a warning that reads:
warning: 'noreturn' function does return
( http://www.stroustrup.com/C++11FAQ.html#attributes )
What can I do to remove this warning?
I don't see a warning for the example with GCC 4.8, 4.9, or
5.1. If you do, it might help if you posted the version of
GCC you're using and the command line options (for example,
like I did below). You could also check Bugzilla for known
noreturn bugs (though I couldn't find anything relevant).
Martin
$ cat t.cpp && g++ -v && g++ -Wall -Wextra -c -pedantic -std=c++11 t.cpp
void f [[ noreturn ]] () { throw "error"; }
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ppc64-redhat-linux/4.8.3/lto-wrapper
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto
--enable-plugin --enable-initfini-array --disable-libgcj
--with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-ppc64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-ppc64-redhat-linux/cloog-install
--enable-gnu-indirect-function --enable-secureplt --with-long-double-128
--with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7
--with-tune-64=power7 --build=ppc64-redhat-linux
Thread model: posix
gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)