gdb: remove HAVE_DECL_PTRACE
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 20 Mar 2020 15:57:49 +0000 (11:57 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 20 Mar 2020 15:57:49 +0000 (11:57 -0400)
I stumbled on this snippet in nat/gdb_ptrace.h:

    /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
       or whatever it's called these days, don't provide a prototype for
       ptrace.  Provide one to silence compiler warnings.  */

    #ifndef HAVE_DECL_PTRACE
    extern PTRACE_TYPE_RET ptrace();
    #endif

I believe this is unnecessary today and should be removed.  First, the
comment only mentions OSes we don't support (and to be honest, I had
never even heard of).

But most importantly, in C++, a declaration with empty parenthesis
declares a function that accepts no arguments, unlike in C.  So if this
declaration was really used, GDB wouldn't build, since all ptrace call
sites pass some arguments.  Since we haven't heard anything about this
causing some build failures since we have transitioned to C++, I
conclude that it's not used.

This patch removes it as well as the corresponding configure check.

gdb/ChangeLog:

* ptrace.m4: Don't check for ptrace declaration.
* config.in: Re-generate.
* configure: Re-generate.
* nat/gdb_ptrace.h: Don't declare ptrace if HAVE_DECL_PTRACE is
not defined.

gdbserver/ChangeLog:

* config.in: Re-generate.
* configure: Re-generate.

gdbsupport/ChangeLog:

* config.in: Re-generate.
* configure: Re-generate.

gdb/ChangeLog
gdb/config.in
gdb/configure
gdb/nat/gdb_ptrace.h
gdb/ptrace.m4
gdbserver/ChangeLog
gdbserver/config.in
gdbserver/configure
gdbsupport/ChangeLog
gdbsupport/config.in
gdbsupport/configure

