From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22653 invoked by alias); 17 Jul 2007 17:20:44 -0000 Received: (qmail 22637 invoked by uid 22791); 17 Jul 2007 17:20:44 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 17 Jul 2007 17:20:37 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l6HHO7Wg032232; Tue, 17 Jul 2007 19:24:07 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l6HHO7cY032229; Tue, 17 Jul 2007 19:24:07 +0200 Date: Tue, 17 Jul 2007 17:20:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Avoid defining size_t in ctype.h, wctype.h and signal.h for -std=c99 -pedantic Message-ID: <20070717172406.GW4603@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00026.txt.bz2 Hi! As CONFORMANCE notes, these headers aren't supposed to define size_t (except that signal.h is not supposed to define size_t in ISO C99 and is supposed to define it in XPG6 or whenever struct sigstack is defined). Not sure why bits/types.h has been defining it, it is much cleaner if it just defines only __*_t types. Most of the headers that actually need size_t were already explicitly or implicitly making sure they get the type defined (be it #define __need_size_t #include , or #include , or #include , or #include , or #include ), there were just a few headers that needed some tweaking. I did make install-headers with this into an empty directory on x86_64-linux, and tried to compile all headers one by one into .s with various feature test macros to make sure this doesn't cause regressions, additionally I have grepped gcc -E -D_XOPEN_SOURCE={500,600} outputs of including headers that XPG* requires to define size_t or in the prototypes/struct definitions use size_t and also grepped all headers in libc tree which use size_t and don't necessarily make sure it is included. This is what I fond: 2007-07-17 Jakub Jelinek * bits/types.h: Don't include stddef.h, don't define __need_size_t. * signal/signal.h <__USE_BSD || __USE_XOPEN_EXTENDED>: Define __need_size_t and include stddef.h. * sysvipc/sys/msg.h: Likewise. * posix/sched.h: Likewise. * hurd/hurd/signal.h (__need_size_t): Define. * CONFORMANCE: ctype.h and wctype.h no longer define size_t, neither does signal.h in pedantic ISO C namespaces. stdio.h no longer defines wint_t or wchar_t. --- libc/bits/types.h.jj 2005-02-22 00:11:47.000000000 +0100 +++ libc/bits/types.h 2007-07-17 18:41:03.000000000 +0200 @@ -1,5 +1,5 @@ /* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,9 +27,6 @@ #include #include -#define __need_size_t -#include - /* Convenience types. */ typedef unsigned char __u_char; typedef unsigned short int __u_short; --- libc/signal/signal.h.jj 2004-11-20 18:57:35.000000000 +0100 +++ libc/signal/signal.h 2007-07-17 18:45:27.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991-2003, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -339,6 +339,8 @@ extern int sigreturn (struct sigcontext #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +# define __need_size_t +# include /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system --- libc/sysvipc/sys/msg.h.jj 2006-08-03 17:38:26.000000000 +0200 +++ libc/sysvipc/sys/msg.h 2007-07-17 18:47:17.000000000 +0200 @@ -1,4 +1,5 @@ -/* Copyright (C) 1995-1997,1999,2000,2003,2006 Free Software Foundation, Inc. +/* Copyright (C) 1995-1997,1999,2000,2003,2006,2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +22,9 @@ #include +#define __need_size_t +#include + /* Get common definition of System V style IPC. */ #include --- libc/posix/sched.h.jj 2007-04-23 10:54:03.000000000 +0200 +++ libc/posix/sched.h 2007-07-17 18:42:23.000000000 +0200 @@ -25,6 +25,9 @@ /* Get type definitions. */ #include +#define __need_size_t +#include + #define __need_timespec #include --- libc/hurd/hurd/signal.h.jj 2007-03-21 21:22:16.000000000 +0100 +++ libc/hurd/hurd/signal.h 2007-07-17 18:44:33.000000000 +0200 @@ -26,6 +26,7 @@ #error "Must have `_GNU_SOURCE' feature test macro to use this file" #endif +#define __need_size_t #define __need_NULL #include --- libc/CONFORMANCE.jj 2004-04-17 19:43:48.000000000 +0200 +++ libc/CONFORMANCE 2007-07-17 19:08:34.000000000 +0200 @@ -184,15 +184,7 @@ Also, the Single Unix Specification gene be included in headers (if _XOPEN_SOURCE is defined appropriately) than ISO C permits. - should not declare size_t. - - should not declare size_t. - - should not declare or use wchar_t or wint_t. - does not support AMD1; to support it, the functions fwprintf, fwscanf, wprintf, wscanf, swprintf, swscanf, vfwprintf, vwprintf, vswprintf and fwide would need to be declared when __STDC_VERSION__ >= 199409L and not just for C99. - - should not declare size_t. Jakub