summaryrefslogtreecommitdiffstats
path: root/compat/stdbool.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-17 07:33:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-17 07:33:35 (GMT)
commit9039a4d498efadb7fcf4c44e9802e336e8ea0d28 (patch)
tree7c6f476eedfd116a870cf7cbae3c7368440cff6e /compat/stdbool.h
parente9115a94128c6653876d0827f50910ed7b589116 (diff)
downloadtk-9039a4d498efadb7fcf4c44e9802e336e8ea0d28.zip
tk-9039a4d498efadb7fcf4c44e9802e336e8ea0d28.tar.gz
tk-9039a4d498efadb7fcf4c44e9802e336e8ea0d28.tar.bz2
Replace stdbool.h by the llvm version. Suggested by Christian Gollwitzer for licence reasons. Thanks! Not actually used by Tk (yet).
Diffstat (limited to 'compat/stdbool.h')
-rw-r--r--compat/stdbool.h74
1 files changed, 31 insertions, 43 deletions
diff --git a/compat/stdbool.h b/compat/stdbool.h
index 04a3b61..6e74c58 100644
--- a/compat/stdbool.h
+++ b/compat/stdbool.h
@@ -1,49 +1,37 @@
-/* Copyright (C) 1998-2013 Free Software Foundation, Inc.
-This file is part of GCC.
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/*
- * ISO C Standard: 7.16 Boolean type and values <stdbool.h>
- */
-
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
-
+/*===---- stdbool.h - Standard header for booleans -------------------------===
+*
+* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+* See https://llvm.org/LICENSE.txt for license information.
+* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+*
+* Modified for use by pre-C99 compilers. (c) Jan Nijtmans.
+*
+*===-----------------------------------------------------------------------===
+*/
+
+#ifndef __STDBOOL_H
+#define __STDBOOL_H
+
+/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
-
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
-#define bool _Bool
+#define bool _Bool
#else
-#define bool unsigned char
+#define bool unsigned char
+#endif
+#define true 1
+#define false 0
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
+/* Define _Bool as a GNU extension. */
+#define _Bool bool
+#if __cplusplus < 201103L
+/* For C++98, define bool, false, true as a GNU extension. */
+#define bool bool
+#define false false
+#define true true
+#endif
#endif
-#define true 1
-#define false 0
-
-#else /* __cplusplus */
-
-/* Supporting <stdbool.h> in C++ is a GCC extension. */
-#define _Bool bool
-#define bool bool
-#define false false
-#define true true
-
-#endif /* __cplusplus */
-/* Signal that all the definitions are present. */
-#define __bool_true_false_are_defined 1
+#define __bool_true_false_are_defined 1
-#endif /* stdbool.h */
+#endif /* __STDBOOL_H */