bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] execinfo: new module


From: Paul Eggert
Subject: [PATCH] execinfo: new module
Date: Wed, 22 Aug 2012 01:49:38 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

This is for Emacs.  Currently, it provides a no-effect stub
on all platforms where it does not already work.
It already works on glibc-based systems, and on Solaris 11.
* lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4, modules/execinfo:
New files.
* doc/glibc-headers/execinfo.texi (execinfo.h):
* MODULES.html.sh (Misc): Document it.
---
 ChangeLog                       |   11 ++++++++
 MODULES.html.sh                 |    1 +
 doc/glibc-headers/execinfo.texi |    7 +++-
 lib/execinfo.c                  |    3 ++
 lib/execinfo.in.h               |   54 +++++++++++++++++++++++++++++++++++++++
 m4/execinfo.m4                  |   21 +++++++++++++++
 modules/execinfo                |   40 ++++++++++++++++++++++++++++
 7 files changed, 135 insertions(+), 2 deletions(-)
 create mode 100644 lib/execinfo.c
 create mode 100644 lib/execinfo.in.h
 create mode 100644 m4/execinfo.m4
 create mode 100644 modules/execinfo

diff --git a/ChangeLog b/ChangeLog
index 9d9266e..7c09a08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-22  Paul Eggert  <address@hidden>
+
+       execinfo: new module
+       This is for Emacs.  Currently, it provides a no-effect stub
+       on all platforms where it does not already work.
+       It already works on glibc-based systems, and on Solaris 11.
+       * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4, modules/execinfo:
+       New files.
+       * doc/glibc-headers/execinfo.texi (execinfo.h):
+       * MODULES.html.sh (Misc): Document it.
+
 2012-08-20  Paul Eggert  <address@hidden>
 
        extern-inline: support old GCC 'inline'
diff --git a/MODULES.html.sh b/MODULES.html.sh
index d67c41d..8ced611 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2000,6 +2000,7 @@ func_all_modules ()
   func_module crc
   func_module diacrit
   func_module diffseq
+  func_module execinfo
   func_module getline
   func_module getdelim
   func_module getnline
diff --git a/doc/glibc-headers/execinfo.texi b/doc/glibc-headers/execinfo.texi
index 51e6d98..6c31c74 100644
--- a/doc/glibc-headers/execinfo.texi
+++ b/doc/glibc-headers/execinfo.texi
@@ -21,11 +21,14 @@ Gnulib module: ---
 
 Portability problems fixed by Gnulib:
 @itemize
+This header file is missing on some platforms:
+Mac OS X 10.3, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, 
HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 9, Interix 3.5, 
BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This header file is missing on some platforms:
-Mac OS X 10.3, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, 
HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 9, Interix 3.5, 
BeOS.
+On platforms where the header file is missing,
+the Gnulib substitute implementation is just a stub,
+and does nothing.
 @end itemize
diff --git a/lib/execinfo.c b/lib/execinfo.c
new file mode 100644
index 0000000..0bcd9f0
--- /dev/null
+++ b/lib/execinfo.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE
+#include "execinfo.h"
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h
new file mode 100644
index 0000000..057ba25
--- /dev/null
+++ b/lib/execinfo.in.h
@@ -0,0 +1,54 @@
+/* Information about executables.
+
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 of the License, or
+   (at your option) any later version.
+
+   This program 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_EXECINFO_H
+#define _GL_EXECINFO_H
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_EXECINFO_INLINE
+# define _GL_EXECINFO_INLINE _GL_INLINE
+#endif
+
+_GL_EXECINFO_INLINE int
+backtrace (void **buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE char **
+backtrace_symbols (void *const *buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE void
+backtrace_symbols_fd (void *const *buffer, int size, int fd)
+{
+  (void) buffer;
+  (void) size;
+  (void) fd;
+}
+
+_GL_INLINE_HEADER_END
+
+#endif
diff --git a/m4/execinfo.m4 b/m4/execinfo.m4
new file mode 100644
index 0000000..fa2b845
--- /dev/null
+++ b/m4/execinfo.m4
@@ -0,0 +1,21 @@
+# Check for GNU-style execinfo.h.
+
+dnl Copyright 2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXECINFO_H],
+[
+  AC_CHECK_HEADERS_ONCE([execinfo.h])
+
+  if test $ac_cv_header_execinfo_h = yes; then
+    EXECINFO_H=''
+  else
+    EXECINFO_H='execinfo.h'
+    AC_LIBOBJ([execinfo])
+  fi
+
+  AC_SUBST([EXECINFO_H])
+  AM_CONDITIONAL([GL_GENERATE_EXECINFO_H], [test -n "$EXECINFO_H"])
+])
diff --git a/modules/execinfo b/modules/execinfo
new file mode 100644
index 0000000..1578216
--- /dev/null
+++ b/modules/execinfo
@@ -0,0 +1,40 @@
+Description:
+A GNU-like <execinfo.h>.
+
+Files:
+lib/execinfo.c
+lib/execinfo.in.h
+m4/execinfo.m4
+
+Depends-on:
+extern-inline
+
+configure.ac:
+gl_EXECINFO_H
+
+Makefile.am:
+BUILT_SOURCES += $(EXECINFO_H)
+
+# We need the following in order to create <execinfo.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_EXECINFO_H
+execinfo.h: execinfo.in.h $(top_builddir)/config.status
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/execinfo.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+else
+execinfo.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += execinfo.h execinfo.h-t
+
+Include:
+<execinfo.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
-- 
1.7.6.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]