]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h
1 /* Machine/OS specific configuration information for GNUstep
3 Please NOTE - GSConfig.h is generated by the configure script from the
4 file GSConfig.h.in - changes/fixes need to be made to the original file,
5 not to the GSConfig.h generated from it.
7 Copyright (C) 1998-2010 Free Software Foundation, Inc.
9 Written by: Richard frith-Macdonald <richard@brainstorm.co.uk>
11 This file is part of the GNUstep Base Library.
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 2 of the License, or (at your option) any later version.
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Library General Public License for more details.
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free
25 Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29 #ifndef included_GSConfig_h
30 #define included_GSConfig_h
32 /* Check the compiler to see if we are building on/for ms-windows.
33 * Whatever the compiler uses, we want a standard setting of _WIN64
34 * to indicate 64bit AND _WIN32 to indicate ms-windows.
35 * These are defined by gcc, clang, and microsoft compilers anyway.
37 #if defined(__WIN32__) \
38 || defined(__MS_WIN32__) \
39 || defined(__MINGW32__)
44 #if defined(__WIN64__) \
45 || defined(__MS_WIN64__) \
46 || defined(__MINGW64__)
47 # if !defined(__WIN64__)
55 /* Check to see if this is a MINGW build (all we currently support)
57 #if defined(__MINGW32__) || defined(__MINGW64__)
58 # if !defined(__MINGW__)
63 // Make sure we expose the constants that we use in ObjC++ mode
64 #ifndef __STDC_CONSTANT_MACROS
65 #define __STDC_CONSTANT_MACROS 1
67 #ifndef __STDC_LIMIT_MACROS
68 #define __STDC_LIMIT_MACROS 1
71 #if !defined(NeXT_Foundation_LIBRARY)
73 /* An alternate to GS_FAKE_MAIN which forces the user to call the
74 NSProcessInfo initialization in 'main', GS_FAKE_MAIN must also
77 #define GS_PASS_ARGUMENTS 0
80 #define GS_FAKE_MAIN 0
84 * NOTE - if GS_FAKE_MAIN (above) is set to 1, this hack applies - and you
85 * must make sure that this file is included in any file that implements
86 * the 'main()' function and links with the GNUstep base libarary.
87 * You should NOT include this file in a program that does not link with
89 * This file is included automatically in NSObject.h and Foundation.h
91 * The Foundation classe NSProcessInfo need access to the argc, argv,
92 * and env variables of the main() function. The purpose of this (ugly hack)
93 * definition is to give the gstep-base library the opportunity to implement
94 * its own main function with private access to the global vars. The private
95 * main() implementation (in NSProcessInfo.m) will then call the user defined
96 * gnustep_base_user_main() function.
98 * The original hack was -
99 ** Written by: Georg Tuparev, EMBL & Academia Naturalis,
100 ** Heidelberg, Germany
101 ** Tuparev@EMBL-Heidelberg.de
103 ** NOTE! This is very dirty and dangerous trick. I spend several hours
104 ** on thinking and man pages browsing, but couldn't find better solution.
105 ** I know that I will spend 666 years in the Computer Hell for writing
106 ** this hack, and the master devil (Bully Boy) will send me to write
108 ** BTW, for writing this hack I got personal congratulations from Dennis
109 ** Ritchie and Bjarne Stroustrup sent me a bunch of flowers and asked me
110 ** to participate in the standardization committee for C-- v.6.0 as
111 ** responsible for the new Tab-Overriding-Operator and Scope-Sensitive-
112 ** Comments ... but this makes my situation even worse ;-)
115 * On some systems, there are other relatively clean workarounds, if this
116 * applies to the system you are running on, your configuration script
117 * should have set GS_FAKE_MAIN to zero, so that this define hack will
121 #define main gnustep_base_user_main
123 #endif /* GS_FAKE_MAIN */
127 * Definition to specify if your processor stores words with the most
128 * significant byte first (like Motorola and SPARC, unlike Intel and VAX).
130 #define GS_WORDS_BIGENDIAN 0
133 * Size definitions for standard types
135 #define GS_SIZEOF_SHORT 2
136 #define GS_SIZEOF_INT 4
137 #define GS_SIZEOF_LONG 8
138 #define GS_SIZEOF_LONG_LONG 8
139 #define GS_SIZEOF_FLOAT 4
140 #define GS_SIZEOF_DOUBLE 8
141 #define GS_SIZEOF_VOIDP 8
144 * Size information to be places in bits 5 and 6 of type encoding bytes
145 * in archives (bits 0 to 4 are used for basic type info and bit 7 is
146 * used to mark cross-references to previously encoded objects).
148 #define _GSC_S_SHT _GSC_I16
149 #define _GSC_S_INT _GSC_I32
150 #define _GSC_S_LNG _GSC_I64
151 #define _GSC_S_LNG_LNG _GSC_I64
154 * Type definitions for types with known sizes.
156 typedef signed char gss8
;
157 typedef unsigned char gsu8
;
158 typedef signed short gss16
;
159 typedef unsigned short gsu16
;
160 typedef signed int gss32
;
161 typedef unsigned int gsu32
;
162 typedef signed long gss64
;
163 typedef unsigned long gsu64
;
164 typedef struct { gsu8 a
[16]; } gss128
;
165 typedef struct { gsu8 a
[16]; } gsu128
;
167 typedef double gsf64
;
170 * Integer type with same size as a pointer
172 typedef unsigned long gsuaddr
;
173 typedef long gssaddr
;
174 typedef gsuaddr gsaddr
;
177 * Do we have real 64-bit and 128-bit integers or are we just pretending.
179 #define GS_HAVE_I64 1
180 #define GS_HAVE_I128 0
183 * Ensure some standard types are defined.
185 #include <inttypes.h>
198 * PTR Limit information replacements for buggy headers
211 * Do we have zlib for file handle compression?
216 * Do we have the GNU Multiple-precision library for NSDecimal?
227 * Define to say if we use NXConstantString or NSConstantString
229 #define NXConstantString NSConstantString
233 * Wide unicode character type.
236 #define UTF32Char uint32_t
240 * Native character type for use in systemcalls etc.
243 #if defined(__MINGW__)
244 # define GSNativeChar uint16_t
246 # define GSNativeChar char
250 * Types used to avoid exposing pthread header in NSLock.h
251 * NB. These types should *never* be used except to provide enough space
252 * in a class layout for the type of data actually used by the pthread
253 * implementation of the current platform.
257 } gs_cond_t
__attribute__((aligned (8)));
260 } gs_mutex_t
__attribute__((aligned (8)));
262 #define OBJC2RUNTIME 1
263 #define BASE_NATIVE_OBJC_EXCEPTIONS 1
264 #define GS_NONFRAGILE 0
265 #define GS_MIXEDABI 0
266 #define GS_USE_LIBXML 0
267 #define GS_USE_GNUTLS 0
268 #define GS_USE_AVAHI 0
269 #define GS_USE_MDNS 0
271 #define GS_USE_LIBDISPATCH 0
272 #define GS_USE_LIBDISPATCH_RUNLOOP 0
273 #define GS_HAVE_OBJC_ROOT_CLASS_ATTR 0
275 #ifndef __has_include
276 # define __has_include(x) 0
278 #ifndef __has_feature
279 # define __has_feature(x) 0
281 #ifndef __has_builtin
282 # define __has_builtin(x) 0
286 * __has_extension has slightly different semantics from __has_feature.
287 * It evaluates to true if the feature is supported by by clang for the
288 * current compilation unit (language and -f switches), regardless of
289 * whether it is part of the language standard or just a (non-standard)
292 #ifndef __has_extension
293 # define __has_extension(x) __has_feature(x)
298 #define __OBJC_BOOL 1
301 #define _WIN32_WINNT Windows2000
304 #define WINVER Windows2000
305 #elif (WINVER < Windows2000)
307 #define WINVER Windows2000
310 #if defined(__WIN64__)
311 #include <winsock2.h>
315 #include <winsock2.h>
322 /* Include the blocks runtime header if it's available (It shouldn't matter
323 * that this doesn't work on compilers that don't support __has_include(),
324 * because they also don't support blocks).
326 #if __has_include(<objc/block_runtime.h>)
327 # include <objc/block_runtime.h>
331 #include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
334 /* The following group of lines maintained by the gstep-base configure */
335 #define GNUSTEP_BASE_VERSION 1.26.0
336 #define GNUSTEP_BASE_MAJOR_VERSION 1
337 #define GNUSTEP_BASE_MINOR_VERSION 26
338 #define GNUSTEP_BASE_SUBMINOR_VERSION 0
339 #define GNUSTEP_BASE_GCC_VERSION 4.0.0
341 /* Do not use the following macros!
343 #define OBJC_DEP(M) \
344 ({ static BOOL beenHere = NO; if (beenHere == NO) {\
345 beenHere = YES; fprintf(stderr, "%s:%d %s", __FILE__, __LINE__, (M));}})
347 #define OBJC_MALLOC(VAR, TYPE, NUM) \
348 (OBJC_DEP("OBJC_MALLOC is deprecated ... use malloc\n"),(VAR) = (TYPE *) malloc ((unsigned)(NUM)*sizeof(TYPE)))
349 #define OBJC_VALLOC(VAR, TYPE, NUM) \
350 (OBJC_DEP("OBJC_VALLOC is deprecated\n"),(VAR) = (TYPE *) valloc ((unsigned)(NUM)*sizeof(TYPE)))
351 #define OBJC_ATOMIC_MALLOC(VAR, TYPE, NUM) \
352 (OBJC_DEP("OBJC_ATOMIC_MALLOC is deprecated\n"),(VAR) = (TYPE *) malloc ((unsigned)(NUM)*sizeof(TYPE)))
353 #define OBJC_REALLOC(VAR, TYPE, NUM) \
354 (OBJC_DEP("OBJC_REALLOC is deprecated ... use realloc\n"),(VAR) = (TYPE *) realloc ((VAR), (unsigned)(NUM)*sizeof(TYPE)))
355 #define OBJC_CALLOC(VAR, TYPE, NUM) \
356 (OBJC_DEP("OBJC_CALLOC is deprecated ... use calloc\n"),(VAR) = (TYPE *) calloc ((unsigned)(NUM), sizeof(TYPE)))
357 #define OBJC_FREE(PTR) (OBJC_DEP("OBJC_FREE is deprecated ... use free\n"), free (PTR))
361 ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \
362 _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
367 ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \
368 _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
373 ({__typeof__(a) _ABS_a = (a); \
374 _ABS_a < 0 ? -_ABS_a : _ABS_a; })
378 #define STRINGIFY(s) XSTRINGIFY(s)
379 #define XSTRINGIFY(s) #s
382 #ifndef OBJC_STRINGIFY
383 #define OBJC_STRINGIFY(s) OBJC_XSTRINGIFY(s)
384 #define OBJC_XSTRINGIFY(s) @#s
388 #define PTR2LONG(P) (((char*)(P))-(char*)0)
391 #define LONG2PTR(L) (((char*)0)+(L))
394 #if VSPRINTF_RETURNS_LENGTH
395 #define VSPRINTF_LENGTH(VSPF_CALL) (VSPF_CALL)
397 #define VSPRINTF_LENGTH(VSPF_CALL) strlen((VSPF_CALL))
398 #endif /* VSPRINTF_RETURNS_LENGTH */
400 #if VASPRINTF_RETURNS_LENGTH
401 #define VASPRINTF_LENGTH(VASPF_CALL) (VASPF_CALL)
403 #define VASPRINTF_LENGTH(VASPF_CALL) strlen((VASPF_CALL))
404 #endif /* VSPRINTF_RETURNS_LENGTH */
406 /* Evil hack to stop gcc-4.1 complaining about a dealloc method which
407 * does not call the superclass implementation.
409 #define GSNOSUPERDEALLOC if (0) [super dealloc]
411 #ifndef CF_EXCLUDE_CSTD_HEADERS
412 #include <sys/types.h>
431 #if !__has_feature(objc_arc)
432 // NetBSD > 6 defines __weak in cdefs_elf.h
436 # if !defined(__weak)
439 # if !defined(__strong)
444 #ifndef __unsafe_unretained
445 # if !__has_feature(objc_arc)
446 # define __unsafe_unretained
450 # if !__has_feature(objc_arc)
455 #if __has_builtin(__builtin_unreachable)
456 # define GS_UNREACHABLE() __builtin_unreachable()
458 # define GS_UNREACHABLE() abort()
461 #endif /* included_GSConfig_h */