[Nauty] On noreturn
Jerry James
loganjerry at gmail.com
Sat Apr 27 02:49:18 AEST 2024
Regarding the mailing list thread "nauty and Traces in modern C++"
from February, we have encountered the issue with the NORET_ATTR
definition while building Fedora packages. So far, I have forced its
definition to __attribute__((noreturn)), since all of the packages are
built with gcc or g++. The issue is that, prior to C23 and C++23, C
and C++ compilers need to see different definitions, so a single
#define cannot suffice. How about removing the configure.ac code that
determines the NORET_ATTR definition, and replacing the NORET_ATTR
#define in nauty-h.in with this?
#if (defined(__cplusplus) && __cplusplus >= 202302L) ||
(!defined(__cplusplus) && __STDC_VERSION__ >= 202311L)
#define NORET_ATTR [[noreturn]]
#elif defined(__cplusplus) && __cplusplus >= 201103L
#define NORET_ATTR [[_Noreturn]]
#elif !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
#define NORET_ATTR _Noreturn
#elif defined(__GNUC__)
#define NORET_ATTR __attribute__((noreturn))
#elif defined(_MSC_VER)
#define NORET_ATTR __desclspec(noreturn)
#else
#define NORET_ATTR
#endif
Also, the alloc_error function calls exit(), so it should have the
NORET_ATTR attribute as well.
Regards,
--
Jerry James
http://www.jamezone.org/
More information about the Nauty
mailing list