This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: regex.h not self contained


Hi,

I wrote:
> Inclusion of <regex.h> as first system header leads to a compilation error.

Here is a patch to fix this bug. POSIX Issue 6 says <regex.h> must define
size_t by itself. The "#define __need_size_t; #include <stddef.h>" is for
glibc systems. The "#undef __need_size_t" is for non-glibc systems, where
stddef.h may not listen to __need* symbols.


2001-11-25  Bruno Haible  <bruno@clisp.org>

	* posix/regex.h: Include <stddef.h> in order to define size_t.

--- glibc-20011110/posix/regex.h.bak	Tue Jul 10 22:59:47 2001
+++ glibc-20011110/posix/regex.h	Sun Nov 25 22:28:47 2001
@@ -1,6 +1,7 @@
 /* Definitions for data structures and routines for the regular
    expression library, version 0.12.
-   Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1985,1989-1993,1995-1998, 2000, 2001
+		 Free Software Foundation, Inc.
    This file is part of the GNU C Library.  Its master source is NOT part of
    the C library, however.  The master source lives in /gd/gnu/lib.
 
@@ -27,14 +28,10 @@
 extern "C" {
 #endif
 
-/* POSIX says that <sys/types.h> must be included (by the caller) before
-   <regex.h>.  */
-
-#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
-   should be there.  */
-# include <stddef.h>
-#endif
+/* POSIX Issue 6 says <regex.h> must define size_t by itself.  */
+#define __need_size_t
+#include <stddef.h>
+#undef __need_size_t
 
 /* The following two types have to be signed and unsigned integer type
    wide enough to hold a value of a pointer.  For most ANSI compilers


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]