[Nauty] Compilation issue with g++: Change "_Noreturn" to "__attribute__((__noreturn__))"

Lluís Alemany Puig lluis.alemany.puig at upc.edu
Thu Jul 18 21:16:00 AEST 2024


Hello,

I've just updated my version of nauty from 2_8_6 to 2_8_8 in my C++ 
project and it no longer compiles. The issue is due to the attribute 
_Noreturn (used to define NORET_ATTR and, in turn used to define 
gt_abort) which is not part of the C++ standard and g++ (version 11.4.0) 
does not accept it. I changed the definition of NORET_ATTR in nauty.h from

    #define NORET_ATTR _Noreturn

to

    #define NORET_ATTR __attribute__((__noreturn__))

and now g++ no longer complains. These two definitions are equivalent 
(see this question 
<https://stackoverflow.com/questions/28552467/is-there-a-way-to-use-gcc-attribute-noreturn-and-stdnoreturn-h-sanely-i> 
in stackoverflow). ChatGPT tells me that as long as I use -std=c++17 (or 
some other standard newer than C++11, which I already do) the code 
should compile, but I could not get it to work this way. Maybe _Noreturn 
clashes with some other necessary flag that I use in my project.

I would like to ask nauty's developers to change '_Noreturn' to 
'__attribute__((__noreturn__))' all C++ programmers out there who use Nauty.

Best,

Lluís


More information about the Nauty mailing list