We have sys/cdefs.h now, so remove hacks.

This commit is contained in:
Arun Thomas
2010-06-17 15:14:57 +00:00
parent 7b7091e905
commit 042b5bf606
19 changed files with 33 additions and 42 deletions

View File

@@ -343,6 +343,25 @@
#define __predict_false(exp) (exp)
#endif
/*
* We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
* require it.
*/
#if __GNUC_PREREQ__(4, 1)
#define __offsetof(type, field) __builtin_offsetof(type, field)
#else
#ifndef __cplusplus
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
#else
#define __offsetof(type, field) \
(__offsetof__ (reinterpret_cast <size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<type *> (0)->field))))
#endif
#endif
#define __rangeof(type, start, end) \
(__offsetof(type, end) - __offsetof(type, start))
/*
* Compiler-dependent macros to declare that functions take printf-like
* or scanf-like arguments. They are null except for versions of gcc

View File

@@ -33,12 +33,7 @@
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
/* Minix doesn't have this file.
#include <sys/cdefs.h>
*/
/* Minix does needs this declaration from sys/cdefs.h though. */
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
/*
* This file defines four types of data structures: singly-linked lists,