From patchwork Fri Aug 28 22:35:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 512061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 A377E1401C7 for ; Sat, 29 Aug 2015 08:35:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=ZZHncFLk; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=VbeoVMibIqONIxf8dnEWnndPsyI9k tJ8vYObSP2ar5TYfTAVRl1qZuXam0fbNgfPyeUTgX66NyliCl/37c3KEVEZGywmj PKMB31/ffx+GrTpoHn++4B0m/ie9CAVrEEQRozkAzVXMQLn/OGgMitIGtpCtrxH4 K2bjGZIH96IR0Y= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=dYi9r7phCWrqZYmiMUtsy9ZXgmU=; b=ZZH ncFLkPxP2AEr0KTaP45nqxT/o9HI75MSmAINPB9wKmL+OsWetIDW9tzKd1epeRRz 4IQc9mPD3bWH3/lbe36t9XFwqSYP1BHOe5kRKywijVVQYHGtpm6TkITSvdXhOwfo qsPncQxuGfHz8rPA0yRo/HZKOPLFGt2AjgCKEkMc= Received: (qmail 77130 invoked by alias); 28 Aug 2015 22:35:44 -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 77116 invoked by uid 89); 28 Aug 2015 22:35:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Fri, 28 Aug 2015 22:35:36 +0000 From: Joseph Myers To: Subject: Don't include from installed Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Every so often someone gets confused by the fact that the installed header includes the non-installed header. This inclusion is not in fact a bug, because only gets included by any header that users should include directly if _IO_MTSAFE_IO is defined, and that's an internal define used when building libio, not a feature test macro it's valid for users to define. However, on general principles it's best to have as little as possible in the installed headers that is inapplicable for valid uses of the installed glibc. This patch moves the include of to the internal header include/libio.h, so that even if someone defines _IO_MTSAFE_IO it won't get included. This is intended as preparation for stopping and from being installed at all (after this patch they aren't used in any installed header; formally of course they don't need to be installed even before this patch, but stopping them being installed before removing the #include would just exacerbate the confusion described above), and then moving those out of the bits/ namespace in accordance with the principle that that namespace is only for installed headers. The tests scanf15.c and scanf17.c avoid the internal headers; after this patch that means they need to undefine _IO_MTSAFE_IO as well as _LIBC so as to get a working _IO_lock_t definition for libio.h. This brings them closer to using the headers as an installed program would, which clearly accords with the intent of those tests. Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). 2015-08-28 Joseph Myers * libio/libio.h [_IO_MTSAFE_IO]: Remove include of and commented-out include of . * include/libio.h [!_ISOMAC && _IO_MTSAFE_IO]: Include . * stdio-common/scanf15.c (_IO_MTSAFE_IO): Undefine. * stdio-common/scanf17.c (_IO_MTSAFE_IO): Likewise. diff --git a/include/libio.h b/include/libio.h index 735941d..f8a346a 100644 --- a/include/libio.h +++ b/include/libio.h @@ -1,3 +1,6 @@ +#if !defined _ISOMAC && defined _IO_MTSAFE_IO +# include +#endif #include #ifndef _ISOMAC diff --git a/libio/libio.h b/libio/libio.h index 08e0347..bddfd8d 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -145,11 +145,7 @@ struct _IO_jump_t; struct _IO_FILE; /* Handle lock. */ #ifdef _IO_MTSAFE_IO -# if defined __GLIBC__ && __GLIBC__ >= 2 -# include -# else -/*# include */ -# endif +/* _IO_lock_t defined in internal headers during the glibc build. */ #else typedef void _IO_lock_t; #endif diff --git a/stdio-common/scanf15.c b/stdio-common/scanf15.c index 851466b..a3ab15d 100644 --- a/stdio-common/scanf15.c +++ b/stdio-common/scanf15.c @@ -1,6 +1,7 @@ #undef _GNU_SOURCE #define _XOPEN_SOURCE 600 #undef _LIBC +#undef _IO_MTSAFE_IO /* The following macro definitions are a hack. They word around disabling the GNU extension while still using a few internal headers. */ #define u_char unsigned char diff --git a/stdio-common/scanf17.c b/stdio-common/scanf17.c index 4478a70..b6c0e63 100644 --- a/stdio-common/scanf17.c +++ b/stdio-common/scanf17.c @@ -1,6 +1,7 @@ #undef _GNU_SOURCE #define _XOPEN_SOURCE 600 #undef _LIBC +#undef _IO_MTSAFE_IO /* The following macro definitions are a hack. They word around disabling the GNU extension while still using a few internal headers. */ #define u_char unsigned char