From patchwork Wed Jun 26 17:49:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-103165-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iGPGr6sb"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45YrCs4q6bz9s4V for ; Thu, 27 Jun 2019 03:50:33 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=me0GjxEZ3OmE5VM8IbQm8Fytktzo20i1BFYTNtFZ5lg V2HdTTuvZNOswNS9Nw5LKjAMavAKEGJUvn9RNxK1noPi53BY/NVOyy2KNfyxa+uo 8MqUIJIWdsKaAszY5CpgiMgdu4DVc2bI8YnUEFtUChytUrnUqqLpzRyX/jrLxvMI = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=0OVIqAS76/KwQFZVZafwWhc4iVo=; b=iGPGr6sbIF0GiwTfM tX47UiRqrtZMpasV25t5k9JEdCUicJFWcQyAm0Y3Nlke9lKgKxHKU1vaXHP1wykD 2/ghrJChrBUpc7et+bs9NE0y44OoDlZpzr61fgrWep6m9OLDn9kYxXyj9k5rCF46 HoJqAZD92YH/bodkF3EyUnOWGk= Received: (qmail 7615 invoked by alias); 26 Jun 2019 17:50:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7565 invoked by uid 89); 26 Jun 2019 17:50:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=conclude, 6214, HX-Languages-Length:2114, HContent-Transfer-Encoding:8bit X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 08/25] =?utf-8?q?Don=E2=80=99t_conditionalize_declarations?= =?utf-8?b?IG9mIGxkaXZfdCwgbGxkaXZfdCwgX19nd2NoYXJfdC4=?= Date: Wed, 26 Jun 2019 13:49:53 -0400 Message-Id: <20190626174954.8009-9-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 The declarations of ldiv_t, lldiv_t, and __gwchar_t are all wrapped in __foo_t_defined conditionals, despite there being only one header in glibc that declares them. I checked codesearch.debian.net and only found one other program that refers to the __foo_t_defined conditionals: u-boot provides its own definition of ldiv_t if __ldiv_t_defined is not defined by stdlib.h. I conclude that the conditionals are not necessary, but the definitions of __ldiv_t_defined and __lldiv_t_defined should be preserved. * stdlib/inttypes.h: Unconditionally define __gwchar_t. Don’t define ____gwchar_t_defined. * stdlib/stdlib.h: Unconditionally define ldiv_t. Condition lldiv_t only on __USE_ISOC99. --- stdlib/inttypes.h | 15 ++++++--------- stdlib/stdlib.h | 6 ++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h index ddcb171b09..c5fb12056e 100644 --- a/stdlib/inttypes.h +++ b/stdlib/inttypes.h @@ -27,17 +27,14 @@ #include /* Get a definition for wchar_t. But we must not define wchar_t itself. */ -#ifndef ____gwchar_t_defined -# ifdef __cplusplus -# define __gwchar_t wchar_t -# elif defined __WCHAR_TYPE__ +#ifdef __cplusplus +# define __gwchar_t wchar_t +#elif defined __WCHAR_TYPE__ typedef __WCHAR_TYPE__ __gwchar_t; -# else -# define __need_wchar_t -# include +#else +# define __need_wchar_t +# include typedef wchar_t __gwchar_t; -# endif -# define ____gwchar_t_defined 1 #endif # if __WORDSIZE == 64 diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index a9fd989d39..34996e3ee7 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -62,16 +62,14 @@ typedef struct } div_t; /* Returned by `ldiv'. */ -#ifndef __ldiv_t_defined typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } ldiv_t; -# define __ldiv_t_defined 1 -#endif +#define __ldiv_t_defined 1 -#if defined __USE_ISOC99 && !defined __lldiv_t_defined +#if defined __USE_ISOC99 /* Returned by `lldiv'. */ __extension__ typedef struct {