bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] stdnoreturn: deprecate
@ 2022-12-24  9:35 Paul Eggert
  2022-12-27 10:14 ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2022-12-24  9:35 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Paul Eggert

C23 says <stdnoreturn.h> is obsolescent, so deprecate the
stdnoreturn module.  I don't think it was being used anyway
as it had too many problems.
* modules/stdnoreturn: Mark as obsolete.
---
 ChangeLog                          |  8 +++++++
 NEWS                               |  3 +++
 doc/noreturn.texi                  | 35 ++++++++++++++----------------
 doc/posix-headers/stdnoreturn.texi |  2 ++
 lib/stdnoreturn.in.h               |  4 +++-
 modules/stdnoreturn                |  6 +++++
 6 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b6c6cf98e..91370af964 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	stdnoreturn: deprecate
+	C23 says <stdnoreturn.h> is obsolescent, so deprecate the
+	stdnoreturn module.  I don't think it was being used anyway
+	as it had too many problems.
+	* modules/stdnoreturn: Mark as obsolete.
+
 2022-12-23  Paul Eggert  <eggert@cs.ucla.edu>
 
 	file-has-acl: improve recent NFSv4 support
diff --git a/NEWS b/NEWS
index bc620ce86a..dd2374c4fd 100644
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2022-12-24  stdnoreturn     This module is deprecated.  Use _Noreturn
+                            or the noreturn module instead.
+
 2022-12-21  ctime           This module is deprecated.  Use localtime_r
                             and strftime (or even sprintf) instead.
 
diff --git a/doc/noreturn.texi b/doc/noreturn.texi
index a3a394409c..ad0a286f4a 100644
--- a/doc/noreturn.texi
+++ b/doc/noreturn.texi
@@ -15,22 +15,26 @@
 @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
@@ -44,20 +48,13 @@ definitions.
 @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.
diff --git a/doc/posix-headers/stdnoreturn.texi b/doc/posix-headers/stdnoreturn.texi
index 3e1c5882db..ebe31ffc9f 100644
--- a/doc/posix-headers/stdnoreturn.texi
+++ b/doc/posix-headers/stdnoreturn.texi
@@ -22,6 +22,8 @@ MSVC/clang.
 Portability problems not fixed by Gnulib:
 @itemize
 @item
+@code{<stdnoreturn.h>} and the @code{noreturn} macro are obsolescent in C23.
+@item
 @code{<stdnoreturn.h>} cannot be #included in C++ mode on some platforms:
 FreeBSD 13.1.
 @item
diff --git a/lib/stdnoreturn.in.h b/lib/stdnoreturn.in.h
index d9e746699d..446e11b0b2 100644
--- a/lib/stdnoreturn.in.h
+++ b/lib/stdnoreturn.in.h
@@ -24,7 +24,9 @@
    References:
    ISO C11 (latest free draft
    <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
-   section 7.23 */
+   section 7.23
+
+   <stdnoreturn.h> is obsolescent in C23, so new code should avoid it.  */
 
 /* The definition of _Noreturn is copied here.  */
 
diff --git a/modules/stdnoreturn b/modules/stdnoreturn
index 1ef894d51f..ce6b04a35e 100644
--- a/modules/stdnoreturn
+++ b/modules/stdnoreturn
@@ -1,6 +1,12 @@
 Description:
 A <stdnoreturn.h> that nearly conforms to ISO C11.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/stdnoreturn.in.h
 m4/stdnoreturn.m4
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] stdnoreturn: deprecate
  2022-12-24  9:35 [PATCH] stdnoreturn: deprecate Paul Eggert
