From nobody Fri Feb 02 18:59:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TRQ6t0RR1z59HJ1; Fri, 2 Feb 2024 18:59:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRQ6s5hRpz4kgn; Fri, 2 Feb 2024 18:59:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.17.1/8.17.1) with ESMTP id 412Ix9V0027120; Fri, 2 Feb 2024 20:59:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 412Ix9V0027120 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 412Ix9r4027119; Fri, 2 Feb 2024 20:59:09 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 2 Feb 2024 20:59:09 +0200 From: Konstantin Belousov To: Warner Losh Cc: Warner Losh , src-committers , "" , "" Subject: Re: git: c27a89971805 - main - stdlib.h: add __noexcept to prototypes Message-ID: References: <202402021816.412IGxAl070009@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4TRQ6s5hRpz4kgn X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Fri, Feb 02, 2024 at 11:36:35AM -0700, Warner Losh wrote: > On Fri, Feb 2, 2024, 11:28 AM Konstantin Belousov > wrote: > > > On Fri, Feb 02, 2024 at 06:16:59PM +0000, Warner Losh wrote: > > > The branch main has been updated by imp: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=c27a89971805b176dcfa5a234f2ea6f6109d0a70 > > > > > > commit c27a89971805b176dcfa5a234f2ea6f6109d0a70 > > > Author: Lexi Winter > > > AuthorDate: 2024-02-02 16:41:40 +0000 > > > Commit: Warner Losh > > > CommitDate: 2024-02-02 18:11:17 +0000 > > > > > > stdlib.h: add __noexcept to prototypes > > > > > > The noexcept specifier is required on these functions in C++: > > > _Exit(), atexit(), quick_exit(), at_quick_exit(), abort(). > > > > > > MFC after: 2 weeks > > > > > > Reviewed by: imp > > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1085 > > > --- > > > include/stdlib.h | 10 +++++----- > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > diff --git a/include/stdlib.h b/include/stdlib.h > > > index ff8991d1fa94..f0687f01e6c7 100644 > > > --- a/include/stdlib.h > > > +++ b/include/stdlib.h > > > @@ -84,9 +84,9 @@ extern int __mb_cur_max; > > > extern int ___mb_cur_max(void); > > > #define MB_CUR_MAX ((size_t)___mb_cur_max()) > > > > > > -_Noreturn void abort(void); > > > +_Noreturn void abort(void) __noexcept; > > > int abs(int) __pure2; > > > -int atexit(void (* _Nonnull)(void)); > > > +int atexit(void (* _Nonnull)(void)) __noexcept; > > > double atof(const char *); > > > int atoi(const char *); > > > long atol(const char *); > > > @@ -154,7 +154,7 @@ unsigned long long > > > strtoull(const char * __restrict, char ** __restrict, int); > > > #endif /* __LONG_LONG_SUPPORTED */ > > > > > > -_Noreturn void _Exit(int); > > > +_Noreturn void _Exit(int) __noexcept; > > > #endif /* __ISO_C_VISIBLE >= 1999 */ > > > > > > /* > > > @@ -163,9 +163,9 @@ _Noreturn void _Exit(int); > > > #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L > > > void * aligned_alloc(size_t, size_t) __malloc_like > > __alloc_align(1) > > > __alloc_size(2); > > > -int at_quick_exit(void (*)(void)); > > > +int at_quick_exit(void (*)(void)) __noexcept; > > > _Noreturn void > > > - quick_exit(int); > > > + quick_exit(int) __noexcept; > > This is wrong, libc quick_exit() does not provide such guarantees as > > implemented. More, being part of libc it cannot ever guarantee that ever > > (and call std::terminate if the requirement is violated). > > > > Making it such would require bringing some C++ ABI into libc which I > > object strongly. > > > > So is this just for quick_exit, or all the functions marked? Other functions are abort()/_Exit()/atexit(). No functions in this list call a user-provided functions, so they cannot raise exceptions. My objection is only against our quick_exit(). > > Warner > > > > > #endif /* __ISO_C_VISIBLE >= 2011 */ > > > /* > > > * Extensions made by POSIX relative to C. > >