Mercurial > ~dholland > hg > tradcpp > index.cgi
changeset 183:4c3375895c6e
Don't use <stdbool.h> unless __STDC__ is large enough.
Works around Solaris's broken environment.
author | David A. Holland |
---|---|
date | Fri, 12 Jun 2015 03:28:19 -0400 |
parents | f7814226906c |
children | d359d9b86327 |
files | CHANGES bool.h directive.c eval.h files.c macro.h main.c mode.h place.h utils.h |
diffstat | 10 files changed, 51 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES Fri Jun 12 03:21:36 2015 -0400 +++ b/CHANGES Fri Jun 12 03:28:19 2015 -0400 @@ -1,4 +1,6 @@ pending + - Don't rely on <stdbool.h> existing, as (predictably) it doesn't + work on Solaris. - Typo fix in man page from Jason McIntyre; and change "Usage" to "usage" in usage for pedantic reasons, from Igor Sobrado. - Accept "-" as either input or output file name to mean stdin or
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bool.h Fri Jun 12 03:28:19 2015 -0400 @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2015 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by David A. Holland. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BOOL_H +#define BOOL_H + +#if __STDC__ > 199901 +#include <stdbool.h> +#else +typedef int bool; +#define true 1 +#define false 0 +#endif + +#endif /* BOOL_H */
--- a/directive.c Fri Jun 12 03:21:36 2015 -0400 +++ b/directive.c Fri Jun 12 03:28:19 2015 -0400 @@ -28,12 +28,12 @@ */ #include <assert.h> -#include <stdbool.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <errno.h> +#include "bool.h" #include "utils.h" #include "mode.h" #include "place.h"
--- a/eval.h Fri Jun 12 03:21:36 2015 -0400 +++ b/eval.h Fri Jun 12 03:28:19 2015 -0400 @@ -27,6 +27,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdbool.h> +#include "bool.h" bool eval(struct place *p, char *expr);
--- a/files.c Fri Jun 12 03:21:36 2015 -0400 +++ b/files.c Fri Jun 12 03:28:19 2015 -0400 @@ -27,7 +27,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -35,6 +34,7 @@ #include <fcntl.h> #include <errno.h> +#include "bool.h" #include "array.h" #include "mode.h" #include "place.h"
--- a/macro.h Fri Jun 12 03:21:36 2015 -0400 +++ b/macro.h Fri Jun 12 03:28:19 2015 -0400 @@ -27,8 +27,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdbool.h> #include <stddef.h> +#include "bool.h" struct place;
--- a/main.c Fri Jun 12 03:21:36 2015 -0400 +++ b/main.c Fri Jun 12 03:28:19 2015 -0400 @@ -27,13 +27,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdbool.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <errno.h> +#include "bool.h" #include "version.h" #include "config.h" #include "utils.h"
--- a/mode.h Fri Jun 12 03:21:36 2015 -0400 +++ b/mode.h Fri Jun 12 03:28:19 2015 -0400 @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdbool.h> +#include "bool.h" struct mode { bool werror;