Date: Sat, 26 May 2001 10:20:02 -0700 (PDT) From: Naohiko Tsuji <yakisoba@f2.dion.ne.jp> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/27606: stddef.h has wrong defines. 'mbstate_t' and so on. Message-ID: <200105261720.f4QHK2Q55919@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/27606; it has been noted by GNATS.
From: Naohiko Tsuji <yakisoba@f2.dion.ne.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc:
Subject: Re: misc/27606: stddef.h has wrong defines. 'mbstate_t' and so on.
Date: Sun, 27 May 2001 02:18:22 +0900
Thank you for committing. And I'm sorry for my rude and poor English.
libstdc++-v3 <bits/std_cwchar.h>
gcc/libstdc++-v3/include/c_std/bits/std_cwchar.h gcc-3_0-branch rev. 1.5.2.2
// -*- C++ -*- forwarding header.
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: ???
//
// Note: This is not a conforming implementation.
#ifndef _CPP_CWCHAR
#define _CPP_CWCHAR 1
#include <bits/c++config.h>
#include <bits/std_cstddef.h>
#include <bits/std_cstdio.h>
#include <bits/std_cstdarg.h>
#if _GLIBCPP_HAVE_WCHAR_H
// Need to mangle these "C" functions because C++ modifies their signature.
#define wcschr __glibcpp_wcschr
#define wcsbrk __glibcpp_wcspbrk
#define wcsrchr __glibcpp_wcsrchr
#define wcsstr __glibcpp_wcsstr
#define wmemchr __glibcpp_wmemchr
#pragma GCC system_header
#include <wchar.h>
#endif
// Need to do a bit of trickery here with mbstate_t as char_traits
> // assumes it is in wchar.h, regardless of wchar_t specializations.
! #ifndef _GLIBCPP_HAVE_MBSTATE_T
! extern "C"
! {
! typedef struct
! {
! int __fill[6];
! } mbstate_t;
! }
! #endif
....
If _GLIBCPP_HAVE_WCHAR_H is 0, _GLIBCPP_HAVE_MBSTATE_T is not defined.
So 'mbstate_t' is defined here.
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
_________________________________________________________________
NAME
stddef.h - standard type definitions
SYNOPSIS
#include <stddef.h>
DESCRIPTION
The <stddef.h> header defines the following:
NULL
Null pointer constant.
offsetof(type, member-designator)
Integral constant expression of type size_t, the value of which
is the offset in bytes to the structure member
(member-designator), from the beginning of its structure
(type).
The <stddef.h> header defines through typedef:
ptrdiff_t
Signed integral type of the result of subtracting two pointers.
wchar_t
Integral type whose range of values can represent distinct
wide-character codes for all members of the largest character
set specified among the locales supported by the compilation
environment: the null character has the code value 0 and each
member of the Portable Character Set has a code value equal to
its value when used as the lone character in an integer
character constant.
size_t
Unsigned integral type of the result of the sizeof operator.
.....
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
_________________________________________________________________
NAME
wchar.h - wide-character types
SYNOPSIS
#include <wchar.h>
DESCRIPTION
The <wchar.h> header defines the following data types through
wchar_t
As described in [1]<stddef.h>.
wint_t
An integral type capable of storing any valid value of wchar_t,
or WEOF.
wctype_t
A scalar type of a data object that can hold values which
represent locale-specific character classification.
mbstate_t
An object type other than an array type that can hold the
conversion state information necessary to convert between
sequences of (possibly multibyte) characters and
wide-characters. If a codeset is being used such that an
mbstate_t needs to preserve more than 2 levels of reserved
state, the results are unspecified.
FILE
As described in <stdio.h>.
size_t
As described in <stddef.h>.
.....
/* $NetBSD: basesrc/include/stddef.h,v 1.9 2000/11/10 06:35:45 tshiozak Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stddef.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _STDDEF_H_
#define _STDDEF_H_
#include <machine/ansi.h>
typedef _BSD_PTRDIFF_T_ ptrdiff_t;
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifdef _BSD_WCHAR_T_
typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif
#include <sys/null.h>
#define offsetof(type, member) ((size_t)(unsigned long)(&((type *)0)->member))
#endif /* _STDDEF_H_ */
/* $NetBSD: basesrc/include/wchar.h,v 1.9 2000/12/29 15:26:33 kleink Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _WCHAR_H_
#define _WCHAR_H_
#include <sys/cdefs.h>
#include <machine/ansi.h>
#include <sys/null.h>
#ifdef _BSD_WCHAR_T_
typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif
#ifdef _BSD_MBSTATE_T_
typedef _BSD_MBSTATE_T_ mbstate_t;
#undef _BSD_MBSTATE_T_
#endif
#ifdef _BSD_WINT_T_
typedef _BSD_WINT_T_ wint_t;
#undef _BSD_WINT_T_
#endif
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifndef WEOF
#define WEOF ((wint_t)-1)
#endif
.....
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105261720.f4QHK2Q55919>
