(decl_attributes): If TREE_TYPE for the DECL is updated,
[official-gcc.git] / gcc / objc / misc.c
blob7137fdacf32ab23fbc7b1ba79feee1c4ff03474a
1 /* GNU Objective C Runtime Miscellanious
2 Copyright (C) 1993 Free Software Foundation, Inc.
4 Author: Kresten Krab Thorup
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 2, or (at your option) any later version.
12 GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 details.
17 You should have received a copy of the GNU General Public License along with
18 GNU CC; see the file COPYING. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* As a special exception, if you link this library with files compiled with
22 GCC to produce an executable, this does not cause the resulting executable
23 to be covered by the GNU General Public License. This exception does not
24 however invalidate any other reasons why the executable file might be
25 covered by the GNU General Public License. */
27 #include "runtime.h"
29 void objc_error(id object, const char* fmt, va_list);
31 void (*_objc_error)(id, const char*, va_list) = objc_error;
33 #ifdef __alpha__
34 #include <stdlib.h>
35 extern int write (int, const char*, int);
36 extern size_t strlen (const char*);
37 #endif
39 void
40 objc_error(id object, const char* fmt, va_list ap)
42 vfprintf (stderr, fmt, ap);
43 abort ();
46 volatile void
47 objc_fatal(const char* msg)
49 write(2, msg, (int)strlen((const char*)msg));
50 abort();
53 void*
54 __objc_xmalloc(size_t size)
56 void* res = (void*) malloc(size);
57 if(!res)
58 objc_fatal("Virtual memory exhausted\n");
59 return res;
62 void*
63 __objc_xrealloc(void* mem, size_t size)
65 void* res = (void*) realloc(mem, size);
66 if(!res)
67 objc_fatal("Virtual memory exhausted\n");
68 return res;
71 void*
72 __objc_xcalloc(size_t nelem, size_t size)
74 #ifdef __alpha__
75 extern bzero (void *, size_t);
76 #endif
77 void* res = (void*)malloc(nelem * size);
78 if(!res)
79 objc_fatal("Virtual memory exhausted\n");
80 bzero (res, nelem * size);
81 return res;