[[ noreturn ]]

Andrew Melo andrew.melo@gmail.com
Fri May 29 21:05:00 GMT 2015


Hi,

On Fri, May 29, 2015 at 4:03 PM, Hotmail (ArbolOne) <ArbolOne@hotmail.ca> wrote:
> This is the actual code where the test takes place:
> void ascii_all [[ noreturn ]] () {
>    uint32_t ASCII_MAX = 255;
>    std::wstring a;
>
>    for (uint32_t i = 0; i <= ASCII_MAX; i++) {
>        a = i;
>        size_t w1/*, w2*/;
>        if ( i < 10 ) w1 = 3;
>        else w1 = 2;
>        wcout << setw( w1 )
>              << a
>              << setw( 6 )
>              << i;
>    }
>    wcout << L"\nThis are the ASCII character from 33 to 255" << std::endl;
> //    wcin.get();
> }

There's an implicit return at the end of the function. Why are you
trying to put the [[ noreturn ]] attribute?

>
> ------------------------------
> I downloaded MinGW-w64 from http://sourceforge.net/projects/mingw-w64/
> MinGW-w64 settings:
> Version 4.9.2 or later
> Architecture: x86_64
> Threads: win32
> Exception: seh
>
> Please let me know if you need anything else.
>
> Thanks a whole bunch for the help, I really appreciated.
>
>
>
>
>
>
>
>
> -----Original Message----- From: Martin Sebor
> Sent: Friday, May 29, 2015 12:43 PM
> To: Hotmail (ArbolOne) ; gcc-help Mailing List ; MinGW-64 Mailinglist
> Subject: Re: [[ noreturn ]]
>
>
> 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)
>



-- 
--
Andrew Melo



More information about the Gcc-help mailing list