diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/execinfo.c | 3 | ||||
| -rw-r--r-- | lib/execinfo.in.h | 54 | ||||
| -rw-r--r-- | lib/gnulib.mk | 27 | ||||
| -rw-r--r-- | lib/makefile.w32-in | 10 | ||||
| -rw-r--r-- | lib/stdbool.in.h | 51 |
5 files changed, 124 insertions, 21 deletions
diff --git a/lib/execinfo.c b/lib/execinfo.c new file mode 100644 index 00000000000..0bcd9f078ba --- /dev/null +++ b/lib/execinfo.c | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #include <config.h> | ||
| 2 | #define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE | ||
| 3 | #include "execinfo.h" | ||
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h new file mode 100644 index 00000000000..d76b0e1b771 --- /dev/null +++ b/lib/execinfo.in.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* Information about executables. | ||
| 2 | |||
| 3 | Copyright (C) 2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Paul Eggert. */ | ||
| 19 | |||
| 20 | #ifndef _GL_EXECINFO_H | ||
| 21 | #define _GL_EXECINFO_H | ||
| 22 | |||
| 23 | _GL_INLINE_HEADER_BEGIN | ||
| 24 | #ifndef _GL_EXECINFO_INLINE | ||
| 25 | # define _GL_EXECINFO_INLINE _GL_INLINE | ||
| 26 | #endif | ||
| 27 | |||
| 28 | _GL_EXECINFO_INLINE int | ||
| 29 | backtrace (void **buffer, int size) | ||
| 30 | { | ||
| 31 | (void) buffer; | ||
| 32 | (void) size; | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | _GL_EXECINFO_INLINE char ** | ||
| 37 | backtrace_symbols (void *const *buffer, int size) | ||
| 38 | { | ||
| 39 | (void) buffer; | ||
| 40 | (void) size; | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | _GL_EXECINFO_INLINE void | ||
| 45 | backtrace_symbols_fd (void *const *buffer, int size, int fd) | ||
| 46 | { | ||
| 47 | (void) buffer; | ||
| 48 | (void) size; | ||
| 49 | (void) fd; | ||
| 50 | } | ||
| 51 | |||
| 52 | _GL_INLINE_HEADER_END | ||
| 53 | |||
| 54 | #endif | ||
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index a90cc59bbde..d49eb4fdf7a 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -150,6 +150,31 @@ EXTRA_libgnu_a_SOURCES += dup2.c | |||
| 150 | 150 | ||
| 151 | ## end gnulib module dup2 | 151 | ## end gnulib module dup2 |
| 152 | 152 | ||
| 153 | ## begin gnulib module execinfo | ||
| 154 | |||
| 155 | BUILT_SOURCES += $(EXECINFO_H) | ||
| 156 | |||
| 157 | # We need the following in order to create <execinfo.h> when the system | ||
| 158 | # doesn't have one that works. | ||
| 159 | if GL_GENERATE_EXECINFO_H | ||
| 160 | execinfo.h: execinfo.in.h $(top_builddir)/config.status | ||
| 161 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 162 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 163 | cat $(srcdir)/execinfo.in.h; \ | ||
| 164 | } > $@-t && \ | ||
| 165 | mv $@-t $@ | ||
| 166 | else | ||
| 167 | execinfo.h: $(top_builddir)/config.status | ||
| 168 | rm -f $@ | ||
| 169 | endif | ||
| 170 | MOSTLYCLEANFILES += execinfo.h execinfo.h-t | ||
| 171 | |||
| 172 | EXTRA_DIST += execinfo.c execinfo.in.h | ||
| 173 | |||
| 174 | EXTRA_libgnu_a_SOURCES += execinfo.c | ||
| 175 | |||
| 176 | ## end gnulib module execinfo | ||
| 177 | |||
| 153 | ## begin gnulib module filemode | 178 | ## begin gnulib module filemode |
| 154 | 179 | ||
| 155 | libgnu_a_SOURCES += filemode.c | 180 | libgnu_a_SOURCES += filemode.c |
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index 11251d55f77..f0cea56f829 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in | |||
| @@ -28,6 +28,7 @@ GNULIBOBJS = $(BLD)/c-ctype.$(O) \ | |||
| 28 | $(BLD)/c-strncasecmp.$(O) \ | 28 | $(BLD)/c-strncasecmp.$(O) \ |
| 29 | $(BLD)/dtoastr.$(O) \ | 29 | $(BLD)/dtoastr.$(O) \ |
| 30 | $(BLD)/dtotimespec.$(O) \ | 30 | $(BLD)/dtotimespec.$(O) \ |
| 31 | $(BLD)/execinfo.$(O) \ | ||
| 31 | $(BLD)/getopt.$(O) \ | 32 | $(BLD)/getopt.$(O) \ |
| 32 | $(BLD)/getopt1.$(O) \ | 33 | $(BLD)/getopt1.$(O) \ |
| 33 | $(BLD)/gettime.$(O) \ | 34 | $(BLD)/gettime.$(O) \ |
| @@ -129,6 +130,11 @@ $(BLD)/dtotimespec.$(O) : \ | |||
| 129 | $(GNU_LIB)/timespec.h \ | 130 | $(GNU_LIB)/timespec.h \ |
| 130 | $(CONFIG_H) | 131 | $(CONFIG_H) |
| 131 | 132 | ||
| 133 | $(BLD)/execinfo.$(O) : \ | ||
| 134 | $(GNU_LIB)/execinfo.c \ | ||
| 135 | $(GNU_LIB)/execinfo.h \ | ||
| 136 | $(CONFIG_H) | ||
| 137 | |||
| 132 | $(BLD)/getopt.$(O) : \ | 138 | $(BLD)/getopt.$(O) : \ |
| 133 | $(GNU_LIB)/getopt.c \ | 139 | $(GNU_LIB)/getopt.c \ |
| 134 | $(GNU_LIB)/getopt.h \ | 140 | $(GNU_LIB)/getopt.h \ |
| @@ -299,3 +305,7 @@ getopt_h: | |||
| 299 | < getopt.in.h > getopt_.h-t | 305 | < getopt.in.h > getopt_.h-t |
| 300 | $(CP) getopt_.h-t getopt_.h | 306 | $(CP) getopt_.h-t getopt_.h |
| 301 | - $(DEL) getopt_.h-t | 307 | - $(DEL) getopt_.h-t |
| 308 | |||
| 309 | execinfo.h: execinfo.in.h | ||
| 310 | $(CP) execinfo.in.h $@ | ||
| 311 | |||
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h index ed1f9aa488b..1f8caee4f2d 100644 --- a/lib/stdbool.in.h +++ b/lib/stdbool.in.h | |||
| @@ -66,24 +66,19 @@ | |||
| 66 | # undef true | 66 | # undef true |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | /* For the sake of symbolic names in gdb, we define true and false as | 69 | #ifdef __cplusplus |
| 70 | enum constants, not only as macros. | 70 | # define _Bool bool |
| 71 | It is tempting to write | 71 | # define bool bool |
| 72 | typedef enum { false = 0, true = 1 } _Bool; | 72 | #else |
| 73 | so that gdb prints values of type 'bool' symbolically. But if we do | 73 | # if defined __BEOS__ && !defined __HAIKU__ |
| 74 | this, values of type '_Bool' may promote to 'int' or 'unsigned int' | ||
| 75 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | ||
| 76 | (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the | ||
| 77 | enum; this ensures that '_Bool' promotes to 'int'. */ | ||
| 78 | #if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) | ||
| 79 | /* A compiler known to have 'bool'. */ | 74 | /* A compiler known to have 'bool'. */ |
| 80 | /* If the compiler already has both 'bool' and '_Bool', we can assume they | 75 | /* If the compiler already has both 'bool' and '_Bool', we can assume they |
| 81 | are the same types. */ | 76 | are the same types. */ |
| 82 | # if !@HAVE__BOOL@ | 77 | # if !@HAVE__BOOL@ |
| 83 | typedef bool _Bool; | 78 | typedef bool _Bool; |
| 84 | # endif | 79 | # endif |
| 85 | #else | 80 | # else |
| 86 | # if !defined __GNUC__ | 81 | # if !defined __GNUC__ |
| 87 | /* If @HAVE__BOOL@: | 82 | /* If @HAVE__BOOL@: |
| 88 | Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when | 83 | Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when |
| 89 | the built-in _Bool type is used. See | 84 | the built-in _Bool type is used. See |
| @@ -103,19 +98,35 @@ typedef bool _Bool; | |||
| 103 | "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. | 98 | "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. |
| 104 | The only benefit of the enum, debuggability, is not important | 99 | The only benefit of the enum, debuggability, is not important |
| 105 | with these compilers. So use 'signed char' and no enum. */ | 100 | with these compilers. So use 'signed char' and no enum. */ |
| 106 | # define _Bool signed char | 101 | # define _Bool signed char |
| 107 | # else | 102 | # else |
| 108 | /* With this compiler, trust the _Bool type if the compiler has it. */ | 103 | /* With this compiler, trust the _Bool type if the compiler has it. */ |
| 109 | # if !@HAVE__BOOL@ | 104 | # if !@HAVE__BOOL@ |
| 105 | /* For the sake of symbolic names in gdb, define true and false as | ||
| 106 | enum constants, not only as macros. | ||
| 107 | It is tempting to write | ||
| 108 | typedef enum { false = 0, true = 1 } _Bool; | ||
| 109 | so that gdb prints values of type 'bool' symbolically. But then | ||
| 110 | values of type '_Bool' might promote to 'int' or 'unsigned int' | ||
| 111 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | ||
| 112 | (see ISO C 99 6.3.1.1.(2)). So add a negative value to the | ||
| 113 | enum; this ensures that '_Bool' promotes to 'int'. */ | ||
| 110 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; | 114 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; |
| 115 | # endif | ||
| 111 | # endif | 116 | # endif |
| 112 | # endif | 117 | # endif |
| 118 | # define bool _Bool | ||
| 113 | #endif | 119 | #endif |
| 114 | #define bool _Bool | ||
| 115 | 120 | ||
| 116 | /* The other macros must be usable in preprocessor directives. */ | 121 | /* The other macros must be usable in preprocessor directives. */ |
| 117 | #define false 0 | 122 | #ifdef __cplusplus |
| 118 | #define true 1 | 123 | # define false false |
| 124 | # define true true | ||
| 125 | #else | ||
| 126 | # define false 0 | ||
| 127 | # define true 1 | ||
| 128 | #endif | ||
| 129 | |||
| 119 | #define __bool_true_false_are_defined 1 | 130 | #define __bool_true_false_are_defined 1 |
| 120 | 131 | ||
| 121 | #endif /* _GL_STDBOOL_H */ | 132 | #endif /* _GL_STDBOOL_H */ |