From 042b5bf606d272a10a85bf9302fa9cac48b13527 Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Thu, 17 Jun 2010 15:14:57 +0000 Subject: [PATCH] We have sys/cdefs.h now, so remove hacks. --- commands/ash/alias.c | 2 +- commands/ash/eval.c | 2 +- commands/ash/exec.c | 2 +- commands/ash/expand.c | 2 +- commands/ash/input.c | 2 +- commands/ash/jobs.c | 2 +- commands/ash/miscbltin.c | 2 +- commands/ash/mkinit.c | 6 +----- commands/ash/mksyntax.c | 5 +---- commands/ash/parser.c | 2 +- commands/ash/shell.h | 2 -- commands/ash/var.c | 2 +- commands/tr/tr.c | 2 +- include/err.h | 6 +----- include/getopt.h | 5 ----- include/stdint.h | 5 +---- include/sys/cdefs.h | 19 +++++++++++++++++++ include/sys/queue.h | 5 ----- lib/libc/other/getopt_long.c | 2 -- 19 files changed, 33 insertions(+), 42 deletions(-) diff --git a/commands/ash/alias.c b/commands/ash/alias.c index 0d39732d3..e584ebcf3 100644 --- a/commands/ash/alias.c +++ b/commands/ash/alias.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/alias.c,v 1.18 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/eval.c b/commands/ash/eval.c index 02c4da1f6..a44ead002 100644 --- a/commands/ash/eval.c +++ b/commands/ash/eval.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/eval.c,v 1.42 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/exec.c b/commands/ash/exec.c index 5020819cd..923515fc6 100644 --- a/commands/ash/exec.c +++ b/commands/ash/exec.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/exec.c,v 1.24.2.1 2004/09/30 04:41:55 des Exp $"); */ diff --git a/commands/ash/expand.c b/commands/ash/expand.c index a0ef6924d..74309c4c9 100644 --- a/commands/ash/expand.c +++ b/commands/ash/expand.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/expand.c,v 1.46 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/input.c b/commands/ash/input.c index 5d531dbaa..fcd06ebe0 100644 --- a/commands/ash/input.c +++ b/commands/ash/input.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/input.c,v 1.22 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/jobs.c b/commands/ash/jobs.c index 792ffe7e4..2f5e7f48d 100644 --- a/commands/ash/jobs.c +++ b/commands/ash/jobs.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/jobs.c,v 1.67 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/miscbltin.c b/commands/ash/miscbltin.c index 86f05788d..d55567828 100644 --- a/commands/ash/miscbltin.c +++ b/commands/ash/miscbltin.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/miscbltin.c,v 1.30 2004/04/06 20:06:51 markm Exp $"); */ diff --git a/commands/ash/mkinit.c b/commands/ash/mkinit.c index dfb6829ab..4a3451fd9 100644 --- a/commands/ash/mkinit.c +++ b/commands/ash/mkinit.c @@ -41,8 +41,8 @@ static char const copyright[] = static char sccsid[] = "@(#)mkinit.c 8.2 (Berkeley) 5/4/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/mkinit.c,v 1.17 2004/04/06 20:06:51 markm Exp $"); */ @@ -65,10 +65,6 @@ __FBSDID("$FreeBSD: src/bin/sh/mkinit.c,v 1.17 2004/04/06 20:06:51 markm Exp $") #include #include -#ifdef __minix -#define __unused -#endif - /* * OUTFILE is the name of the output file. Output is initially written * to the file OUTTEMP, which is then moved to OUTFILE. diff --git a/commands/ash/mksyntax.c b/commands/ash/mksyntax.c index 71aadd557..830f11a3d 100644 --- a/commands/ash/mksyntax.c +++ b/commands/ash/mksyntax.c @@ -41,6 +41,7 @@ static char const copyright[] = static char sccsid[] = "@(#)mksyntax.c 8.2 (Berkeley) 5/4/95"; #endif /* not lint */ #endif +#include /* __FBSDID("$FreeBSD: src/bin/sh/mksyntax.c,v 1.23 2004/04/06 20:06:51 markm Exp $"); */ @@ -54,10 +55,6 @@ __FBSDID("$FreeBSD: src/bin/sh/mksyntax.c,v 1.23 2004/04/06 20:06:51 markm Exp $ #include #include "parser.h" -#ifdef __minix -#define __unused -#endif - struct synclass { char *name; char *comment; diff --git a/commands/ash/parser.c b/commands/ash/parser.c index 23375e4a7..20d462a88 100644 --- a/commands/ash/parser.c +++ b/commands/ash/parser.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/parser.c,v 1.51.2.1 2005/03/03 03:43:20 obrien Exp $"); */ diff --git a/commands/ash/shell.h b/commands/ash/shell.h index 9cdc1f309..9b995c431 100644 --- a/commands/ash/shell.h +++ b/commands/ash/shell.h @@ -82,8 +82,6 @@ extern char nullstr[1]; /* null string */ #endif #ifdef __minix -#define __unused - typedef long quad_t; /* XXX */ typedef unsigned long u_quad_t; /* XXX */ #endif diff --git a/commands/ash/var.c b/commands/ash/var.c index 82d8de1d7..b6665b29f 100644 --- a/commands/ash/var.c +++ b/commands/ash/var.c @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; #endif #endif /* not lint */ -/* #include +/* __FBSDID("$FreeBSD: src/bin/sh/var.c,v 1.26.2.1 2004/09/30 04:41:55 des Exp $"); */ diff --git a/commands/tr/tr.c b/commands/tr/tr.c index c014b7cfa..0a54cc062 100644 --- a/commands/tr/tr.c +++ b/commands/tr/tr.c @@ -29,8 +29,8 @@ * SUCH DAMAGE. */ -#if 0 #include +#if 0 #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1988, 1993\ The Regents of the University of California. All rights reserved."); diff --git a/include/err.h b/include/err.h index a5b99100e..c8e6df506 100644 --- a/include/err.h +++ b/include/err.h @@ -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 #else @@ -50,8 +46,8 @@ * _BSD_VA_LIST_ from and use it. */ #include -#include #endif +#include __BEGIN_DECLS __dead void err(int, const char *, ...) diff --git a/include/getopt.h b/include/getopt.h index 11155489b..71409fe08 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -32,12 +32,7 @@ #ifndef _GETOPT_H_ #define _GETOPT_H_ -#ifdef __minix -#define __BEGIN_DECLS -#define __END_DECLS -#else #include -#endif #include /* diff --git a/include/stdint.h b/include/stdint.h index 601dacd66..0cbf33b81 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -10,6 +10,7 @@ #ifndef _STDINT_H #define _STDINT_H +#include #ifndef _MINIX__TYPES_H #include #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 diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index cc7a905be..c982b3307 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -343,6 +343,25 @@ #define __predict_false(exp) (exp) #endif +/* + * We define this here since , , and + * 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 \ + (&reinterpret_cast \ + (static_cast (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 diff --git a/include/sys/queue.h b/include/sys/queue.h index 6757e2eb7..3a0a354c3 100644 --- a/include/sys/queue.h +++ b/include/sys/queue.h @@ -33,12 +33,7 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ -/* Minix doesn't have this file. #include -*/ - -/* 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, diff --git a/lib/libc/other/getopt_long.c b/lib/libc/other/getopt_long.c index 4c122839b..aaa53a581 100644 --- a/lib/libc/other/getopt_long.c +++ b/lib/libc/other/getopt_long.c @@ -30,9 +30,7 @@ */ #ifdef __minix -#define __P(x) x #define _DIAGASSERT assert -#define __UNCONST(x) ((void *) (x)) #else #if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h"