@ 2022-12-27 10:14 ` Bruno Haible
  0 siblings, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2022-12-27 10:14 UTC (permalink / raw)
  To: bug-gnulib, Paul Eggert

Paul Eggert wrote:
> +	* modules/stdnoreturn: Mark as obsolete.

Here too, the classification of a module as "obsolete" is wrong,
because an obsolete module is one which has no effect on any
reasonable portability target.


2022-12-27  Bruno Haible  <bruno@clisp.org>

	stdnoreturn: Mark as deprecated, not obsolete. (Regression 2022-12-24.)
	* modules/stdnoreturn (Status): Remove.
	(Notice): Say that it is deprecated, not obsolete.
	* doc/noreturn.texi: Fix a typo.

diff --git a/doc/noreturn.texi b/doc/noreturn.texi
index ad0a286f4a..748d30ab30 100644
--- a/doc/noreturn.texi
+++ b/doc/noreturn.texi
@@ -25,7 +25,7 @@ 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.
 
-Gnulib has multiple ways to support such a declaration''
+Gnulib has multiple ways to support such a declaration:
 
 @itemize @bullet
 @item
diff --git a/modules/stdnoreturn b/modules/stdnoreturn
index ce6b04a35e..e283fd18fb 100644
--- a/modules/stdnoreturn
+++ b/modules/stdnoreturn
@@ -1,11 +1,9 @@
 Description:
 A <stdnoreturn.h> that nearly conforms to ISO C11.
 
-Status:
-obsolete
-
 Notice:
-This module is obsolete.
+The module 'stdnoreturn' is deprecated.
+New code should use the '_Noreturn' keyword or the 'noreturn' module.
 
 Files:
 lib/stdnoreturn.in.h





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] stdnoreturn: deprecate
  2022-12-27 18:59 [PATCH 0/6] build-aux/bootstrap that doesn't need to replace itself Paul Eggert
@ 2022-12-27 18:59 ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2022-12-27 18:59 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Paul Eggert

C23 says <stdnoreturn.h> is obsolescent, so deprecate the
stdnoreturn module.  I don't think it was being used anyway
as it had too many problems.
* modules/stdnoreturn: Mark as obsolete.
---
 ChangeLog                          |  8 +++++++
 NEWS                               |  3 +++
 doc/noreturn.texi                  | 35 ++++++++++++++----------------
 doc/posix-headers/stdnoreturn.texi |  2 ++
 lib/stdnoreturn.in.h               |  4 +++-
 modules/stdnoreturn                |  6 +++++
 6 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b6c6cf98e..91370af964 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	stdnoreturn: deprecate
+	C23 says <stdnoreturn.h> is obsolescent, so deprecate the
+	stdnoreturn module.  I don't think it was being used anyway
+	as it had too many problems.
+	* modules/stdnoreturn: Mark as obsolete.
+
 2022-12-23  Paul Eggert  <eggert@cs.ucla.edu>
 
 	file-has-acl: improve recent NFSv4 support
diff --git a/NEWS b/NEWS
index bc620ce86a..dd2374c4fd 100644
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2022-12-24  stdnoreturn     This module is deprecated.  Use _Noreturn
+                            or the noreturn module instead.
+
 2022-12-21  ctime           This module is deprecated.  Use localtime_r
                             and strftime (or even sprintf) instead.
 
diff --git a/doc/noreturn.texi b/doc/noreturn.texi
index a3a394409c..ad0a286f4a 100644
--- a/doc/noreturn.texi
+++ b/doc/noreturn.texi
@@ -15,22 +15,26 @@
 @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
@@ -44,20 +48,13 @@ definitions.
 @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.
diff --git a/doc/posix-headers/stdnoreturn.texi b/doc/posix-headers/stdnoreturn.texi
index 3e1c5882db..ebe31ffc9f 100644
--- a/doc/posix-headers/stdnoreturn.texi
+++ b/doc/posix-headers/stdnoreturn.texi
@@ -22,6 +22,8 @@ MSVC/clang.
 Portability problems not fixed by Gnulib:
 @itemize
 @item
+@code{<stdnoreturn.h>} and the @code{noreturn} macro are obsolescent in C23.
+@item
 @code{<stdnoreturn.h>} cannot be #included in C++ mode on some platforms:
 FreeBSD 13.1.
 @item
diff --git a/lib/stdnoreturn.in.h b/lib/stdnoreturn.in.h
index d9e746699d..446e11b0b2 100644
--- a/lib/stdnoreturn.in.h
+++ b/lib/stdnoreturn.in.h
@@ -24,7 +24,9 @@
    References:
    ISO C11 (latest free draft
    <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
-   section 7.23 */
+   section 7.23
+
+   <stdnoreturn.h> is obsolescent in C23, so new code should avoid it.  */
 
 /* The definition of _Noreturn is copied here.  */
 
diff --git a/modules/stdnoreturn b/modules/stdnoreturn
index 1ef894d51f..ce6b04a35e 100644
--- a/modules/stdnoreturn
+++ b/modules/stdnoreturn
@@ -1,6 +1,12 @@
 Description:
 A <stdnoreturn.h> that nearly conforms to ISO C11.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/stdnoreturn.in.h
 m4/stdnoreturn.m4
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-27 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24  9:35 [PATCH] stdnoreturn: deprecate Paul Eggert
2022-12-27 10:14 ` Bruno Haible
2022-12-27 18:59 [PATCH 0/6] build-aux/bootstrap that doesn't need to replace itself Paul Eggert
2022-12-27 18:59 ` [PATCH] stdnoreturn: deprecate Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).