os_defines.h revision 122182
1117397Skan// Specific definitions for HPUX  -*- C++ -*-
2117397Skan
3117397Skan// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
4117397Skan//
5117397Skan// This file is part of the GNU ISO C++ Library.  This library is free
6117397Skan// software; you can redistribute it and/or modify it under the
7117397Skan// terms of the GNU General Public License as published by the
8117397Skan// Free Software Foundation; either version 2, or (at your option)
9117397Skan// any later version.
10117397Skan
11117397Skan// This library is distributed in the hope that it will be useful,
12117397Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of
13117397Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14117397Skan// GNU General Public License for more details.
15117397Skan
16117397Skan// You should have received a copy of the GNU General Public License along
17117397Skan// with this library; see the file COPYING.  If not, write to the Free
18117397Skan// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19117397Skan// USA.
20117397Skan
21117397Skan// As a special exception, you may use this file as part of a free software
22117397Skan// library without restriction.  Specifically, if other files instantiate
23117397Skan// templates or use macros or inline functions from this file, or you compile
24117397Skan// this file and link it with other files to produce an executable, this
25117397Skan// file does not by itself cause the resulting executable to be covered by
26117397Skan// the GNU General Public License.  This exception does not however
27117397Skan// invalidate any other reasons why the executable file might be covered by
28117397Skan// the GNU General Public License.
29117397Skan
30117397Skan#ifndef _GLIBCPP_OS_DEFINES
31117397Skan#define _GLIBCPP_OS_DEFINES 1
32117397Skan
33117397Skan// System-specific #define, typedefs, corrections, etc, go here.  This
34117397Skan// file will come before all others.
35117397Skan
36117397Skan#define __off_t off_t
37117397Skan#define __off64_t off64_t
38117397Skan#define __ssize_t ssize_t
39117397Skan
40117397Skan// Use macro form of ctype functions to ensure __SB_masks is defined.
41117397Skan#define _SB_CTYPE_MACROS 1
42117397Skan
43117397Skan/* HP-UX, for reasons unknown choose to use a different name for
44117397Skan   the string to [unsigned] long long conversion routines.
45117397Skan
46117397Skan   Furthermore, instead of having the prototypes in stdlib.h like
47117397Skan   everyone else, they put them into a non-standard header
48117397Skan   <inttypes.h>.  Ugh.
49117397Skan
50117397Skan   <inttypes.h> defines a variety of things, some of which we
51117397Skan   probably do not want.  So we don't want to include it here.
52117397Skan
53117397Skan   Luckily we can just declare strtoll and strtoull with the
54117397Skan   __asm extension which effectively renames calls at the
55117397Skan   source level without namespace pollution.
56117397Skan
57117397Skan   Also note that the compiler defines _INCLUDE_LONGLONG for C++
58117397Skan   unconditionally, which makes intmax_t and uintmax_t long long
59117397Skan   types.
60117397Skan
61117397Skan   We also force _GLIBCPP_USE_LONG_LONG here so that we don't have
62117397Skan   to bastardize configure to deal with this sillyness.  */
63117397Skannamespace std
64117397Skan{
65117397Skan#ifndef __LP64__
66117397Skan  __extension__ extern "C" long long strtoll (const char *, char **, int)
67117397Skan    __asm  ("__strtoll");
68117397Skan  __extension__ extern "C" unsigned long long strtoull (const char *, char **, int)
69117397Skan    __asm  ("__strtoull");
70117397Skan#else
71117397Skan  __extension__ extern "C" long long strtoll (const char *, char **, int)
72117397Skan    __asm  ("strtol");
73117397Skan  __extension__ extern "C" unsigned long long strtoull (const char *, char **, int)
74117397Skan    __asm  ("strtoul");
75117397Skan#endif
76117397Skan}
77117397Skan
78117397Skan#define _GLIBCPP_USE_LONG_LONG 1
79117397Skan
80117397Skan// HPUX on IA64 requires vtable to be 64 bit aligned even at 32 bit
81117397Skan// mode.  We need to pad the vtable structure to achieve this.
82117397Skan#if !defined(_LP64) && defined (__ia64__)
83117397Skan#define _GLIBCPP_VTABLE_PADDING 8
84117397Skantypedef long int __padding_type;
85117397Skan#endif
86117397Skan
87117397Skan// GCC on IA64 HP-UX uses the HP-UX system unwind library,
88117397Skan// it does not have the _Unwind_Resume_or_Rethrow entry point
89117397Skan// because that is not part of the standard IA64 Unwind ABI.
90117397Skan#if defined (__ia64__)
91117397Skan#define _LIBUNWIND_STD_ABI 1
92117397Skan#endif
93117397Skan
94117397Skan/* We need explicit instantiation of the atomicity lock on HPPA if
95117397Skan   there is no weak support.  */
96117397Skan#if !defined(_GLIBCPP_SUPPORTS_WEAK) && defined (__hppa__)
97117397Skan#define _GLIBCPP_INST_ATOMICITY_LOCK 1
98117397Skan#endif
99117397Skan
100122182Skan/* Don't use pragma weak in gthread headers.  HP-UX rejects programs
101122182Skan   with unsatisfied external references even if all of those references
102122182Skan   are weak; gthread relies on such unsatisfied references being resolved
103122182Skan   to null pointers when weak symbol support is on.  */
104117397Skan#define _GLIBCPP_GTHREAD_USE_WEAK 0
105122182Skan
106117397Skan#endif
107