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

@@ -35,10 +35,6 @@
#define _ERR_H_
#ifdef __minix
#define __BEGIN_DECLS
#define __dead
#define __END_DECLS
#define __attribute__(x)
#define _BSD_VA_LIST_ va_list
#include <stdarg.h>
#else
@@ -50,8 +46,8 @@
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
*/
#include <machine/ansi.h>
#include <sys/cdefs.h>
#endif
#include <sys/cdefs.h>
__BEGIN_DECLS
__dead void err(int, const char *, ...)

View File

@@ -32,12 +32,7 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
#ifdef __minix
#define __BEGIN_DECLS
#define __END_DECLS
#else
#include <sys/cdefs.h>
#endif
#include <unistd.h>
/*

View File

@@ -10,6 +10,7 @@
#ifndef _STDINT_H
#define _STDINT_H
#include <sys/cdefs.h>
#ifndef _MINIX__TYPES_H
#include <minix/types.h>
#endif
@@ -197,10 +198,6 @@ typedef unsigned long uintmax_t;
#endif /* !__cplusplus || __STDC_LIMIT_MACROS */
#ifndef __CONCAT
#define __CONCAT(x,y) x ## y
#endif
/* Constants of the proper type. */
#define INT8_C(c) c
#define INT16_C(c) c

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,