index 650b74bae4ad3f752153da14e1b0f2dd2c2d178e..393b0d278d9cefa5c24f27cb1738d19859b57ec9 100644 (file)
@@ -1,3 +1,11 @@
+2020-03-20  Simon Marchi  <simon.marchi@efficios.com>
+
+       * ptrace.m4: Don't check for ptrace declaration.
+       * config.in: Re-generate.
+       * configure: Re-generate.
+       * nat/gdb_ptrace.h: Don't declare ptrace if HAVE_DECL_PTRACE is
+       not defined.
+
 2020-03-20  Kamil Rytarowski  <n54@gmx.com>
 
        * amd64-bsd-nat.c (gdb_ptrace): Change return type from `int' to
index 7a34b85e57542c2d429af24584be71b63505ce87..118e424580e5b9b3dcec49ff18f6a20f98602b9d 100644 (file)
    don't. */
 #undef HAVE_DECL_GETTHRDS
 
-/* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't.
-   */
-#undef HAVE_DECL_PTRACE
-
 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_SNPRINTF
index 614f3402c3d681967311c8c5bcfaa834753e0b06..afafc2c8d1812d7bc9a7add8ffd3ed89dd6e1c55 100755 (executable)
@@ -15000,26 +15000,6 @@ gdb_ptrace_headers='
 # include <unistd.h>
 #endif
 '
-# There is no point in checking if we don't have a prototype.
-ac_fn_c_check_decl "$LINENO" "ptrace" "ac_cv_have_decl_ptrace" "$gdb_ptrace_headers
-"
-if test "x$ac_cv_have_decl_ptrace" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_PTRACE $ac_have_decl
-_ACEOF
-if test $ac_have_decl = 1; then :
-
-else
-
-  : ${gdb_cv_func_ptrace_ret='int'}
-  : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-
-fi
 
 # Check return type.  Varargs (used on GNU/Linux) conflict with the
 # empty argument list, so check for that explicitly.
index 9c2587f2e822a9a55394f46fa71d724cb61ebfdd..1278246559c00609ad4dd6b8244cddd6f016cc3a 100644 (file)
 # endif
 #endif
 
-/* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
-   or whatever it's called these days, don't provide a prototype for
-   ptrace.  Provide one to silence compiler warnings.  */
-
-#ifndef HAVE_DECL_PTRACE
-extern PTRACE_TYPE_RET ptrace();
-#endif
-
 /* Some systems, at least AIX and HP-UX have a ptrace with five
    arguments.  Since we never use the fifth argument, define a ptrace
    macro that calls the real ptrace with the last argument set to
index 4cd7652718a97e5edaf0e34c57d624078b8afbbf..0fcd855aa8fd44f9614b0aced6f7649af733060e 100644 (file)
@@ -31,11 +31,7 @@ gdb_ptrace_headers='
 # include <unistd.h>
 #endif
 '
-# There is no point in checking if we don't have a prototype.
-AC_CHECK_DECLS(ptrace, [], [
-  : ${gdb_cv_func_ptrace_ret='int'}
-  : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-], $gdb_ptrace_headers)
+
 # Check return type.  Varargs (used on GNU/Linux) conflict with the
 # empty argument list, so check for that explicitly.
 AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
index ea8a079fbf276bfa9c03852cb83d7011524ca607..37e38611d5dfa9bbfce500ace08d62585673aa99 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-20  Simon Marchi  <simon.marchi@efficios.com>
+
+       * config.in: Re-generate.
+       * configure: Re-generate.
+
 2020-03-17  Kamil Rytarowski  <n54@gmx.com>
 
        * regcache.cc (find_register_by_number): Update.
index e62795072f208fecf302f7f96bed977f5d07a1fc..da1bdbe3d946d8941f47f3836e3998bba8684608 100644 (file)
    */
 #undef HAVE_DECL_PERROR
 
-/* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't.
-   */
-#undef HAVE_DECL_PTRACE
-
 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_SNPRINTF
index 55cf2416b568357dc5dc6493ddebc330cbe94c74..0de11f7ee619a91041cfe3c56d293e2374e65724 100755 (executable)
@@ -9413,26 +9413,6 @@ gdb_ptrace_headers='
 # include <unistd.h>
 #endif
 '
-# There is no point in checking if we don't have a prototype.
-ac_fn_c_check_decl "$LINENO" "ptrace" "ac_cv_have_decl_ptrace" "$gdb_ptrace_headers
-"
-if test "x$ac_cv_have_decl_ptrace" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_PTRACE $ac_have_decl
-_ACEOF
-if test $ac_have_decl = 1; then :
-
-else
-
-  : ${gdb_cv_func_ptrace_ret='int'}
-  : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-
-fi
 
 # Check return type.  Varargs (used on GNU/Linux) conflict with the
 # empty argument list, so check for that explicitly.
index f62e440af7f56af5583d63890adcabb2eae056f9..7631b2d1e8e1ab4f8c522c4491cbf7023521392a 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-20  Simon Marchi  <simon.marchi@efficios.com>
+
+       * config.in: Re-generate.
+       * configure: Re-generate.
+
 2020-03-17  Kamil Rytarowski  <n54@gmx.com>
 
        * common-defs.h: Include alloca.h if HAVE_ALLOCA_H is defined.
index 6a6b0bc74f09f2916d7191111bca1420b3213d5a..94e90ecc54516f21e384d38b0a0fa94be8292a84 100644 (file)
 /* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
 #undef HAVE_DECL_FFS
 
-/* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't.
-   */
-#undef HAVE_DECL_PTRACE
-
 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_SNPRINTF
index 2ffe539eb092cb125fd43b896633ae72de3deed2..186cac6d574575d38d32768dfa06033287665cc1 100755 (executable)
@@ -10666,26 +10666,6 @@ gdb_ptrace_headers='
 # include <unistd.h>
 #endif
 '
-# There is no point in checking if we don't have a prototype.
-ac_fn_c_check_decl "$LINENO" "ptrace" "ac_cv_have_decl_ptrace" "$gdb_ptrace_headers
-"
-if test "x$ac_cv_have_decl_ptrace" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_PTRACE $ac_have_decl
-_ACEOF
-if test $ac_have_decl = 1; then :
-
-else
-
-  : ${gdb_cv_func_ptrace_ret='int'}
-  : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-
-fi
 
 # Check return type.  Varargs (used on GNU/Linux) conflict with the
 # empty argument list, so check for that explicitly.
This page took 0.041361 seconds and 4 git commands to generate.