public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-21 12:21   ` Pedro Alves
  2014-11-15 13:20 ` [PATCH 4/7] Import memchr explicitly Yao Qi
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

Since we'll add more modules in this list, better to keep them in
alphabetical order.

gdb:

	* gnulib/update-gnulib.sh: Make IMPORTED_GNULIB_MODULES in
	alphabetical order.
---
 gdb/gnulib/update-gnulib.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index 7fd3fae..ec1a8e8 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -30,17 +30,17 @@
 
 # The list of gnulib modules we are importing in GDB.
 IMPORTED_GNULIB_MODULES="\
+    dirent \
     dirfd \
     fnmatch-gnu \
     frexpl \
     inttypes \
     memmem \
-    update-copyright \
-    unistd \
     pathmax \
     strstr \
-    dirent \
     sys_stat \
+    unistd \
+    update-copyright \
 "
 
 # The gnulib commit ID to use for the update.
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 6/7] Include wchar.h and wctype.h unconditionally
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
                   ` (2 preceding siblings ...)
  2014-11-15 13:20 ` [PATCH 3/7] Include alloca.h unconditionally Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-21 12:49   ` Pedro Alves
  2014-11-15 13:20 ` [PATCH 5/7] Import wchar and wctype-h explicitly Yao Qi
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

As gnulib modules wchar and wctype is imported, we can include wchar.h
and wctype.h unconditionally.  This patch is also to remove HAVE_WCHAR_H
check.

gdb:

2014-11-15  Yao Qi  <yao@codesourcery.com>

	* gdb_wchar.h: Include wchar.h and wctype.h.
	[HAVE_ICONV && HAVE_BTOWC]: Don't check HAVE_WCHAR_T and don't
	include wchar.h and wctype.h.
	Don't check HAVE_WCHAR_H.
---
 gdb/gdb_wchar.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index f88673b..c7a0f1e 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -49,18 +49,18 @@
 #define PHONY_ICONV
 #endif
 
+#include <wchar.h>
+#include <wctype.h>
+
 /* We use "btowc" as a sentinel to detect functioning wchar_t support.
    We check for either __STDC_ISO_10646__ or a new-enough libiconv in
    order to ensure we can convert to and from wchar_t.  We choose
    libiconv version 0x108 because it is the first version with
    iconvlist.  */
-#if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC) \
+#if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \
   && (defined (__STDC_ISO_10646__) \
       || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
 
-#include <wchar.h>
-#include <wctype.h>
-
 typedef wchar_t gdb_wchar_t;
 typedef wint_t gdb_wint_t;
 
@@ -94,7 +94,7 @@ const char *intermediate_encoding (void);
 
 /* If we got here and have wchar_t support, we might be on a system
    with some problem.  So, we just disable everything.  */
-#if defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC)
+#if defined (HAVE_BTOWC)
 #define PHONY_ICONV
 #endif
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/7] Import alloca explicitly
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
                   ` (4 preceding siblings ...)
  2014-11-15 13:20 ` [PATCH 5/7] Import wchar and wctype-h explicitly Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-15 13:20 ` [PATCH 7/7] Import errno explicitly Yao Qi
  2014-11-21 11:54 ` [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
  7 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

gnulib's alloca module was imported to gdb, and alloca is used.  This
patch is to explicitly import it.

gdb:

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULE): Add
	alloca.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Likewise..
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
---
 gdb/gnulib/import/Makefile.am        | 2 +-
 gdb/gnulib/import/Makefile.in        | 2 +-
 gdb/gnulib/import/m4/gnulib-cache.m4 | 3 ++-
 gdb/gnulib/update-gnulib.sh          | 1 +
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am
index b27bb59..2eb76db 100644
--- a/gdb/gnulib/import/Makefile.am
+++ b/gdb/gnulib/import/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in
index 37dc843..fecc819 100644
--- a/gdb/gnulib/import/Makefile.in
+++ b/gdb/gnulib/import/Makefile.in
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
 
 
 
diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4
index ba67f77..1bf0458 100644
--- a/gdb/gnulib/import/m4/gnulib-cache.m4
+++ b/gdb/gnulib/import/m4/gnulib-cache.m4
@@ -27,11 +27,12 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
+  alloca
   dirent
   dirfd
   fnmatch-gnu
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index ec1a8e8..2d983ba 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -30,6 +30,7 @@
 
 # The list of gnulib modules we are importing in GDB.
 IMPORTED_GNULIB_MODULES="\
+    alloca \
     dirent \
     dirfd \
     fnmatch-gnu \
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 7/7] Import errno explicitly
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
                   ` (5 preceding siblings ...)
  2014-11-15 13:20 ` [PATCH 2/7] Import alloca explicitly Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-21 11:54 ` [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
  7 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

errno.h is included in common/common-defs.h, and gnulib errno module
was imported to gdb.  This patch is to import it explicitly.

gdb:

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	errno.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Likewise.
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
---
 gdb/gnulib/import/Makefile.am        | 2 +-
 gdb/gnulib/import/Makefile.in        | 2 +-
 gdb/gnulib/import/m4/gnulib-cache.m4 | 3 ++-
 gdb/gnulib/update-gnulib.sh          | 1 +
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am
index 1d89e65..22f7135 100644
--- a/gdb/gnulib/import/Makefile.am
+++ b/gdb/gnulib/import/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in
index 8a1a5fb..9068728 100644
--- a/gdb/gnulib/import/Makefile.in
+++ b/gdb/gnulib/import/Makefile.in
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 
 
diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4
index 2544842..8dd2a5c 100644
--- a/gdb/gnulib/import/m4/gnulib-cache.m4
+++ b/gdb/gnulib/import/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -35,6 +35,7 @@ gl_MODULES([
   alloca
   dirent
   dirfd
+  errno
   fnmatch-gnu
   frexpl
   inttypes
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index a0f6826..49527c1 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -33,6 +33,7 @@ IMPORTED_GNULIB_MODULES="\
     alloca \
     dirent \
     dirfd \
+    errno \
     fnmatch-gnu \
     frexpl \
     inttypes \
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 5/7] Import wchar and wctype-h explicitly
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
                   ` (3 preceding siblings ...)
  2014-11-15 13:20 ` [PATCH 6/7] Include wchar.h and wctype.h unconditionally Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-15 13:20 ` [PATCH 2/7] Import alloca explicitly Yao Qi
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

gnulib module wchar and wctype-h was imported as a dependency, but
they are used by gdb_wchar.h too.  This patch is to import them
explicitly.

gdb:

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add wchar
	and wctype-h.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Likewise.
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
---
 gdb/gnulib/import/Makefile.am        | 2 +-
 gdb/gnulib/import/Makefile.in        | 2 +-
 gdb/gnulib/import/m4/gnulib-cache.m4 | 4 +++-
 gdb/gnulib/update-gnulib.sh          | 2 ++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am
index a2824d2..1d89e65 100644
--- a/gdb/gnulib/import/Makefile.am
+++ b/gdb/gnulib/import/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in
index 8355e1d..8a1a5fb 100644
--- a/gdb/gnulib/import/Makefile.in
+++ b/gdb/gnulib/import/Makefile.in
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 
 
diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4
index b1af1a7..2544842 100644
--- a/gdb/gnulib/import/m4/gnulib-cache.m4
+++ b/gdb/gnulib/import/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -45,6 +45,8 @@ gl_MODULES([
   sys_stat
   unistd
   update-copyright
+  wchar
+  wctype-h
 ])
 gl_AVOID([])
 gl_SOURCE_BASE([import])
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index 6b745ac..a0f6826 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -43,6 +43,8 @@ IMPORTED_GNULIB_MODULES="\
     sys_stat \
     unistd \
     update-copyright \
+    wchar \
+    wctype-h \
 "
 
 # The gnulib commit ID to use for the update.
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 0/7] Import needed gnulib modules explicitly
@ 2014-11-15 13:20 Yao Qi
  2014-11-15 13:20 ` [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order Yao Qi
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

Nowadays, when we import a certain gnulib module, some other dependent
modules are imported as well.  Some of them are used by gdb, while some
are not.  However, we may not be aware of this fact.

In GDB, we should have a list of imported gnulib modules which are used
by GDB, so that it is clear to know what headers and api functions are
used from gnulib.

I go through all imported gnulib modules, and update update-gnulib.sh to
import modules used by GDB explicitly.  This is what this patch series
is doing.  Beside this, this patch series (patch 3 and patch 6) adjusts
code to not check header and api and use them directly.

*** BLURB HERE ***

Yao Qi (7):
  Make IMPORTED_GNULIB_MODULES in alphabetical order
  Import alloca explicitly
  Include alloca.h unconditionally
  Import memchr explicitly
  Import wchar and wctype-h explicitly
  Include wchar.h and wctype.h unconditionally
  Import errno explicitly

 gdb/common/common-defs.h             |   1 +
 gdb/configure                        | 190 ----------------------------------
 gdb/configure.ac                     |   1 -
 gdb/defs.h                           |  21 ----
 gdb/gdb_wchar.h                      |  10 +-
 gdb/gdbserver/configure              | 193 +----------------------------------
 gdb/gdbserver/configure.ac           |   2 -
 gdb/gdbserver/gdbreplay.c            |   4 +-
 gdb/gdbserver/server.h               |   3 -
 gdb/gnulib/import/Makefile.am        |   2 +-
 gdb/gnulib/import/Makefile.in        |   2 +-
 gdb/gnulib/import/m4/gnulib-cache.m4 |   7 +-
 gdb/gnulib/update-gnulib.sh          |  11 +-
 gdb/utils.c                          |   2 +-
 14 files changed, 26 insertions(+), 423 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/7] Include alloca.h unconditionally
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
  2014-11-15 13:20 ` [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order Yao Qi
  2014-11-15 13:20 ` [PATCH 4/7] Import memchr explicitly Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-21 12:21   ` Pedro Alves
  2014-11-15 13:20 ` [PATCH 6/7] Include wchar.h and wctype.h unconditionally Yao Qi
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

Since gnulib alloca module was imported, we can include alloca.h in
both gdb and gdbserver unconditionally, so this patch adds inclusion
of alloca.h in common-defs.h.  This patch also removes AC_FUNC_ALLOCA
in configure.ac because we don't need to check alloca any more.

This patch below is removed in fact.

  [RFA/commit] include alloca.h if available.
  https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html

Tested this patch by rebuilding gdb on x86-linux and aix.

gdb:

2014-11-15  Yao Qi  <yao@codesourcery.com>

	* common/common-defs.h: Include alloca.h
	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	* configure: Re-generated.
	* defs.h: Remove code handling alloca.
	* utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined
	or not.

gdb/gdbserver:

2014-11-15  Yao Qi  <yao@codesourcery.com>

	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	* configure: Re-generated.
	* server.h: Don't include alloca.h.
	* gdbreplay.c: Don't check HAVE_ALLOCA_H is defined.
---
 gdb/common/common-defs.h   |   1 +
 gdb/configure              | 190 --------------------------------------------
 gdb/configure.ac           |   1 -
 gdb/defs.h                 |  21 -----
 gdb/gdbserver/configure    | 193 +--------------------------------------------
 gdb/gdbserver/configure.ac |   2 -
 gdb/gdbserver/gdbreplay.c  |   4 +-
 gdb/gdbserver/server.h     |   3 -
 gdb/utils.c                |   2 +-
 9 files changed, 5 insertions(+), 412 deletions(-)

diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 4d2e8a7..0a5256a 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -33,6 +33,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <errno.h>
+#include <alloca.h>
 #include "ansidecl.h"
 #include "libiberty.h"
 #include "pathmax.h"
diff --git a/gdb/configure b/gdb/configure
index 1d6d88b..ade1755 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -10072,196 +10072,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 # Checks for library functions.  #
 # ------------------------------ #
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-			  if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
-else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
-
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
-int
-main ()
-{
-char *p = (char *) alloca (1);
-				    if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_func_alloca_works=yes
-else
-  ac_cv_func_alloca_works=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
-
-if test $ac_cv_func_alloca_works = yes; then
-
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
-
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
-
-$as_echo "#define C_ALLOCA 1" >>confdefs.h
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then :
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
-
-    break
-fi
-
-  done
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_c_stack_direction=0
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
-
-int
-main ()
-{
-  return find_stack_direction () < 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_stack_direction=1
-else
-  ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
-
-
-fi
-
 for ac_header in stdlib.h unistd.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 2d73669..98eb57b 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1302,7 +1302,6 @@ AC_C_BIGENDIAN
 # Checks for library functions.  #
 # ------------------------------ #
 
-AC_FUNC_ALLOCA
 AC_FUNC_MMAP
 AC_FUNC_VFORK
 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
diff --git a/gdb/defs.h b/gdb/defs.h
index 1eb43eb..6b63b6a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -548,27 +548,6 @@ enum gdb_osabi
 extern double atof (const char *);	/* X3.159-1989  4.10.1.1 */
 #endif
 
-/* Various possibilities for alloca.  */
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* Not GNU C */
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
-#pragma alloca
-#else
-
-/* We need to be careful not to declare this in a way which conflicts with
-   bison.  Bison never declares it as char *, but under various circumstances
-   (like __hpux) we need to use void *.  */
-extern void *alloca ();
-#endif /* Not _AIX */
-#endif /* Not HAVE_ALLOCA_H */
-#endif /* Not GNU C */
-#endif /* alloca not defined */
-
 /* Dynamic target-system-dependent parameters for GDB.  */
 #include "gdbarch.h"
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 9495905..f4c4422 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -605,6 +605,7 @@ WERROR_CFLAGS
 WARN_CFLAGS
 ustinc
 ustlibs
+ALLOCA
 SET_MAKE
 GMAKE_FALSE
 GMAKE_TRUE
@@ -614,7 +615,6 @@ DEPDIR
 am__leading_dot
 host_noncanonical
 target_noncanonical
-ALLOCA
 RANLIB
 AR
 INSTALL_DATA
@@ -4225,197 +4225,6 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 fi
 
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-			  if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
-else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
-
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
-int
-main ()
-{
-char *p = (char *) alloca (1);
-				    if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_func_alloca_works=yes
-else
-  ac_cv_func_alloca_works=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
-
-if test $ac_cv_func_alloca_works = yes; then
-
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
-
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
-
-$as_echo "#define C_ALLOCA 1" >>confdefs.h
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then :
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
-
-    break
-fi
-
-  done
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_c_stack_direction=0
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
-
-int
-main ()
-{
-  return find_stack_direction () < 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_stack_direction=1
-else
-  ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
-
-
-fi
-
-
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 8e5d74f..4cf2d50 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -39,8 +39,6 @@ AC_ARG_PROGRAM
 
 AC_HEADER_STDC
 
-AC_FUNC_ALLOCA
-
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index c70abef..ffe7392 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -48,9 +48,9 @@
 #if HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
 #endif
-#if HAVE_ALLOCA_H
+
 #include <alloca.h>
-#endif
+
 #if HAVE_MALLOC_H
 #include <malloc.h>
 #endif
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index cac73e9..857875a 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -29,9 +29,6 @@ gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
 
 #include "version.h"
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
 /* On some systems such as MinGW, alloca is declared in malloc.h
    (there is no alloca.h).  */
 #if HAVE_MALLOC_H
diff --git a/gdb/utils.c b/gdb/utils.c
index 3915b58..ff5c00d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2913,7 +2913,7 @@ gdb_realpath (const char *filename)
      pathconf()) making it impossible to pass a correctly sized buffer
      to realpath() (it could always overflow).  On those systems, we
      skip this.  */
-#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX) && defined(HAVE_ALLOCA)
+#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX)
   {
     /* Find out the max path size.  */
     long path_max = pathconf ("/", _PC_PATH_MAX);
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/7] Import memchr explicitly
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
  2014-11-15 13:20 ` [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order Yao Qi
@ 2014-11-15 13:20 ` Yao Qi
  2014-11-15 13:20 ` [PATCH 3/7] Include alloca.h unconditionally Yao Qi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-15 13:20 UTC (permalink / raw)
  To: gdb-patches

memchr has been used in gdb source and gnulib memchr module was
imported as a dependency.  This patch is to import it explicitly.

gdb:

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	memchr.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Likewise.
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
---
 gdb/gnulib/import/Makefile.am        | 2 +-
 gdb/gnulib/import/Makefile.in        | 2 +-
 gdb/gnulib/import/m4/gnulib-cache.m4 | 3 ++-
 gdb/gnulib/update-gnulib.sh          | 1 +
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am
index 2eb76db..a2824d2 100644
--- a/gdb/gnulib/import/Makefile.am
+++ b/gdb/gnulib/import/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in
index fecc819..8355e1d 100644
--- a/gdb/gnulib/import/Makefile.in
+++ b/gdb/gnulib/import/Makefile.in
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
 
 
 
diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4
index 1bf0458..b1af1a7 100644
--- a/gdb/gnulib/import/m4/gnulib-cache.m4
+++ b/gdb/gnulib/import/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memmem pathmax strstr sys_stat unistd update-copyright
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -38,6 +38,7 @@ gl_MODULES([
   fnmatch-gnu
   frexpl
   inttypes
+  memchr
   memmem
   pathmax
   strstr
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index 2d983ba..6b745ac 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -36,6 +36,7 @@ IMPORTED_GNULIB_MODULES="\
     fnmatch-gnu \
     frexpl \
     inttypes \
+    memchr \
     memmem \
     pathmax \
     strstr \
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] Import needed gnulib modules explicitly
  2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
                   ` (6 preceding siblings ...)
  2014-11-15 13:20 ` [PATCH 7/7] Import errno explicitly Yao Qi
@ 2014-11-21 11:54 ` Yao Qi
  2014-11-21 12:50   ` Pedro Alves
  7 siblings, 1 reply; 17+ messages in thread
From: Yao Qi @ 2014-11-21 11:54 UTC (permalink / raw)
  To: gdb-patches

Yao Qi <yao@codesourcery.com> writes:

> I go through all imported gnulib modules, and update update-gnulib.sh to
> import modules used by GDB explicitly.  This is what this patch series
> is doing.  Beside this, this patch series (patch 3 and patch 6) adjusts
> code to not check header and api and use them directly.

Although this patch series is a code refactor, patch 3 and patch 6 still
do some non-refactor changes, so a review to them will be great.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order
  2014-11-15 13:20 ` [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order Yao Qi
@ 2014-11-21 12:21   ` Pedro Alves
  0 siblings, 0 replies; 17+ messages in thread
From: Pedro Alves @ 2014-11-21 12:21 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 11/15/2014 01:20 PM, Yao Qi wrote:
> Since we'll add more modules in this list, better to keep them in
> alphabetical order.

Makes sense.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] Include alloca.h unconditionally
  2014-11-15 13:20 ` [PATCH 3/7] Include alloca.h unconditionally Yao Qi
@ 2014-11-21 12:21   ` Pedro Alves
  2014-11-21 13:05     ` Yao Qi
  0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2014-11-21 12:21 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 11/15/2014 01:20 PM, Yao Qi wrote:

> diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
> index c70abef..ffe7392 100644
> --- a/gdb/gdbserver/gdbreplay.c
> +++ b/gdb/gdbserver/gdbreplay.c
> @@ -48,9 +48,9 @@
>  #if HAVE_NETINET_TCP_H
>  #include <netinet/tcp.h>
>  #endif
> -#if HAVE_ALLOCA_H
> +
>  #include <alloca.h>
> -#endif
> +
>  #if HAVE_MALLOC_H
>  #include <malloc.h>
>  #endif

...

> diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
> index cac73e9..857875a 100644
> --- a/gdb/gdbserver/server.h
> +++ b/gdb/gdbserver/server.h
> @@ -29,9 +29,6 @@ gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
>  
>  #include "version.h"
>  
> -#ifdef HAVE_ALLOCA_H
> -#include <alloca.h>
> -#endif
>  /* On some systems such as MinGW, alloca is declared in malloc.h
>     (there is no alloca.h).  */
>  #if HAVE_MALLOC_H

We should remove the malloc.h includes too then, and the check
for malloc.h in configure.ac.  It's only included for alloca.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/7] Include wchar.h and wctype.h unconditionally
  2014-11-15 13:20 ` [PATCH 6/7] Include wchar.h and wctype.h unconditionally Yao Qi
@ 2014-11-21 12:49   ` Pedro Alves
  2014-11-21 13:22     ` Yao Qi
  0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2014-11-21 12:49 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 11/15/2014 01:20 PM, Yao Qi wrote:
> As gnulib modules wchar and wctype is imported, we can include wchar.h
> and wctype.h unconditionally.  This patch is also to remove HAVE_WCHAR_H
> check.
> 

> gdb:
> 
> 2014-11-15  Yao Qi  <yao@codesourcery.com>
> 
> 	* gdb_wchar.h: Include wchar.h and wctype.h.
> 	[HAVE_ICONV && HAVE_BTOWC]: Don't check HAVE_WCHAR_T and don't
> 	include wchar.h and wctype.h.
> 	Don't check HAVE_WCHAR_H.
> ---
>  gdb/gdb_wchar.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
> index f88673b..c7a0f1e 100644
> --- a/gdb/gdb_wchar.h
> +++ b/gdb/gdb_wchar.h
> @@ -49,18 +49,18 @@
>  #define PHONY_ICONV
>  #endif
>  
> +#include <wchar.h>
> +#include <wctype.h>
> +
>  /* We use "btowc" as a sentinel to detect functioning wchar_t support.
>     We check for either __STDC_ISO_10646__ or a new-enough libiconv in
>     order to ensure we can convert to and from wchar_t.  We choose
>     libiconv version 0x108 because it is the first version with
>     iconvlist.  */
> -#if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC) \
> +#if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \
>    && (defined (__STDC_ISO_10646__) \
>        || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
>  
> -#include <wchar.h>
> -#include <wctype.h>
> -
>  typedef wchar_t gdb_wchar_t;
>  typedef wint_t gdb_wint_t;
>  
> @@ -94,7 +94,7 @@ const char *intermediate_encoding (void);
>  
>  /* If we got here and have wchar_t support, we might be on a system
>     with some problem.  So, we just disable everything.  */
> -#if defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC)
> +#if defined (HAVE_BTOWC)
>  #define PHONY_ICONV
>  #endif

It's hard to reason about all the modes supported here, but
I think this is OK.  Seems like the comment above about wchar_t
support should be updated though.

(I wonder whether if we pulled in the gnulib btowc module, we could
get rid of at least some of this fallback stuff.  We're already
pulling in mbrtowc...)

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] Import needed gnulib modules explicitly
  2014-11-21 11:54 ` [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
@ 2014-11-21 12:50   ` Pedro Alves
  2014-11-21 14:06     ` Yao Qi
  0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2014-11-21 12:50 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 11/21/2014 11:54 AM, Yao Qi wrote:
> Yao Qi <yao@codesourcery.com> writes:
> 
>> I go through all imported gnulib modules, and update update-gnulib.sh to
>> import modules used by GDB explicitly.  This is what this patch series
>> is doing.  Beside this, this patch series (patch 3 and patch 6) adjusts
>> code to not check header and api and use them directly.
> 
> Although this patch series is a code refactor, patch 3 and patch 6 still
> do some non-refactor changes, so a review to them will be great.

Somehow, I didn't notice this thread at all until now.  :-(

I send a few comments, but overall this looks good to me.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] Include alloca.h unconditionally
  2014-11-21 12:21   ` Pedro Alves
@ 2014-11-21 13:05     ` Yao Qi
  2014-11-21 13:17       ` Pedro Alves
  0 siblings, 1 reply; 17+ messages in thread
From: Yao Qi @ 2014-11-21 13:05 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves <palves@redhat.com> writes:

>> -#ifdef HAVE_ALLOCA_H
>> -#include <alloca.h>
>> -#endif
>>  /* On some systems such as MinGW, alloca is declared in malloc.h
>>     (there is no alloca.h).  */
>>  #if HAVE_MALLOC_H
>
> We should remove the malloc.h includes too then, and the check
> for malloc.h in configure.ac.  It's only included for alloca.

That is a good point.  The patch below is to do so.

-- 
Yao (齐尧)

Subject: [PATCH] Include alloca.h unconditionally

Since gnulib alloca module was imported, we can include alloca.h in
both gdb and gdbserver unconditionally, so this patch adds inclusion
of alloca.h in common-defs.h.  This patch also removes AC_FUNC_ALLOCA
in configure.ac because we don't need to check alloca any more.

This patch below is removed in fact.

  [RFA/commit] include alloca.h if available.
  https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html

Since alloca.h is from gnulib now, we don't have to check malloc.h in
configure and include malloc.h in code.  This patch also removes them
too.

gdb:

2014-11-21  Yao Qi  <yao@codesourcery.com>

	* common/common-defs.h: Include alloca.h
	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	* configure: Re-generated.
	* defs.h: Remove code handling alloca.
	* utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined
	or not.

gdb/gdbserver:

2014-11-21  Yao Qi  <yao@codesourcery.com>

	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	(AC_CHECK_HEADERS): Remove malloc.h.
	* configure: Re-generated.
	* config.in: Re-generated.
	* server.h: Don't include alloca.h and malloc.h.
	* gdbreplay.c: Don't check HAVE_ALLOCA_H is defined.
	Don't include malloc.h.

diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 4d2e8a7..0a5256a 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -33,6 +33,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <errno.h>
+#include <alloca.h>
 #include "ansidecl.h"
 #include "libiberty.h"
 #include "pathmax.h"
diff --git a/gdb/configure b/gdb/configure
index 1d6d88b..ade1755 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -10072,196 +10072,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 # Checks for library functions.  #
 # ------------------------------ #
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-			  if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
-else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
-
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
-int
-main ()
-{
-char *p = (char *) alloca (1);
-				    if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_func_alloca_works=yes
-else
-  ac_cv_func_alloca_works=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
-
-if test $ac_cv_func_alloca_works = yes; then
-
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
-
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
-
-$as_echo "#define C_ALLOCA 1" >>confdefs.h
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then :
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
-
-    break
-fi
-
-  done
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_c_stack_direction=0
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
-
-int
-main ()
-{
-  return find_stack_direction () < 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_stack_direction=1
-else
-  ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
-
-
-fi
-
 for ac_header in stdlib.h unistd.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 2d73669..98eb57b 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1302,7 +1302,6 @@ AC_C_BIGENDIAN
 # Checks for library functions.  #
 # ------------------------------ #
 
-AC_FUNC_ALLOCA
 AC_FUNC_MMAP
 AC_FUNC_VFORK
 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
diff --git a/gdb/defs.h b/gdb/defs.h
index 1eb43eb..6b63b6a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -548,27 +548,6 @@ enum gdb_osabi
 extern double atof (const char *);	/* X3.159-1989  4.10.1.1 */
 #endif
 
-/* Various possibilities for alloca.  */
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* Not GNU C */
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
-#pragma alloca
-#else
-
-/* We need to be careful not to declare this in a way which conflicts with
-   bison.  Bison never declares it as char *, but under various circumstances
-   (like __hpux) we need to use void *.  */
-extern void *alloca ();
-#endif /* Not _AIX */
-#endif /* Not HAVE_ALLOCA_H */
-#endif /* Not GNU C */
-#endif /* alloca not defined */
-
 /* Dynamic target-system-dependent parameters for GDB.  */
 #include "gdbarch.h"
 
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 7828bf9..8cac205 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -96,9 +96,6 @@
 /* Define if <thread_db.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 9495905..2266617 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -605,6 +605,7 @@ WERROR_CFLAGS
 WARN_CFLAGS
 ustinc
 ustlibs
+ALLOCA
 SET_MAKE
 GMAKE_FALSE
 GMAKE_TRUE
@@ -614,7 +615,6 @@ DEPDIR
 am__leading_dot
 host_noncanonical
 target_noncanonical
-ALLOCA
 RANLIB
 AR
 INSTALL_DATA
@@ -4225,197 +4225,6 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 fi
 
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-			  if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
-else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
-
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
-int
-main ()
-{
-char *p = (char *) alloca (1);
-				    if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_func_alloca_works=yes
-else
-  ac_cv_func_alloca_works=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
-
-if test $ac_cv_func_alloca_works = yes; then
-
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
-
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
-
-$as_echo "#define C_ALLOCA 1" >>confdefs.h
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then :
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
-
-    break
-fi
-
-  done
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_c_stack_direction=0
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
-
-int
-main ()
-{
-  return find_stack_direction () < 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_stack_direction=1
-else
-  ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
-
-
-fi
-
-
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
@@ -4904,7 +4713,7 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach
   cd "$ac_popdir"
 
 
-for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h linux/elf.h 		 fcntl.h signal.h sys/file.h malloc.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h
+for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h linux/elf.h 		 fcntl.h signal.h sys/file.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 8e5d74f..3864ff4 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -39,8 +39,6 @@ AC_ARG_PROGRAM
 
 AC_HEADER_STDC
 
-AC_FUNC_ALLOCA
-
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
@@ -82,7 +80,7 @@ ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
 
 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
 		 proc_service.h sys/procfs.h linux/elf.h dnl
-		 fcntl.h signal.h sys/file.h malloc.h dnl
+		 fcntl.h signal.h sys/file.h dnl
 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
 		 netinet/tcp.h arpa/inet.h)
 AC_CHECK_FUNCS(pread pwrite pread64 readlink)
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index c70abef..dedf2bb 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -48,12 +48,9 @@
 #if HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
 #endif
-#if HAVE_ALLOCA_H
+
 #include <alloca.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
+
 #if USE_WIN32API
 #include <winsock2.h>
 #endif
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index cac73e9..02d751a 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -29,15 +29,6 @@ gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
 
 #include "version.h"
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-/* On some systems such as MinGW, alloca is declared in malloc.h
-   (there is no alloca.h).  */
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
 #if !HAVE_DECL_STRERROR
 #ifndef strerror
 extern char *strerror (int);	/* X3.159-1989  4.11.6.2 */
diff --git a/gdb/utils.c b/gdb/utils.c
index 3915b58..ff5c00d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2913,7 +2913,7 @@ gdb_realpath (const char *filename)
      pathconf()) making it impossible to pass a correctly sized buffer
      to realpath() (it could always overflow).  On those systems, we
      skip this.  */
-#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX) && defined(HAVE_ALLOCA)
+#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX)
   {
     /* Find out the max path size.  */
     long path_max = pathconf ("/", _PC_PATH_MAX);

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] Include alloca.h unconditionally
  2014-11-21 13:05     ` Yao Qi
@ 2014-11-21 13:17       ` Pedro Alves
  0 siblings, 0 replies; 17+ messages in thread
From: Pedro Alves @ 2014-11-21 13:17 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 11/21/2014 01:05 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>>> -#ifdef HAVE_ALLOCA_H
>>> -#include <alloca.h>
>>> -#endif
>>>  /* On some systems such as MinGW, alloca is declared in malloc.h
>>>     (there is no alloca.h).  */
>>>  #if HAVE_MALLOC_H
>>
>> We should remove the malloc.h includes too then, and the check
>> for malloc.h in configure.ac.  It's only included for alloca.
> 
> That is a good point.  The patch below is to do so.

Thanks.  This version looks good to me.

Pedro Alves

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/7] Include wchar.h and wctype.h unconditionally
  2014-11-21 12:49   ` Pedro Alves
@ 2014-11-21 13:22     ` Yao Qi
  0 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-21 13:22 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves <palves@redhat.com> writes:

> It's hard to reason about all the modes supported here, but
> I think this is OK.  Seems like the comment above about wchar_t
> support should be updated though.
>

At the beginning, I tried to change more than what I did in this patch,
but I got myself in trouble in these different modes, which I don't
fully understand.  I'll revisit it once my gnulib patches queue is empty.

> (I wonder whether if we pulled in the gnulib btowc module, we could
> get rid of at least some of this fallback stuff.  We're already
> pulling in mbrtowc...)

Agreed, that is one thing we could do.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] Import needed gnulib modules explicitly
  2014-11-21 12:50   ` Pedro Alves
@ 2014-11-21 14:06     ` Yao Qi
  0 siblings, 0 replies; 17+ messages in thread
From: Yao Qi @ 2014-11-21 14:06 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves <palves@redhat.com> writes:

> I send a few comments, but overall this looks good to me.

Thanks for the review.  This patch series is pushed in.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-11-21 14:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15 13:20 [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
2014-11-15 13:20 ` [PATCH 1/7] Make IMPORTED_GNULIB_MODULES in alphabetical order Yao Qi
2014-11-21 12:21   ` Pedro Alves
2014-11-15 13:20 ` [PATCH 4/7] Import memchr explicitly Yao Qi
2014-11-15 13:20 ` [PATCH 3/7] Include alloca.h unconditionally Yao Qi
2014-11-21 12:21   ` Pedro Alves
2014-11-21 13:05     ` Yao Qi
2014-11-21 13:17       ` Pedro Alves
2014-11-15 13:20 ` [PATCH 6/7] Include wchar.h and wctype.h unconditionally Yao Qi
2014-11-21 12:49   ` Pedro Alves
2014-11-21 13:22     ` Yao Qi
2014-11-15 13:20 ` [PATCH 5/7] Import wchar and wctype-h explicitly Yao Qi
2014-11-15 13:20 ` [PATCH 2/7] Import alloca explicitly Yao Qi
2014-11-15 13:20 ` [PATCH 7/7] Import errno explicitly Yao Qi
2014-11-21 11:54 ` [PATCH 0/7] Import needed gnulib modules explicitly Yao Qi
2014-11-21 12:50   ` Pedro Alves
2014-11-21 14:06     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).