зеркало из https://github.com/mozilla/gecko-dev.git
Bugzilla bug #30367: define uint for Neutrino. Rearranged the ifdef's
in protypes.h so that it is easier to understand. Added the test obsints.c to ensure that all the (obsolete) integer types are defined. Added file: pr/tests/obsints.c Modified files: protypes.h, pr/tests/Makefile, pr/tests/Makefile.in
This commit is contained in:
Родитель
8d9521f806
Коммит
40b5b61ac3
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* This section typedefs the old 'native' types to the new PR<type>s.
|
||||
* This header typedefs the old 'native' types to the new PR<type>s.
|
||||
* These definitions are scheduled to be eliminated at the earliest
|
||||
* possible time. The NSPR API is implemented and documented using
|
||||
* the new definitions.
|
||||
|
@ -32,53 +32,107 @@ typedef PRIntn intn;
|
|||
#endif
|
||||
|
||||
/*
|
||||
* BeOS already defines the integer types below in its standard
|
||||
* header file SupportDefs.h.
|
||||
* It is trickier to define uint, int8, uint8, int16, uint16,
|
||||
* int32, uint32, int64, and uint64 because some of these int
|
||||
* types are defined by standard header files on some platforms.
|
||||
* Our strategy here is to include all such standard headers
|
||||
* first, and then define these int types only if they are not
|
||||
* defined by those standard headers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BeOS defines all the int types below in its standard header
|
||||
* file SupportDefs.h.
|
||||
*/
|
||||
#ifdef XP_BEOS
|
||||
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
|
||||
#elif defined(VMS)
|
||||
/*
|
||||
* OpenVMS already defines the integer types below in its standard
|
||||
* OpenVMS defines all the int types below in its standard
|
||||
* header files ints.h and types.h.
|
||||
*/
|
||||
#ifdef VMS
|
||||
#include <ints.h>
|
||||
#include <types.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
/* SVR4 typedef of uint is commonly found on UNIX machines. */
|
||||
/*
|
||||
* SVR4 typedef of uint is commonly found on UNIX machines.
|
||||
*
|
||||
* On AIX 4.3, sys/inttypes.h (which is included by sys/types.h)
|
||||
* defines the types int8, int16, int32, and int64.
|
||||
*/
|
||||
#ifdef XP_UNIX
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
/* model.h on HP-UX defines int8, int16, and int32. */
|
||||
#ifdef HPUX
|
||||
#include <model.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS) \
|
||||
&& !defined(XP_UNIX) || defined(NTO)
|
||||
typedef PRUintn uint;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS)
|
||||
typedef PRUint64 uint64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS)
|
||||
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
|
||||
typedef PRUint32 uint32;
|
||||
#else
|
||||
typedef unsigned long uint32;
|
||||
#endif
|
||||
typedef PRUint16 uint16;
|
||||
typedef PRUint8 uint8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very
|
||||
* common header file) defines the types int8, int16, int32, and int64.
|
||||
* So we don't define these four types here to avoid conflicts in case
|
||||
* the code also includes sys/types.h.
|
||||
* uint16
|
||||
*/
|
||||
#if defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
/* <sys/types.h> is already included */
|
||||
#else
|
||||
typedef PRInt64 int64;
|
||||
|
||||
/* /usr/include/model.h on HP-UX defines int8, int16, and int32 */
|
||||
#if defined(HPUX)
|
||||
#include <model.h>
|
||||
#else
|
||||
#if !defined(XP_BEOS) && !defined(VMS)
|
||||
typedef PRUint16 uint16;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS)
|
||||
typedef PRUint8 uint8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS) \
|
||||
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
typedef PRInt64 int64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS) \
|
||||
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
#if !defined(WIN32) || !defined(_WINSOCK2API_) /* defines its own "int32" */
|
||||
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
|
||||
typedef PRInt32 int32;
|
||||
|
@ -86,12 +140,27 @@ typedef PRInt32 int32;
|
|||
typedef long int32;
|
||||
#endif
|
||||
#endif
|
||||
typedef PRInt16 int16;
|
||||
typedef PRInt8 int8;
|
||||
#endif /* HPUX */
|
||||
#endif /* _PR_AIX_HAVE_BSD_INT_TYPES */
|
||||
#endif
|
||||
|
||||
#endif /* XP_BEOS VMS */
|
||||
/*
|
||||
* int16
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS) \
|
||||
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt16 int16;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(VMS) \
|
||||
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt8 int8;
|
||||
#endif
|
||||
|
||||
typedef PRFloat64 float64;
|
||||
typedef PRUptrdiff uptrdiff_t;
|
||||
|
|
|
@ -95,6 +95,7 @@ CSRCS = \
|
|||
nonblock.c \
|
||||
ntioto.c \
|
||||
ntoh.c \
|
||||
obsints.c \
|
||||
op_2long.c \
|
||||
op_excl.c \
|
||||
op_filnf.c \
|
||||
|
|
|
@ -99,6 +99,7 @@ CSRCS = \
|
|||
nonblock.c \
|
||||
ntioto.c \
|
||||
ntoh.c \
|
||||
obsints.c \
|
||||
op_2long.c \
|
||||
op_excl.c \
|
||||
op_filnf.c \
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test: obsints.c
|
||||
*
|
||||
* Description: make sure that protypes.h defines the obsolete integer
|
||||
* types intn, uintn, uint, int8, uint8, int16, uint16, int32, uint32,
|
||||
* int64, and uint64.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef NO_NSPR_10_SUPPORT
|
||||
|
||||
/* nothing to do */
|
||||
int main()
|
||||
{
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#include "prtypes.h" /* which includes protypes.h */
|
||||
|
||||
int main()
|
||||
{
|
||||
/*
|
||||
* Compilation fails if any of these integer types are not
|
||||
* defined by protypes.h.
|
||||
*/
|
||||
intn in;
|
||||
uintn uin;
|
||||
uint ui;
|
||||
int8 i8;
|
||||
uint8 ui8;
|
||||
int16 i16;
|
||||
uint16 ui16;
|
||||
int32 i32;
|
||||
uint32 ui32;
|
||||
int64 i64;
|
||||
uint64 ui64;
|
||||
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
Загрузка…
Ссылка в новой задаче