зеркало из https://github.com/github/ruby.git
internal/stdbool.h rework
Noticed that internal/stdbool.h and addr2line.c are the only two place where missing/stdbool.h is included. Why not delete the file so that we can merge internal/stdbool.h and missing/stdbool.h into one.
This commit is contained in:
Родитель
5e22f873ed
Коммит
8184adabe5
|
@ -25,11 +25,7 @@
|
||||||
#include <libproc.h>
|
#include <libproc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDBOOL_H
|
#include "internal/stdbool.h"
|
||||||
#include <stdbool.h>
|
|
||||||
#else
|
|
||||||
#include "missing/stdbool.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_ELF) || defined(HAVE_MACH_O_LOADER_H)
|
#if defined(USE_ELF) || defined(HAVE_MACH_O_LOADER_H)
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,22 @@
|
||||||
|
|
||||||
#ifdef HAVE_STDBOOL_H
|
#ifdef HAVE_STDBOOL_H
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
#else
|
|
||||||
# include "missing/stdbool.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Note that we assume the compiler isn't C++. */
|
||||||
|
#ifdef __bool_true_false_are_defined
|
||||||
|
# undef bool
|
||||||
|
# undef true
|
||||||
|
# undef false
|
||||||
|
# undef __bool_true_false_are_defined
|
||||||
|
#else
|
||||||
|
typedef unsigned char _Bool;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2229.htm */
|
||||||
|
#define bool _Bool
|
||||||
|
#define true ((_Bool)+1)
|
||||||
|
#define false ((_Bool)+0)
|
||||||
|
#define __bool_true_false_are_defined
|
||||||
|
|
||||||
#endif /* INTERNAL_STDBOOL_H */
|
#endif /* INTERNAL_STDBOOL_H */
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* missing/stdbool.h: Quick alternative of C99 stdbool.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _MISSING_STDBOOL_H_
|
|
||||||
#define _MISSING_STDBOOL_H_
|
|
||||||
|
|
||||||
#ifndef __bool_true_false_are_defined
|
|
||||||
# ifndef __cplusplus
|
|
||||||
# undef bool
|
|
||||||
# undef false
|
|
||||||
# undef true
|
|
||||||
# define bool signed char
|
|
||||||
# define false 0
|
|
||||||
# define true 1
|
|
||||||
# define __bool_true_false_are_defined 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MISSING_STDBOOL_H_ */
|
|
Загрузка…
Ссылка в новой задаче