stdbool.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright (C) 1998-2022 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /*
  19. * ISO C Standard: 7.16 Boolean type and values <stdbool.h>
  20. */
  21. #ifndef _STDBOOL_H
  22. #define _STDBOOL_H
  23. #ifndef __cplusplus
  24. #define bool _Bool
  25. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  26. #define true ((_Bool)+1u)
  27. #define false ((_Bool)+0u)
  28. #else
  29. #define true 1
  30. #define false 0
  31. #endif
  32. #else /* __cplusplus */
  33. /* Supporting _Bool in C++ is a GCC extension. */
  34. #define _Bool bool
  35. #endif /* __cplusplus */
  36. /* Signal that all the definitions are present. */
  37. #define __bool_true_false_are_defined 1
  38. #endif /* stdbool.h */