From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) by sourceware.org (Postfix) with ESMTPS id 57554385781D for ; Thu, 10 Dec 2020 00:42:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57554385781D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eggert@cs.ucla.edu Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3AE3E1600AD; Wed, 9 Dec 2020 16:42:46 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id s7QP95YlQuPd; Wed, 9 Dec 2020 16:42:45 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0C84D1600C4; Wed, 9 Dec 2020 16:42:45 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nFYiPOI8gYs0; Wed, 9 Dec 2020 16:42:44 -0800 (PST) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A70A31600AD; Wed, 9 Dec 2020 16:42:44 -0800 (PST) To: Lukasz Majewski , Joseph Myers , Adhemerval Zanella Cc: Alistair Francis , Arnd Bergmann , Alistair Francis , GNU C Library , Florian Weimer , Carlos O'Donell , Stepan Golosunov , Andreas Schwab , Zack Weinberg , Siddhesh Poyarekar References: <20201209145331.18819-1-lukma@denx.de> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [RFC] y2038: test: Add _Static_assert() check when __USE_TIME_BITS64 is defined Message-ID: <2558832c-adac-0670-f39b-417ffa10f8a6@cs.ucla.edu> Date: Wed, 9 Dec 2020 16:42:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201209145331.18819-1-lukma@denx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Thu, 10 Dec 2020 00:42:48 -0000 On 12/9/20 6:53 AM, Lukasz Majewski wrote: > +#define CHECK_TIME64_SIZE(__name, __len) \ > + _Static_assert (sizeof (__name) =3D=3D __len, "Size of " #__name " != =3D " #__len) > + > +#ifdef __USE_TIME_BITS64 > + CHECK_TIME64_SIZE(time_t, 8); > + CHECK_TIME64_SIZE(struct timespec, 16); > +#endif I've lost context here; what branch is this against? glibc master doesn't= =20 have __USE_TIME_BITS64. If this is in a publicly-visible file, the macro CHECK_TIME64_SIZE would=20 need to have a reserved name. I'm leery of the idea of putting checks like this into include files that= =20 users see. If there's a reason a platform cannot support 64-bit time_t ev= en=20 though __USE_TIME_BITS64 is defined, doesn't this sort of checking belong= in=20 the include file that defines time_t or __TIME_T_TYPE or whatever? That w= ay,=20 a user who sees the resulting diagnostic will have an easier time figurin= g=20 out what exactly went wrong.