Subversion Repositories Kolibri OS

Rev

Rev 3243 | Rev 4103 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3243 Rev 3480
Line 168... Line 168...
168
  ({ unsigned long __ptr;					\
168
  ({ unsigned long __ptr;					\
169
     __ptr = (unsigned long) (ptr);				\
169
     __ptr = (unsigned long) (ptr);				\
170
    (typeof(ptr)) (__ptr + (off)); })
170
    (typeof(ptr)) (__ptr + (off)); })
171
#endif
171
#endif
Line -... Line 172...
-
 
172
 
-
 
173
/* Not-quite-unique ID. */
-
 
174
#ifndef __UNIQUE_ID
-
 
175
# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
-
 
176
#endif
172
 
177
 
Line 173... Line 178...
173
#endif /* __KERNEL__ */
178
#endif /* __KERNEL__ */
Line 174... Line 179...
174
 
179
 
Line 300... Line 305...
300
#ifndef __compiletime_warning
305
#ifndef __compiletime_warning
301
# define __compiletime_warning(message)
306
# define __compiletime_warning(message)
302
#endif
307
#endif
303
#ifndef __compiletime_error
308
#ifndef __compiletime_error
304
# define __compiletime_error(message)
309
# define __compiletime_error(message)
-
 
310
# define __compiletime_error_fallback(condition) \
-
 
311
	do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
-
 
312
#else
-
 
313
# define __compiletime_error_fallback(condition) do { } while (0)
305
#endif
314
#endif
-
 
315
 
-
 
316
#define __compiletime_assert(condition, msg, prefix, suffix)		\
-
 
317
	do {								\
-
 
318
		bool __cond = !(condition);				\
-
 
319
		extern void prefix ## suffix(void) __compiletime_error(msg); \
306
#ifndef __linktime_error
320
		if (__cond)						\
-
 
321
			prefix ## suffix();				\
-
 
322
		__compiletime_error_fallback(__cond);			\
-
 
323
	} while (0)
-
 
324
 
307
# define __linktime_error(message)
325
#define _compiletime_assert(condition, msg, prefix, suffix) \
-
 
326
	__compiletime_assert(condition, msg, prefix, suffix)
-
 
327
 
-
 
328
/**
-
 
329
 * compiletime_assert - break build and emit msg if condition is false
-
 
330
 * @condition: a compile-time constant condition to check
-
 
331
 * @msg:       a message to emit if condition is false
-
 
332
 *
-
 
333
 * In tradition of POSIX assert, this macro will break the build if the
-
 
334
 * supplied condition is *false*, emitting the supplied error message if the
-
 
335
 * compiler has support to do so.
308
#endif
336
 */
-
 
337
#define compiletime_assert(condition, msg) \
-
 
338
	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
-
 
339
 
309
/*
340
/*
310
 * Prevent the compiler from merging or refetching accesses.  The compiler
341
 * Prevent the compiler from merging or refetching accesses.  The compiler
311
 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
342
 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
312
 * but only when the compiler is aware of some particular ordering.  One way
343
 * but only when the compiler is aware of some particular ordering.  One way
313
 * to make the compiler aware of ordering is to put the two invocations of
344
 * to make the compiler aware of ordering is to put the two invocations of