@cindex @code{noreturn}
@cindex @code{stdnoreturn}
A "non-returning" function is a function which cannot return normally.
-It can transfer control only through @code{longjmp()}, @code{throw}
-(in C++), or similar mechanisms. The most prominent function of this
-class is the @code{abort} function. Non-returning functions are
+Instead of returning, it can loop forever, or it can transfer control via
+@code{abort}, @code{execvp}, @code{exit}, @code{longjmp}, @code{throw}
+(in C++), or similar mechanisms. Non-returning functions are
declared with a @code{void} return type.
It helps the compiler's ability to emit sensible warnings, following
data-flow analysis, to declare which functions are non-returning.
+It can also help generate more-efficient code, as there is no need
+to save a return address when calling a non-returning function.
-To decorate function declarations and function definitions, you can
-use the @code{_Noreturn} keyword. No modules are needed, as Gnulib
+Gnulib has multiple ways to support such a declaration''
+
+@itemize @bullet
+@item
+The @code{_Noreturn} keyword. No modules are needed, as Gnulib
arranges for @code{<config.h>} to define @code{_Noreturn} to an
appropriate replacement on platforms lacking it.
+Unfortunately, although this approach works for all current C versions,
+the @code{_Noreturn} keyword is obsolescent in C23.
-Gnulib has two modules that support such a declaration:
-
-@itemize @bullet
@item
The @samp{noreturn} module. It provides a way to put this declaration
at function declarations, at function definitions, and in function
@end itemize
@noindent
The include file is @code{<noreturn.h>}.
-
-@item
-The @samp{stdnoreturn} module. This can improve readability by
-letting you use @code{noreturn} instead of @code{_Noreturn};
-unfortunately, @code{noreturn} is a no-op on some platforms even
-though @code{_Noreturn} works on them. The include file is
-@code{<stdnoreturn.h>}.
@end itemize
-Which of the two modules to use? If the non-returning functions you
+Which of the approaches to use? If the non-returning functions you
have to declare are unlikely to be accessed through function pointers,
-you should use module @code{stdnoreturn}; otherwise the module
+you should use @code{_Noreturn}; otherwise the module
@code{noreturn} provides for better data-flow analysis and thus for
better warnings.
-For a detailed description of the @code{stdnoreturn} module, see
-@ref{stdnoreturn.h}.
+There is also an obsolete @code{stdnoreturn} module, but its use is no
+longer recommended.