From patchwork Thu Oct 21 08:13:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Harms X-Patchwork-Id: 46475 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D5DA73858D39 for ; Thu, 21 Oct 2021 08:14:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5DA73858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634804068; bh=xnXVyUzCdVOm56LaRAE52kU1wC33FkHJcN3Jn329fL4=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=q8jQIhTdUyMH5BVqzr3e4GTTSPx2SBg3MvdIbghAi9ZakRSKfDEY266ntAXDP8Jc/ qqgOxikTf7Zg94JTyrIuGnPvTZJfOh9VbercdhoDfxzeHdXrgh0p48d8JdHhYa8r6d pBWCPnceQGUuDXi7cMQsPBVhYUxgDXo8rH1QktwI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx01-sz.bfs.de (mx01-sz.bfs.de [194.94.69.67]) by sourceware.org (Postfix) with ESMTPS id 72B6D3857409 for ; Thu, 21 Oct 2021 08:13:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72B6D3857409 Received: from SRVEX01-SZ.bfs.intern (exchange-sz.bfs.de [10.129.90.31]) by mx01-sz.bfs.de (Postfix) with ESMTPS id 37B77208FB; Thu, 21 Oct 2021 10:13:20 +0200 (CEST) Received: from SRVEX01-SZ.bfs.intern (10.129.90.31) by SRVEX01-SZ.bfs.intern (10.129.90.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.14; Thu, 21 Oct 2021 10:13:19 +0200 Received: from SRVEX01-SZ.bfs.intern ([fe80::7d2d:f9cb:2761:d24a]) by SRVEX01-SZ.bfs.intern ([fe80::7d2d:f9cb:2761:d24a%13]) with mapi id 15.01.2308.014; Thu, 21 Oct 2021 10:13:19 +0200 To: Alejandro Colomar , "mtk.manpages@gmail.com" Subject: AW: [PATCH 2/2] ctime.3, strftime.3, strptime.3, timegm.3: Add [[gnu::nonnull]] to prototypes Thread-Topic: [PATCH 2/2] ctime.3, strftime.3, strptime.3, timegm.3: Add [[gnu::nonnull]] to prototypes Thread-Index: AQHXxfBCx7c0U9rh6k+m6X3rykKCtKvdEdnA Date: Thu, 21 Oct 2021 08:13:19 +0000 Message-ID: References: <20211020202241.171180-1-alx.manpages@gmail.com>, <20211020202241.171180-2-alx.manpages@gmail.com> In-Reply-To: <20211020202241.171180-2-alx.manpages@gmail.com> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.129.18.210] x-tm-as-product-ver: SMEX-14.0.0.3080-8.6.1018-26480.006 x-tm-as-result: No-10--6.000000-5.000000 x-tmase-matchedrid: HK7+0zgfmVVEITuQJ3v9pomfV7NNMGm+uikHZcC6ceATVJPv0YKEKeOJ 0/PdE818E8VwtNBJdpZ+lwABLRSffNu9j/ba408t2os3ueKAsFQB4JHtiamkLJb+3HH/x36BsRE ym4hTah6cUFTC+nADP/oS5B31PW6fULIpUxgmc6QPe5gzF3TVt9su68CAPfG833Nl3elSfspQqd kLgJePtziho1Dnq559hg7u0oQFj2dxYSx6LBPKen4neC0h7SADgpjC7tI1OQgQnb0WCelSLRyUu fpdEXUyRZANqV/1uxMgbIuiKyn7p+PTl4lAY3OzlTsGW3DmpUu6Y5uv3M67ytqUml4VvcDYj78+ 1uscT5JMSBtHJpT6W6AoTyBQ9GaIOQIin5EspQa6iJsmkdGsWTal66Y6k2O0D8kH603DJOBPHvL iqwIXKH3KbmVoqYpoj3FO+DmfovLJyhQgM1YojUQaQ2k4z9e2K/YFZTiDf+pHrX2E2MkfRDlqWS xu1gNPvqqFNtlrl09pM4uQJ+eFBj8QUwly0FGtlknuuADbyTQvH8OzDKII6f67wpKrIJNBK6HQs 3v+pqPtyiiocwStrWifxXqxqO6sB22iW+FV2A+cVWc2a+/ju0tc8DbogbSEoxCLfriDzzjp0JOn VHhSjU/krMfnC0UDChqK9sC73oC3EcV3YQtKOmvOwg12ikVSElLH7tCb90oR1hH2Ye3qWJXPOgY /YGu+fS0Ip2eEHnzUHQeTVDUrIvc8OJc7+0VJ9xS3mVzWUuBGS1XF2lG3YmQIUsWZIN1xe4UYmR DQ251NuJjNAT6Ll/mRhPqoLnFbnqg/VrSZEiM= x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No x-tmase-result: 10--6.000000-5.000000 x-tmase-version: SMEX-14.0.0.3080-8.6.1018-26480.006 x-tm-snts-smtp: 99C2E827E24F7E003326D17215D39A7B3CFA4E17C9F10DFCFF1FF3E3CF441E3A2000:9 MIME-Version: 1.0 X-Spamd-Result: default: False [-16.50 / 7.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_SIGNED(0.00)[bfs.de:s=dkim201901]; BAYES_HAM(-3.00)[100.00%]; WHITELIST_LOCAL_IP(-15.00)[10.129.90.31]; NEURAL_HAM(-0.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FOREIGN_BODY, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Walter Harms via Libc-alpha From: Walter Harms Reply-To: Walter Harms Cc: "linux-man@vger.kernel.org" , Jens Gustedt , Glibc Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Hi thx, for the information, i was not aware of changes for the time interface and i do a lot of programming with them. Since you ask for it: I do not like the [[gnu::nonnull]] as shown below. The position triggers the wrong assoziation for me. Things in front of a function are used to describe a return values. To be fair the array solution is not great either. my idea would to add a comment like char *asctime(const struct tm *" tm /* not null */); What is happening inside time.h is something different. If you thing the compiler should check for not null he needs a hint. IMHO it is the responsibility of the programmer to make sure that the propper arguments are provided. re, wh diff --git a/man3/ctime.3 b/man3/ctime.3 index 0620741e9..42021a588 100644 --- a/man3/ctime.3 +++ b/man3/ctime.3 @@ -40,23 +40,23 @@ localtime_r \- transform date and time to broken-down time or ASCII .nf .B #include .PP -.BI "char *asctime(const struct tm *" tm ); -.BI "char *asctime_r(const struct tm *restrict " tm , -.BI " char " buf "[static restrict 26]);" +.BI "[[gnu::nonnull]] char *asctime(const struct tm *" tm ); +.BI "[[gnu::nonnull]] char *asctime_r(const struct tm *restrict " tm , +.BI " char " buf "[static restrict 26]);" .PP -.BI "char *ctime(const time_t *" timep ); -.BI "char *ctime_r(const time_t *restrict " timep , -.BI " char " buf "[static restrict 26]);" +.BI "[[gnu::nonnull]] char *ctime(const time_t *" timep ); +.BI "[[gnu::nonnull]] char *ctime_r(const time_t *restrict " timep , +.BI " char " buf "[static restrict 26]);" .PP -.BI "struct tm *gmtime(const time_t *" timep ); -.BI "struct tm *gmtime_r(const time_t *restrict " timep , -.BI " struct tm *restrict " result ); +.BI "[[gnu::nonnull]] struct tm *gmtime(const time_t *" timep ); +.BI "[[gnu::nonnull]] struct tm *gmtime_r(const time_t *restrict " timep , +.BI " struct tm *restrict " result ); .PP -.BI "struct tm *localtime(const time_t *" timep ); -.BI "struct tm *localtime_r(const time_t *restrict " timep , -.BI " struct tm *restrict " result ); +.BI "[[gnu::nonnull]] struct tm *localtime(const time_t *" timep ); +.BI "[[gnu::nonnull]] struct tm *localtime_r(const time_t *restrict " timep , +.BI " struct tm *restrict " result ); .PP -.BI "time_t mktime(struct tm *" tm ); +.BI "[[gnu::nonnull]] time_t mktime(struct tm *" tm ); .fi .PP .RS -4 diff --git a/man3/strftime.3 b/man3/strftime.3 index a24ea720b..715b30edb 100644 --- a/man3/strftime.3 +++ b/man3/strftime.3 @@ -41,6 +41,7 @@ strftime \- format date and time .nf .B #include .PP +.B [[gnu::nonnull]] .BI "size_t strftime(char *restrict " s ", size_t " max , .BI " const char *restrict " format , .BI " const struct tm *restrict " tm ); diff --git a/man3/strptime.3 b/man3/strptime.3 index d6595d4bf..c1b334d87 100644 --- a/man3/strptime.3 +++ b/man3/strptime.3 @@ -36,6 +36,7 @@ strptime \- convert a string representation of time to a time tm structure .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" .B #include .PP +.B [[gnu::nonnull]] .BI "char *strptime(const char *restrict " s ", const char *restrict " format , .BI " struct tm *restrict " tm ); .fi diff --git a/man3/timegm.3 b/man3/timegm.3 index b848e83e1..18b6e4847 100644 --- a/man3/timegm.3 +++ b/man3/timegm.3 @@ -29,8 +29,8 @@ timegm, timelocal \- inverses of gmtime and localtime .nf .B #include .PP -.BI "time_t timelocal(struct tm *" tm ); -.BI "time_t timegm(struct tm *" tm ); +.BI "[[gnu::nonnull]] time_t timelocal(struct tm *" tm ); +.BI "[[gnu::nonnull]] time_t timegm(struct tm *" tm ); .PP .fi .RS -4