* gimplify.c (gimplify_call_expr): Don't set CALL_CANNOT_INLINE_P
[official-gcc.git] / gcc / gthr-single.h
blob56dd8bc89f9448c49dfa448d662b470c48880bc9
1 /* Threads compatibility routines for libgcc2 and libobjc. */
2 /* Compile this one with gcc. */
3 /* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA. */
23 /* As a special exception, if you link this library with other files,
24 some of which are compiled with GCC, to produce an executable,
25 this library does not by itself cause the resulting executable
26 to be covered by the GNU General Public License.
27 This exception does not however invalidate any other reasons why
28 the executable file might be covered by the GNU General Public License. */
30 #ifndef GCC_GTHR_SINGLE_H
31 #define GCC_GTHR_SINGLE_H
33 /* Just provide compatibility for mutex handling. */
35 typedef int __gthread_key_t;
36 typedef int __gthread_once_t;
37 typedef int __gthread_mutex_t;
38 typedef int __gthread_recursive_mutex_t;
40 #define __GTHREAD_ONCE_INIT 0
41 #define __GTHREAD_MUTEX_INIT 0
42 #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
44 #define UNUSED __attribute__((unused))
46 #ifdef _LIBOBJC
48 /* Thread local storage for a single thread */
49 static void *thread_local_storage = NULL;
51 /* Backend initialization functions */
53 /* Initialize the threads subsystem. */
54 static inline int
55 __gthread_objc_init_thread_system (void)
57 /* No thread support available */
58 return -1;
61 /* Close the threads subsystem. */
62 static inline int
63 __gthread_objc_close_thread_system (void)
65 /* No thread support available */
66 return -1;
69 /* Backend thread functions */
71 /* Create a new thread of execution. */
72 static inline objc_thread_t
73 __gthread_objc_thread_detach (void (* func)(void *), void * arg UNUSED)
75 /* No thread support available */
76 return NULL;
79 /* Set the current thread's priority. */
80 static inline int
81 __gthread_objc_thread_set_priority (int priority UNUSED)
83 /* No thread support available */
84 return -1;
87 /* Return the current thread's priority. */
88 static inline int
89 __gthread_objc_thread_get_priority (void)
91 return OBJC_THREAD_INTERACTIVE_PRIORITY;
94 /* Yield our process time to another thread. */
95 static inline void
96 __gthread_objc_thread_yield (void)
98 return;
101 /* Terminate the current thread. */
102 static inline int
103 __gthread_objc_thread_exit (void)
105 /* No thread support available */
106 /* Should we really exit the program */
107 /* exit (&__objc_thread_exit_status); */
108 return -1;
111 /* Returns an integer value which uniquely describes a thread. */
112 static inline objc_thread_t
113 __gthread_objc_thread_id (void)
115 /* No thread support, use 1. */
116 return (objc_thread_t) 1;
119 /* Sets the thread's local storage pointer. */
120 static inline int
121 __gthread_objc_thread_set_data (void *value)
123 thread_local_storage = value;
124 return 0;
127 /* Returns the thread's local storage pointer. */
128 static inline void *
129 __gthread_objc_thread_get_data (void)
131 return thread_local_storage;
134 /* Backend mutex functions */
136 /* Allocate a mutex. */
137 static inline int
138 __gthread_objc_mutex_allocate (objc_mutex_t mutex UNUSED)
140 return 0;
143 /* Deallocate a mutex. */
144 static inline int
145 __gthread_objc_mutex_deallocate (objc_mutex_t mutex UNUSED)
147 return 0;
150 /* Grab a lock on a mutex. */
151 static inline int
152 __gthread_objc_mutex_lock (objc_mutex_t mutex UNUSED)
154 /* There can only be one thread, so we always get the lock */
155 return 0;
158 /* Try to grab a lock on a mutex. */
159 static inline int
160 __gthread_objc_mutex_trylock (objc_mutex_t mutex UNUSED)
162 /* There can only be one thread, so we always get the lock */
163 return 0;
166 /* Unlock the mutex */
167 static inline int
168 __gthread_objc_mutex_unlock (objc_mutex_t mutex UNUSED)
170 return 0;
173 /* Backend condition mutex functions */
175 /* Allocate a condition. */
176 static inline int
177 __gthread_objc_condition_allocate (objc_condition_t condition UNUSED)
179 return 0;
182 /* Deallocate a condition. */
183 static inline int
184 __gthread_objc_condition_deallocate (objc_condition_t condition UNUSED)
186 return 0;
189 /* Wait on the condition */
190 static inline int
191 __gthread_objc_condition_wait (objc_condition_t condition UNUSED,
192 objc_mutex_t mutex UNUSED)
194 return 0;
197 /* Wake up all threads waiting on this condition. */
198 static inline int
199 __gthread_objc_condition_broadcast (objc_condition_t condition UNUSED)
201 return 0;
204 /* Wake up one thread waiting on this condition. */
205 static inline int
206 __gthread_objc_condition_signal (objc_condition_t condition UNUSED)
208 return 0;
211 #else /* _LIBOBJC */
213 static inline int
214 __gthread_active_p (void)
216 return 0;
219 static inline int
220 __gthread_once (__gthread_once_t *__once UNUSED, void (*__func) (void) UNUSED)
222 return 0;
225 static inline int UNUSED
226 __gthread_key_create (__gthread_key_t *__key UNUSED, void (*__func) (void *) UNUSED)
228 return 0;
231 static int UNUSED
232 __gthread_key_delete (__gthread_key_t __key UNUSED)
234 return 0;
237 static inline void *
238 __gthread_getspecific (__gthread_key_t __key UNUSED)
240 return 0;
243 static inline int
244 __gthread_setspecific (__gthread_key_t __key UNUSED, const void *__v UNUSED)
246 return 0;
249 static inline int
250 __gthread_mutex_destroy (__gthread_mutex_t *__mutex UNUSED)
252 return 0;
255 static inline int
256 __gthread_mutex_lock (__gthread_mutex_t *__mutex UNUSED)
258 return 0;
261 static inline int
262 __gthread_mutex_trylock (__gthread_mutex_t *__mutex UNUSED)
264 return 0;
267 static inline int
268 __gthread_mutex_unlock (__gthread_mutex_t *__mutex UNUSED)
270 return 0;
273 static inline int
274 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
276 return __gthread_mutex_lock (__mutex);
279 static inline int
280 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
282 return __gthread_mutex_trylock (__mutex);
285 static inline int
286 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
288 return __gthread_mutex_unlock (__mutex);
291 #endif /* _LIBOBJC */
293 #undef UNUSED
295 #endif /* ! GCC_GTHR_SINGLE_H */