chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.71k stars 1.19k forks source link

Warnings: static storage duration may throw an exception that cannot be caught [cert-err58-cpp] #421

Open ClausKlein opened 4 years ago

ClausKlein commented 4 years ago

When I check the asio standalone lib with clang-tidy this is the result:

egrep '\b(warning|error):' run-clang-tidy.log | perl -pe 's/(^.*) (warning|error):/\2/' | sort -u
warning 'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead [cert-err34-c]
warning do not define a C-style variadic function; consider using a function parameter pack or currying instead [cert-dcl50-cpp]
warning initialization of 'addrinfo_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'id' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'instance_' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'misc_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'netdb_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'ssl_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'stream_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'system_category' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning initialization of 'top_' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
warning move constructor initializes class member by calling a copy constructor [cert-oop11-cpp]
warning operator=() should return 'posix_tss_ptr&' [misc-unconventional-assign-operator]
warning operator=() should return 'tss_ptr&' [misc-unconventional-assign-operator]
warning overloaded 'operator++' returns a non-constant object instead of a constant object type [cert-dcl21-cpp]
warning overloaded 'operator--' returns a non-constant object instead of a constant object type [cert-dcl21-cpp]
Claus-MBP:asio clausklein$ 
ClausKlein commented 3 years ago

the main question is: is this a real issue?

see https://wiki.sei.cmu.edu/confluence/display/cplusplus/ERR58-CPP.+Handle+all+exceptions+thrown+before+main()+begins+executing