Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 02/14] -Wmissing-prototypes: proc-service.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
@ 2012-02-29 16:17 ` Pedro Alves
  2012-02-29 16:17 ` [PATCH 03/14] -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior Pedro Alves
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:17 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" proc-service.o amd64-linux-nat.o 1>/dev/null
../../src/gdb/proc-service.c:116:1: warning: no previous prototype for ‘ps_pstop’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:125:1: warning: no previous prototype for ‘ps_pcontinue’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:135:1: warning: no previous prototype for ‘ps_lstop’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:145:1: warning: no previous prototype for ‘ps_lcontinue’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:157:1: warning: no previous prototype for ‘ps_lgetxregsize’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:167:1: warning: no previous prototype for ‘ps_lgetxregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:177:1: warning: no previous prototype for ‘ps_lsetxregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:186:1: warning: no previous prototype for ‘ps_plog’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:200:1: warning: no previous prototype for ‘ps_pglobal_lookup’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:218:1: warning: no previous prototype for ‘ps_pdread’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:227:1: warning: no previous prototype for ‘ps_pdwrite’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:237:1: warning: no previous prototype for ‘ps_ptread’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:246:1: warning: no previous prototype for ‘ps_ptwrite’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:256:1: warning: no previous prototype for ‘ps_lgetregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:275:1: warning: no previous prototype for ‘ps_lsetregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:294:1: warning: no previous prototype for ‘ps_lgetfpregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:314:1: warning: no previous prototype for ‘ps_lsetfpregs’ [-Wmissing-prototypes]
../../src/gdb/proc-service.c:334:1: warning: no previous prototype for ‘ps_getpid’ [-Wmissing-prototypes]
../../src/gdb/amd64-linux-nat.c:442:1: warning: no previous prototype for ‘ps_get_thread_area’ [-Wmissing-prototypes]

arm-linux-nat.c, mips-linux-nat.c, i386-linux-nat.c will warn just
like amd64-linux-nat.c above.

I don't have proc_service.h on my system.  Maybe glibc stopped
installing it at some point?  This patch adds the missing fallback
prototypes to gdb_proc_service.h, under !HAVE_PROC_SERVICE_H, mostly
copied from glibc's proc_service.h.

Build tested on x86_64 Fedora.

2012-02-29  Pedro Alves  <palves@redhat.com>

	Import fallback definitions from glibc.

	* gdb_proc_service.h [!HAVE_PROC_SERVICE_H] (struct
	ps_prochandle): Forward declare.
	(ps_err_e): Use glibc's comments.
	[!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
	(ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
	(ps_lsetfpregs, ps_getpid, ps_get_thread_area, ps_pglobal_lookup)
	(ps_pstop, ps_pcontinue, ps_lstop, ps_lcontinue, ps_lgetxregsize)
	(ps_lgetxregs, ps_lsetxregs, ps_plog): Declare.
	(struct ps_prochandle): Adjust comment.
---
 gdb/gdb_proc_service.h |  110 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 101 insertions(+), 9 deletions(-)

diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index 42309b8..34167a0 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -23,7 +23,31 @@
 
 #ifdef HAVE_PROC_SERVICE_H
 #include <proc_service.h>
-#else
+
+#else /* HAVE_PROC_SERVICE_H */
+
+/* The following fallback definitions have been imported and adjusted
+   from glibc's proc_service.h  */
+
+/* Callback interface for libthread_db, functions users must define.
+   Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The definitions in this file must correspond to those in the debugger.  */
 
 #ifdef HAVE_SYS_PROCFS_H
 #include <sys/procfs.h>
@@ -31,15 +55,16 @@
 
 #include "gregset.h"
 
+/* Functions in this interface return one of these status codes.  */
 typedef enum
 {
-  PS_OK,			/* Success.  */
-  PS_ERR,			/* Generic error.  */
-  PS_BADPID,			/* Bad process handle.  */
-  PS_BADLID,			/* Bad LWP id.  */
-  PS_BADADDR,			/* Bad address.  */
-  PS_NOSYM,			/* Symbol not found.  */
-  PS_NOFREGS			/* FPU register set not available.  */
+  PS_OK,		/* Generic "call succeeded".  */
+  PS_ERR,		/* Generic error. */
+  PS_BADPID,		/* Bad process handle.  */
+  PS_BADLID,		/* Bad LWP identifier.  */
+  PS_BADADDR,		/* Bad address.  */
+  PS_NOSYM,		/* Could not find given symbol.  */
+  PS_NOFREGS		/* FPU register set not available for given LWP.  */
 } ps_err_e;
 
 #ifndef HAVE_LWPID_T
@@ -58,6 +83,73 @@ typedef gdb_gregset_t prgregset_t;
 typedef gdb_fpregset_t prfpregset_t;
 #endif
 
+/* This type is opaque in this interface.  It's defined by the user of
+   libthread_db.  GDB's version is defined below.  */
+struct ps_prochandle;
+
+
+/* Read or write process memory at the given address.  */
+extern ps_err_e ps_pdread (struct ps_prochandle *,
+			   psaddr_t, void *, size_t);
+extern ps_err_e ps_pdwrite (struct ps_prochandle *,
+			    psaddr_t, const void *, size_t);
+extern ps_err_e ps_ptread (struct ps_prochandle *,
+			   psaddr_t, void *, size_t);
+extern ps_err_e ps_ptwrite (struct ps_prochandle *,
+			    psaddr_t, const void *, size_t);
+
+
+/* Get and set the given LWP's general or FPU register set.  */
+extern ps_err_e ps_lgetregs (struct ps_prochandle *,
+			     lwpid_t, prgregset_t);
+extern ps_err_e ps_lsetregs (struct ps_prochandle *,
+			     lwpid_t, const prgregset_t);
+extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
+			       lwpid_t, prfpregset_t *);
+extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
+			       lwpid_t, const prfpregset_t *);
+
+/* Return the PID of the process.  */
+extern pid_t ps_getpid (struct ps_prochandle *);
+
+/* Fetch the special per-thread address associated with the given LWP.
+   This call is only used on a few platforms (most use a normal register).
+   The meaning of the `int' parameter is machine-dependent.  */
+extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
+				    lwpid_t, int, psaddr_t *);
+
+
+/* Look up the named symbol in the named DSO in the symbol tables
+   associated with the process being debugged, filling in *SYM_ADDR
+   with the corresponding run-time address.  */
+extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
+				   const char *object_name,
+				   const char *sym_name,
+				   psaddr_t *sym_addr);
+
+
+/* Stop or continue the entire process.  */
+extern ps_err_e ps_pstop (struct ps_prochandle *);
+extern ps_err_e ps_pcontinue (struct ps_prochandle *);
+
+/* Stop or continue the given LWP alone.  */
+extern ps_err_e ps_lstop (struct ps_prochandle *, lwpid_t);
+extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t);
+
+/* The following are only defined in/called by Solaris.  */
+
+/* Get size of extra register set.  */
+extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph,
+				 lwpid_t lwpid, int *xregsize);
+/* Get extra register set.  */
+extern ps_err_e ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
+			      caddr_t xregset);
+extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
+			      caddr_t xregset);
+
+/* Log a message (sends to gdb_stderr).  */
+extern void ps_plog (const char *fmt, ...);
+
 #endif /* HAVE_PROC_SERVICE_H */
 
 /* Fix-up some broken systems.  */
@@ -72,7 +164,7 @@ typedef gdb_fpregset_t gdb_prfpregset_t;
 typedef prfpregset_t gdb_prfpregset_t;
 #endif
 
-/* Structure that identifies the target process.  */
+/* GDB specific structure that identifies the target process.  */
 struct ps_prochandle
 {
   /* The LWP we use for memory reads.  */


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

* [PATCH 03/14] -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
  2012-02-29 16:17 ` [PATCH 02/14] -Wmissing-prototypes: proc-service Pedro Alves
@ 2012-02-29 16:17 ` Pedro Alves
  2012-02-29 16:17 ` [PATCH 01/14] -Wmissing-prototypes: Ada Pedro Alves
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:17 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" inferior.o 1>/dev/null
../../src/gdb/inferior.c:182:1: warning: no previous prototype for ‘delete_threads_of_inferior’ [-Wmissing-prototypes]
...

Turns out the function isn't used anywhere.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* inferior.c (delete_threads_of_inferior): Delete.
---
 gdb/inferior.c |   19 -------------------
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 51748a9..327385a 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -178,25 +178,6 @@ delete_thread_of_inferior (struct thread_info *tp, void *data)
   return 0;
 }
 
-void
-delete_threads_of_inferior (int pid)
-{
-  struct inferior *inf;
-  struct delete_thread_of_inferior_arg arg;
-
-  for (inf = inferior_list; inf; inf = inf->next)
-    if (inf->pid == pid)
-      break;
-
-  if (!inf)
-    return;
-
-  arg.pid = pid;
-  arg.silent = 1;
-
-  iterate_over_threads (delete_thread_of_inferior, &arg);
-}
-
 /* If SILENT then be quiet -- don't announce a inferior death, or the
    exit of its threads.  */
 


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

* [PATCH 00/14] -Wmissing-prototypes: Intro
@ 2012-02-29 16:17 Pedro Alves
  2012-02-29 16:17 ` [PATCH 02/14] -Wmissing-prototypes: proc-service Pedro Alves
                   ` (15 more replies)
  0 siblings, 16 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:17 UTC (permalink / raw)
  To: gdb-patches

It's that time of the year again...

Back in Feb 2008, and then on Feb 2009 again, I cleaned up the tree to
make it buildable with -Wmissing-prototypes on
x86_64-unknown-linux-gnu (--enable-targets=all, I think), but I ended
up not adding -Wmissing-prototypes to the default warnings set.  Since
then, another set of -Wmissing-prototypes problems cropped up.

So this series fixes all I could see, and then proposes finally
enabling -Wmissing-prototypes by default, to make sure I won't go
through this again in Feb 2013...

This warning is quite useful as it catches these kinds of issues:

 - modules (.c files) that don't include their own header, where
   there's potential to change some function's prototype in the .c
   file, and forget to adjust it in the .h file, and then you end up
   scratching your head wondering why is GDB behaving funny or
   crashing (because clients of your function hadn't been adjusted to
   the new prototype, because they were still being compiled with the
   old prototype in the header).

 - It's harder to end up with extern functions that should be static,
   because the compiler will complain that it hasn't seen a prototype
   for the function.  In most cases, the fix for the warning it to
   make the function static.

 - Helps get rid of unused functions.  The above point means that as
   soon as you make the function static, if there are no callers to
   the function, the compiler will complain about an unused static
   function, so you end up deleting the dead code.

   There are examples of all these in the series.

Tested on x86_64 Fedora 16.

---

Pedro Alves (14):
      -Wmissing-prototypes: Ada.
      -Wmissing-prototypes: proc-service.
      -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior.
      -Wmissing-prototypes: Python
      -Wmissing-prototypes: cleanup encode_actions hack.
      -Wmissing-prototypes: TUI.
      -Wmissing-prototypes: inline-frame.c.
      -Wmissing-prototypes: The find_and_open_source hack.
      -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible).
      -Wmissing-prototypes: common/signals.c.
      -Wmissing-prototypes: observer.c's testsuite helpers.
      -Wmissing-prototypes: hook linux_has_shared_address_space.
      -Wmissing-prototypes: All others.
      -Wmissing-prototypes: Build with -Wmissing-prototypes by default.


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

* [PATCH 01/14] -Wmissing-prototypes: Ada.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
  2012-02-29 16:17 ` [PATCH 02/14] -Wmissing-prototypes: proc-service Pedro Alves
  2012-02-29 16:17 ` [PATCH 03/14] -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior Pedro Alves
@ 2012-02-29 16:17 ` Pedro Alves
  2012-02-29 17:19   ` Joel Brobecker
  2012-02-29 16:18 ` [PATCH 06/14] -Wmissing-prototypes: The TUI Pedro Alves
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:17 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" ada-lang.o ada-exp.o 1>/dev/null
../../src/gdb/ada-lang.c:10536:1: warning: no previous prototype for ‘ada_modulus_from_name’ [-Wmissing-prototypes]
In file included from ../../src/gdb/ada-exp.y:765:0:
../../src/gdb/ada-lex.l:298:1: warning: no previous prototype for ‘lexer_init’ [-Wmissing-prototypes]

ada_modulus_from_name was made orphan by:

commit 345826d325cdf374077d253274477c5b56b45edc
Author: Paul N. Hilfinger <hilfinger@adacore.com>
Date:   Mon Dec 14 06:19:12 2009 +0000

...
	* ada-lang.c (ada_modulus): Use new extended bound values.
...

Okay to apply?

2012-02-29  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_modulus_from_name): Delete.
	* ada-lex.l (lexer_init): Make static.
---
 gdb/ada-lang.c |   31 -------------------------------
 gdb/ada-lex.l  |    2 +-
 2 files changed, 1 insertions(+), 32 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 107df93..84049eb 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10528,37 +10528,6 @@ ada_is_modular_type (struct type *type)
           && TYPE_UNSIGNED (subranged_type));
 }
 
-/* Try to determine the lower and upper bounds of the given modular type
-   using the type name only.  Return non-zero and set L and U as the lower
-   and upper bounds (respectively) if successful.  */
-
-int
-ada_modulus_from_name (struct type *type, ULONGEST *modulus)
-{
-  const char *name = ada_type_name (type);
-  const char *suffix;
-  int k;
-  LONGEST U;
-
-  if (name == NULL)
-    return 0;
-
-  /* Discrete type bounds are encoded using an __XD suffix.  In our case,
-     we are looking for static bounds, which means an __XDLU suffix.
-     Moreover, we know that the lower bound of modular types is always
-     zero, so the actual suffix should start with "__XDLU_0__", and
-     then be followed by the upper bound value.  */
-  suffix = strstr (name, "__XDLU_0__");
-  if (suffix == NULL)
-    return 0;
-  k = 10;
-  if (!ada_scan_number (suffix, k, &U, NULL))
-    return 0;
-
-  *modulus = (ULONGEST) U + 1;
-  return 1;
-}
-
 /* Assuming ada_is_modular_type (TYPE), the modulus of TYPE.  */
 
 ULONGEST
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 48667d0..784edbf 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -293,7 +293,7 @@ false		{ return FALSEKEYWORD; }
 
 /* Initialize the lexer for processing new expression. */
 
-void
+static void
 lexer_init (FILE *inp)
 {
   BEGIN INITIAL;


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

* [PATCH 04/14] -Wmissing-prototypes: Python.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (3 preceding siblings ...)
  2012-02-29 16:18 ` [PATCH 06/14] -Wmissing-prototypes: The TUI Pedro Alves
@ 2012-02-29 16:18 ` Pedro Alves
  2012-02-29 18:09   ` Tom Tromey
  2012-02-29 16:18 ` [PATCH 05/14] -Wmissing-prototypes: The encode_actions hack Pedro Alves
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:18 UTC (permalink / raw)
  To: gdb-patches

../../src/gdb/python/py-breakpoint.c:720:1: warning: no previous prototype for ‘gdbpy_should_stop’ [-Wmissing-prototypes]
../../src/gdb/python/py-breakpoint.c:767:1: warning: no previous prototype for ‘gdbpy_breakpoint_has_py_cond’ [-Wmissing-prototypes]
../../src/gdb/python/py-continueevent.c:25:1: warning: no previous prototype for ‘create_continue_event_object’ [-Wmissing-prototypes]
../../src/gdb/python/py-lazy-string.c:88:1: warning: no previous prototype for ‘stpy_get_type’ [-Wmissing-prototypes]
../../src/gdb/python/py-newobjfileevent.c:25:1: warning: no previous prototype for ‘create_new_objfile_event_object’ [-Wmissing-prototypes]
../../src/gdb/python/py-utils.c:143:1: warning: no previous prototype for ‘unicode_to_target_python_string’ [-Wmissing-prototypes]
../../src/gdb/python/py-value.c:165:1: warning: no previous prototype for ‘preserve_python_values’ [-Wmissing-prototypes]

Most are obvious, and I think including the public "python.h" in
py-breakpoint.c and py-value.c is the right thing to do, given that
the functions in question are indeed public and to be used by core
gdb.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* python/py-breakpoint.c: Include python.h.
	* python/py-continueevent.c (create_continue_event_object): Make static.
	* python/py-lazy-string.c (stpy_get_type): Make static.
	* python/py-newobjfileevent.c (create_new_objfile_event_object): Make static.
	* python/py-utils.c (unicode_to_target_python_string): Make static.
	* python/py-value.c: Include python.h.
---
 gdb/python/py-breakpoint.c      |    1 +
 gdb/python/py-continueevent.c   |    2 +-
 gdb/python/py-lazy-string.c     |    2 +-
 gdb/python/py-newobjfileevent.c |    2 +-
 gdb/python/py-utils.c           |    2 +-
 gdb/python/py-value.c           |    1 +
 6 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 195ed2b..c13fb95 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -21,6 +21,7 @@
 #include "value.h"
 #include "exceptions.h"
 #include "python-internal.h"
+#include "python.h"
 #include "charset.h"
 #include "breakpoint.h"
 #include "gdbcmd.h"
diff --git a/gdb/python/py-continueevent.c b/gdb/python/py-continueevent.c
index 4582fb5..2a1524e 100644
--- a/gdb/python/py-continueevent.c
+++ b/gdb/python/py-continueevent.c
@@ -21,7 +21,7 @@
 
 static PyTypeObject continue_event_object_type;
 
-PyObject *
+static PyObject *
 create_continue_event_object (void)
 {
   return create_thread_event_object (&continue_event_object_type);
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 11048b3..3c90829 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -84,7 +84,7 @@ stpy_get_length (PyObject *self, void *closure)
   return PyLong_FromLong (self_string->length);
 }
 
-PyObject *
+static PyObject *
 stpy_get_type (PyObject *self, void *closure)
 {
   lazy_string_object *str_obj = (lazy_string_object *) self;
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 1e26b04..d014be6 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -21,7 +21,7 @@
 
 static PyTypeObject new_objfile_event_object_type;
 
-PyObject *
+static PyObject *
 create_new_objfile_event_object (struct objfile *objfile)
 {
   PyObject *objfile_event;
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index bf50e37..d5d0e431 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -139,7 +139,7 @@ unicode_to_target_string (PyObject *unicode_str)
    object converted to the target's charset.  If an error occurs
    during the conversion, NULL will be returned and a python exception
    will be set.  */
-PyObject *
+static PyObject *
 unicode_to_target_python_string (PyObject *unicode_str)
 {
   return unicode_to_encoded_python_string (unicode_str,
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 760360e..44443e0 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -28,6 +28,7 @@
 #include "infcall.h"
 #include "expression.h"
 #include "cp-abi.h"
+#include "python.h"
 
 #ifdef HAVE_PYTHON
 


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

* [PATCH 05/14] -Wmissing-prototypes: The encode_actions hack.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (4 preceding siblings ...)
  2012-02-29 16:18 ` [PATCH 04/14] -Wmissing-prototypes: Python Pedro Alves
@ 2012-02-29 16:18 ` Pedro Alves
  2012-02-29 16:19 ` [PATCH 07/14] -Wmissing-prototypes: inline-frame.c Pedro Alves
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:18 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" tracepoint.o 1>/dev/null
[...]
../../src/gdb/tracepoint.c:1581:1: warning: no previous prototype for ‘encode_actions’ [-Wmissing-prototypes]
[...]

This moves the declaration to the proper header...

2012-02-29  Pedro Alves  <palves@redhat.com>

	* remote.c (encode_actions): Delete declaration.
	* tracepoint.c (encode_actions): Make extern.
	* tracepoint.h (encode_actions): Declare.
---
 gdb/remote.c     |    3 ---
 gdb/tracepoint.c |    3 ++-
 gdb/tracepoint.h |    3 +++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 2719241..baa3dda 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -69,9 +69,6 @@
 /* Temp hacks for tracepoint encoding migration.  */
 static char *target_buf;
 static long target_buf_size;
-/*static*/ void
-encode_actions (struct breakpoint *t, struct bp_location *tloc,
-		char ***tdp_actions, char ***stepping_actions);
 
 /* The size to align memory write packets, when practical.  The protocol
    does not guarantee any alignment, and gdb will generate short
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 37e1f52..824d572 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1577,7 +1577,8 @@ encode_actions_1 (struct command_line *action,
 }
 
 /* Render all actions into gdb protocol.  */
-/*static*/ void
+
+void
 encode_actions (struct breakpoint *t, struct bp_location *tloc,
 		char ***tdp_actions, char ***stepping_actions)
 {
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 00c4d7c..4003c66 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -238,6 +238,9 @@ void free_actions (struct breakpoint *);
 
 extern char *decode_agent_options (char *exp);
 
+extern void encode_actions (struct breakpoint *t, struct bp_location *tloc,
+			    char ***tdp_actions, char ***stepping_actions);
+
 extern void validate_actionline (char **, struct breakpoint *);
 
 extern void end_actions_pseudocommand (char *args, int from_tty);


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

* [PATCH 06/14] -Wmissing-prototypes: The TUI.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (2 preceding siblings ...)
  2012-02-29 16:17 ` [PATCH 01/14] -Wmissing-prototypes: Ada Pedro Alves
@ 2012-02-29 16:18 ` Pedro Alves
  2012-02-29 16:18 ` [PATCH 04/14] -Wmissing-prototypes: Python Pedro Alves
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:18 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" tui-data.o tui-regs.o 1>/dev/null
../../src/gdb/tui/tui-data.c:316:1: warning: no previous prototype for ‘set_gen_win_origin’ [-Wmissing-prototypes]
../../src/gdb/tui/tui-regs.c:137:1: warning: no previous prototype for ‘tui_last_reg_element_no_in_line’ [-Wmissing-prototypes]

Turns out these functions are orphans.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* tui/tui-data.c (set_gen_win_origin): Delete.
	* tui/tui-data.h (tui_set_gen_win_origin): Delete declaration.
	* tui/tui-regs.c (tui_last_reg_element_no_in_line): Delete.
---
 gdb/tui/tui-data.c |   10 ----------
 gdb/tui/tui-data.h |    2 --
 gdb/tui/tui-regs.c |   13 -------------
 3 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index e7e0749..1f74b3f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -311,16 +311,6 @@ tui_set_current_layout_to (enum tui_layout_type new_layout)
 }
 
 
-/* Set the origin of the window.  */
-void
-set_gen_win_origin (struct tui_gen_win_info *win_info, 
-		    int x, int y)
-{
-  win_info->origin.x = x;
-  win_info->origin.y = y;
-}
-
-
 /*****************************
 ** OTHER PUBLIC FUNCTIONS
 *****************************/
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 50619d2..5df73d2 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -341,8 +341,6 @@ extern int tui_term_height (void);
 extern void tui_set_term_height_to (int);
 extern int tui_term_width (void);
 extern void tui_set_term_width_to (int);
-extern void tui_set_gen_win_origin (struct tui_gen_win_info *, 
-				    int, int);
 extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
 extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void);
 extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void);
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index a093e91..62c0fad 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -131,19 +131,6 @@ tui_first_reg_element_no_inline (int line_no)
 }
 
 
-/* Answer the index of the last element in line_no.  If line_no is
-   past the register area (-1) is returned.  */
-int
-tui_last_reg_element_no_in_line (int line_no)
-{
-  if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count) <=
-      TUI_DATA_WIN->detail.data_display_info.regs_content_count)
-    return ((line_no + 1) *
-	    TUI_DATA_WIN->detail.data_display_info.regs_column_count) - 1;
-  else
-    return (-1);
-}
-
 /* Show the registers of the given group in the data window
    and refresh the window.  */
 void


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

* [PATCH 07/14] -Wmissing-prototypes: inline-frame.c.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (5 preceding siblings ...)
  2012-02-29 16:18 ` [PATCH 05/14] -Wmissing-prototypes: The encode_actions hack Pedro Alves
@ 2012-02-29 16:19 ` Pedro Alves
  2012-02-29 16:20 ` [PATCH 10/14] -Wmissing-prototypes: common/signals.c Pedro Alves
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:19 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" inline-frame.o 1>/dev/null
../../src/gdb/inline-frame.c:113:1: warning: no previous prototype for ‘clear_inline_frame_state’ [-Wmissing-prototypes]
../../src/gdb/inline-frame.c:302:1: warning: no previous prototype for ‘skip_inline_frames’ [-Wmissing-prototypes]
../../src/gdb/inline-frame.c:351:1: warning: no previous prototype for ‘step_into_inline_frame’ [-Wmissing-prototypes]
../../src/gdb/inline-frame.c:364:1: warning: no previous prototype for ‘inline_skipped_frames’ [-Wmissing-prototypes]
../../src/gdb/inline-frame.c:378:1: warning: no previous prototype for ‘inline_skipped_symbol’ [-Wmissing-prototypes]
../../src/gdb/inline-frame.c:391:1: warning: no previous prototype for ‘frame_inlined_callees’ [-Wmissing-prototypes]

A case of a module not including its own header.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* inline-frame.c: Include inline-frame.h.
---
 gdb/inline-frame.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 3e2da73..06de5b0 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "inline-frame.h"
 #include "addrmap.h"
 #include "block.h"
 #include "frame-unwind.h"


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

* [PATCH 10/14] -Wmissing-prototypes: common/signals.c.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (6 preceding siblings ...)
  2012-02-29 16:19 ` [PATCH 07/14] -Wmissing-prototypes: inline-frame.c Pedro Alves
@ 2012-02-29 16:20 ` Pedro Alves
  2012-02-29 16:20 ` [PATCH 08/14] -Wmissing-prototypes: The find_and_open_source hack Pedro Alves
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:20 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" signals.o 1>/dev/null
../../src/gdb/common/signals.c:664:1: warning: no previous prototype for ‘target_signal_from_command’ [-Wmissing-prototypes]
../../src/gdb/common/signals.c:682:1: warning: no previous prototype for ‘default_target_signal_to_host’ [-Wmissing-prototypes]
../../src/gdb/common/signals.c:688:1: warning: no previous prototype for ‘default_target_signal_from_host’ [-Wmissing-prototypes]

The fix is to move the GDB specific bits into GDB proper, since
they're really not common.  I don't think the _initialize_signals
check is useful anymore now that the signals are build from a single
.def table/file, so I'm just removing it, thus getting rid of the
whole !GDBSERVER conditional.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* common/signals.c (default_target_signal_to_host)
	(default_target_signal_from_host): Move ...
	* arch-utils.c: ... here.
	* arch-utils.h (default_target_signal_to_host)
	(default_target_signal_from_host): Declare.

	* common/signals.c (target_signal_from_command): Move ...
	* infrun.c: ... here.
	* inferior.h (target_signal_from_command): Declare.
	* target.h (target_signal_from_command)
	(default_target_signal_from_host, default_target_signal_to_host):
	Delete declarations.

	* common/signals.c (_initialize_signals): Delete.
---
 gdb/arch-utils.c     |   12 ++++++++++++
 gdb/arch-utils.h     |    5 +++++
 gdb/common/signals.c |   42 ------------------------------------------
 gdb/inferior.h       |   10 ++++++++++
 gdb/infrun.c         |    9 +++++++++
 gdb/target.h         |   10 ----------
 6 files changed, 36 insertions(+), 52 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index e683a2d..fabb515 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -793,6 +793,18 @@ default_gen_return_address (struct gdbarch *gdbarch,
   error (_("This architecture has no method to collect a return address."));
 }
 
+int
+default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
+{
+  return target_signal_to_host (ts);
+}
+
+enum target_signal
+default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
+{
+  return target_signal_from_host (signo);
+}
+
 /* */
 
 /* -Wmissing-prototypes */
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 7c398b3..c2c3398 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -172,4 +172,9 @@ extern void default_gen_return_address (struct gdbarch *gdbarch,
 extern const char *default_auto_charset (void);
 extern const char *default_auto_wide_charset (void);
 
+extern enum target_signal default_target_signal_from_host (struct gdbarch *,
+							   int);
+extern int default_target_signal_to_host (struct gdbarch *,
+					  enum target_signal);
+
 #endif
diff --git a/gdb/common/signals.c b/gdb/common/signals.c
index 75699db..2e82e9c 100644
--- a/gdb/common/signals.c
+++ b/gdb/common/signals.c
@@ -649,45 +649,3 @@ target_signal_to_host (enum target_signal oursig)
   else
     return targ_signo;
 }
-
-#ifndef GDBSERVER
-
-/* In some circumstances we allow a command to specify a numeric
-   signal.  The idea is to keep these circumstances limited so that
-   users (and scripts) develop portable habits.  For comparison,
-   POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
-   numeric signal at all is obsolescent.  We are slightly more
-   lenient and allow 1-15 which should match host signal numbers on
-   most systems.  Use of symbolic signal names is strongly encouraged.  */
-
-enum target_signal
-target_signal_from_command (int num)
-{
-  if (num >= 1 && num <= 15)
-    return (enum target_signal) num;
-  error (_("Only signals 1-15 are valid as numeric signals.\n\
-Use \"info signals\" for a list of symbolic signals."));
-}
-
-extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */
-
-void
-_initialize_signals (void)
-{
-  if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
-    internal_error (__FILE__, __LINE__, "failed internal consistency check");
-}
-
-int
-default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
-{
-  return target_signal_to_host (ts);
-}
-
-enum target_signal
-default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
-{
-  return target_signal_from_host (signo);
-}
-
-#endif /* ! GDBSERVER */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 65abf26..9b2817f 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -645,4 +645,14 @@ extern struct inferior *add_inferior_with_spaces (void);
 
 extern void update_observer_mode (void);
 
+/* In some circumstances we allow a command to specify a numeric
+   signal.  The idea is to keep these circumstances limited so that
+   users (and scripts) develop portable habits.  For comparison,
+   POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
+   numeric signal at all is obsolescent.  We are slightly more lenient
+   and allow 1-15 which should match host signal numbers on most
+   systems.  Use of symbolic signal names is strongly encouraged.  */
+
+enum target_signal target_signal_from_command (int num);
+
 #endif /* !defined (INFERIOR_H) */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 89f9362..8ea4b9c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6441,6 +6441,15 @@ xdb_handle_command (char *args, int from_tty)
   do_cleanups (old_chain);
 }
 
+enum target_signal
+target_signal_from_command (int num)
+{
+  if (num >= 1 && num <= 15)
+    return (enum target_signal) num;
+  error (_("Only signals 1-15 are valid as numeric signals.\n\
+Use \"info signals\" for a list of symbolic signals."));
+}
+
 /* Print current contents of the tables set by the handle command.
    It is possible we should just be printing signals actually used
    by the current target (but for things to work right when switching
diff --git a/gdb/target.h b/gdb/target.h
index e786817..e5679b1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1827,16 +1827,6 @@ extern int remote_timeout;
 /* This is for native targets which use a unix/POSIX-style waitstatus.  */
 extern void store_waitstatus (struct target_waitstatus *, int);
 
-/* These are in common/signals.c, but they're only used by gdb.  */
-extern enum target_signal default_target_signal_from_host (struct gdbarch *,
-							   int);
-extern int default_target_signal_to_host (struct gdbarch *, 
-					  enum target_signal);
-
-/* Convert from a number used in a GDB command to an enum target_signal.  */
-extern enum target_signal target_signal_from_command (int);
-/* End of files in common/signals.c.  */
-
 /* Set the show memory breakpoints mode to show, and installs a cleanup
    to restore it back to the current value.  */
 extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);


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

* [PATCH 08/14] -Wmissing-prototypes: The find_and_open_source hack.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (7 preceding siblings ...)
  2012-02-29 16:20 ` [PATCH 10/14] -Wmissing-prototypes: common/signals.c Pedro Alves
@ 2012-02-29 16:20 ` Pedro Alves
  2012-02-29 16:21 ` [PATCH 11/14] -Wmissing-prototypes: observer.c's testsuite helpers Pedro Alves
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:20 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" source.o psymtab.o 1>/dev/null
../../src/gdb/source.c:995:1: warning: no previous prototype for ‘find_and_open_source’ [-Wmissing-prototypes]

Another case of a function declaration appearing in a module that uses
the function, instead of in a proper header.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* psymtab.c (find_and_open_source): Delete declaration.
	* source.c (find_and_open_source): Move comment ...
	* source.h (find_and_open_source): ... to this new declaration.
---
 gdb/psymtab.c |    4 ----
 gdb/source.c  |   20 --------------------
 gdb/source.h  |   23 +++++++++++++++++++++++
 3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index e42545b..f894028 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1131,10 +1131,6 @@ map_symbol_filenames_psymtab (struct objfile *objfile,
     }
 }
 
-int find_and_open_source (const char *filename,
-			  const char *dirname,
-			  char **fullname);
-
 /* Finds the fullname that a partial_symtab represents.
 
    If this functions finds the fullname, it will save it in ps->fullname
diff --git a/gdb/source.c b/gdb/source.c
index 909f252..cfdf81b 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -971,26 +971,6 @@ rewrite_source_path (const char *path)
   return new_path;
 }
 
-/* This function is capable of finding the absolute path to a
-   source file, and opening it, provided you give it a FILENAME.  Both the
-   DIRNAME and FULLNAME are only added suggestions on where to find the file.
-
-   FILENAME should be the filename to open.
-   DIRNAME is the compilation directory of a particular source file.
-           Only some debug formats provide this info.
-   FULLNAME can be the last known absolute path to the file in question.
-     Space for the path must have been malloc'd.  If a path substitution
-     is applied we free the old value and set a new one.
-
-   On Success 
-     A valid file descriptor is returned (the return value is positive).
-     FULLNAME is set to the absolute path to the file just opened.
-     The caller is responsible for freeing FULLNAME.
-
-   On Failure
-     An invalid file descriptor is returned (the return value is negative).
-     FULLNAME is set to NULL.  */
-
 int
 find_and_open_source (const char *filename,
 		      const char *dirname,
diff --git a/gdb/source.h b/gdb/source.h
index 3ee8e53..bf9a688 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -21,6 +21,29 @@
 
 struct symtab;
 
+/* This function is capable of finding the absolute path to a
+   source file, and opening it, provided you give it a FILENAME.  Both the
+   DIRNAME and FULLNAME are only added suggestions on where to find the file.
+
+   FILENAME should be the filename to open.
+   DIRNAME is the compilation directory of a particular source file.
+	   Only some debug formats provide this info.
+   FULLNAME can be the last known absolute path to the file in question.
+     Space for the path must have been malloc'd.  If a path substitution
+     is applied we free the old value and set a new one.
+
+   On Success
+     A valid file descriptor is returned (the return value is positive).
+     FULLNAME is set to the absolute path to the file just opened.
+     The caller is responsible for freeing FULLNAME.
+
+   On Failure
+     An invalid file descriptor is returned (the return value is negative).
+     FULLNAME is set to NULL.  */
+extern int find_and_open_source (const char *filename,
+				 const char *dirname,
+				 char **fullname);
+
 /* Open a source file given a symtab S.  Returns a file descriptor or
    negative number for error.  */
 extern int open_source_file (struct symtab *s);


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

* [PATCH 11/14] -Wmissing-prototypes: observer.c's testsuite helpers.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (8 preceding siblings ...)
  2012-02-29 16:20 ` [PATCH 08/14] -Wmissing-prototypes: The find_and_open_source hack Pedro Alves
@ 2012-02-29 16:21 ` Pedro Alves
  2012-02-29 16:44 ` [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default Pedro Alves
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:21 UTC (permalink / raw)
  To: gdb-patches

These methods are meant to be called from the testsuite, so there's
really no header.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* observer.c (observer_test_first_notification_function)
	(observer_test_second_notification_function)
	(observer_test_third_notification_function):
---
 gdb/observer.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gdb/observer.c b/gdb/observer.c
index 4944480..276ca75 100644
--- a/gdb/observer.c
+++ b/gdb/observer.c
@@ -181,6 +181,11 @@ int observer_test_first_observer = 0;
 int observer_test_second_observer = 0;
 int observer_test_third_observer = 0;
 
+/* Provide prototypes to silence -Wmissing-prototypes.  */
+extern void observer_test_first_notification_function (int arg);
+extern void observer_test_second_notification_function (int arg);
+extern void observer_test_third_notification_function (int arg);
+
 void
 observer_test_first_notification_function (int arg)
 {


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

* [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (9 preceding siblings ...)
  2012-02-29 16:21 ` [PATCH 11/14] -Wmissing-prototypes: observer.c's testsuite helpers Pedro Alves
@ 2012-02-29 16:44 ` Pedro Alves
  2012-02-29 19:11   ` Tom Tromey
  2012-02-29 17:07 ` [PATCH 13/14] -Wmissing-prototypes: All others Pedro Alves
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 16:44 UTC (permalink / raw)
  To: gdb-patches

An x86_64 Fedora --enable-targets=all build finishes successfuly with
this.

So I propose turning this warning flag on before we bit rot and pile
up another set of problems.

It's likely that on other hosts we will see other related build
failures, but going ahead and turning this on is the only way we will
ever get those fixed, and, any build error this causes should be quite
trivial to fix, as can be inferred from the changes in this series.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* configure.ac (build_warnings): Add -Wmissing-prototypes.
	* configure: Regenerate.
---
 gdb/configure    |    2 +-
 gdb/configure.ac |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 49e9cd8..22343f5 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -15137,7 +15137,7 @@ fi
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wformat-nonliteral -Wno-pointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-switch -Wno-char-subscripts -Wmissing-prototypes"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
diff --git a/gdb/configure.ac b/gdb/configure.ac
index fbe7d4d..e8de55c 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1795,7 +1795,7 @@ fi
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wformat-nonliteral -Wno-pointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-switch -Wno-char-subscripts -Wmissing-prototypes"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.


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

* [PATCH 13/14] -Wmissing-prototypes: All others.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (10 preceding siblings ...)
  2012-02-29 16:44 ` [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default Pedro Alves
@ 2012-02-29 17:07 ` Pedro Alves
  2012-02-29 17:08 ` [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible) Pedro Alves
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 17:07 UTC (permalink / raw)
  To: gdb-patches

This fixes all other -Wmissing-prototypes problems I see on an
--enable-targets=all build on x86_64 Fedora 16.  No screenshot of the
warnings, since these should be all obvious enough.  All the changes
are about either making functions static, or adding missing prototypes
for _initialize_foo routines.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* amd64-linux-tdep.c (amd64_linux_record_signal): Make static.
	* breakpoint.c (create_exception_master_breakpoint, trace_command)
	(ftrace_command, strace_command): Make static.
	* d-lang.c (_initialize_d_language): Declare.
	* dwarf2expr.c (_initialize_dwarf2expr): Declare.
	* dwarf2loc.c (_initialize_dwarf2loc):
	* dwarf2read.c (process_psymtab_comp_unit): Make static.
	* exec.c (exec_get_section_table): Make static.
	* i386-linux-tdep.c (i386_linux_record_signal): Make static.
	* infcmd.c (ensure_valid_thread, ensure_not_tfind_mode): Make static.
	* inferior.c (remove_inferior_command, add_inferior_command)
	(clone_inferior_command): Make static.
	* linux-nat.c (linux_nat_thread_address_space)
	(linux_nat_core_of_thread): Make static.
	* linux-tdep.c (_initialize_linux_tdep): Declare.
	* objc-lang.c (_initialize_objc_lang): Declare.
	* opencl-lang.c (builtin_opencl_type, opencl_language_arch_info):
	Make static.
	(_initialize_opencl_language): Declare.
	* record.c (_initialize_record): Declare.
	* remote.c (demand_private_info, remote_get_tib_address)
	(remote_supports_cond_tracepoints)
	(remote_supports_fast_tracepoints, remote_get_tracepoint_status):
	Make static.
	* skip.c (_initialize_step_skip): Declare.
	* symtab.c (skip_prologue_using_lineinfo): Make static.
	* tracepoint.c (delete_trace_state_variable)
	(trace_variable_command, delete_trace_variable_command)
	(get_uploaded_tsv, find_matching_tracepoint_location)
	(find_matching_tsv, create_tsv_from_upload, get_traceframe_info):
	Make static.
	* value.c (pack_unsigned_long): Make static.
	* varobj.c (varobj_ensure_python_env): Make static.
	* windows-tdep.c (_initialize_windows_tdep): Declare.
	* xml-syscall.c (make_cleanup_free_syscalls_info): Make static.
---
 gdb/amd64-linux-tdep.c |    2 +-
 gdb/breakpoint.c       |    8 ++++----
 gdb/d-lang.c           |    3 +++
 gdb/dwarf2expr.c       |    3 +++
 gdb/dwarf2loc.c        |    3 +++
 gdb/dwarf2read.c       |    2 +-
 gdb/exec.c             |    2 +-
 gdb/i386-linux-tdep.c  |    2 +-
 gdb/infcmd.c           |    4 ++--
 gdb/inferior.c         |    6 +++---
 gdb/linux-nat.c        |    4 ++--
 gdb/linux-tdep.c       |    3 +++
 gdb/objc-lang.c        |    3 +++
 gdb/opencl-lang.c      |    7 +++++--
 gdb/record.c           |    3 +++
 gdb/remote.c           |   10 +++++-----
 gdb/skip.c             |    3 +++
 gdb/symtab.c           |    2 +-
 gdb/tracepoint.c       |   16 ++++++++--------
 gdb/value.c            |    2 +-
 gdb/varobj.c           |    2 +-
 gdb/windows-tdep.c     |    3 +++
 gdb/xml-syscall.c      |    2 +-
 23 files changed, 61 insertions(+), 34 deletions(-)

diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 5032371..da22c1c 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1225,7 +1225,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
 #define AMD64_LINUX_xstate     512
 #define AMD64_LINUX_frame_size 560
 
-int
+static int
 amd64_linux_record_signal (struct gdbarch *gdbarch,
                            struct regcache *regcache,
                            enum target_signal signal)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index db05b97..28ed657 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2922,7 +2922,7 @@ create_std_terminate_master_breakpoint (void)
 
 /* Install a master breakpoint on the unwinder's debug hook.  */
 
-void
+static void
 create_exception_master_breakpoint (void)
 {
   struct objfile *objfile;
@@ -14093,7 +14093,7 @@ set_tracepoint_count (int num)
   set_internalvar_integer (lookup_internalvar ("tpnum"), num);
 }
 
-void
+static void
 trace_command (char *arg, int from_tty)
 {
   if (create_breakpoint (get_current_arch (),
@@ -14110,7 +14110,7 @@ trace_command (char *arg, int from_tty)
     set_tracepoint_count (breakpoint_count);
 }
 
-void
+static void
 ftrace_command (char *arg, int from_tty)
 {
   if (create_breakpoint (get_current_arch (),
@@ -14129,7 +14129,7 @@ ftrace_command (char *arg, int from_tty)
 
 /* strace command implementation.  Creates a static tracepoint.  */
 
-void
+static void
 strace_command (char *arg, int from_tty)
 {
   struct breakpoint_ops *ops;
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 80504b4..202820e 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -277,6 +277,9 @@ static const struct language_defn d_language_defn =
   LANG_MAGIC
 };
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_d_language;
+
 void
 _initialize_d_language (void)
 {
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 222fcc3..6757204 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -1531,6 +1531,9 @@ ctx_no_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx,
 		  _("Support for DW_OP_GNU_entry_value is unimplemented"));
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_dwarf2expr;
+
 void
 _initialize_dwarf2expr (void)
 {
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 313df7b..ebd3452 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -3906,6 +3906,9 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = {
   loclist_tracepoint_var_ref
 };
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_dwarf2loc;
+
 void
 _initialize_dwarf2loc (void)
 {
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 799f082..4a2aeab 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3397,7 +3397,7 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu)
    SECTION is the section the CU/TU comes from,
    either .debug_info or .debug_types.  */
 
-void
+static void
 process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
 			   struct dwarf2_section_info *section,
 			   int is_debug_types_section)
diff --git a/gdb/exec.c b/gdb/exec.c
index 8a3e797..58fb55e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -667,7 +667,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
   return 0;			/* We can't help.  */
 }
 
-struct target_section_table *
+static struct target_section_table *
 exec_get_section_table (struct target_ops *ops)
 {
   return current_target_sections;
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 61800b4..3031192 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -459,7 +459,7 @@ i386_linux_intx80_sysenter_record (struct regcache *regcache)
 #define I386_LINUX_xstate	270
 #define I386_LINUX_frame_size	732
 
-int
+static int
 i386_linux_record_signal (struct gdbarch *gdbarch,
                           struct regcache *regcache,
                           enum target_signal signal)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 8dfa4fd..ef68941 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -664,7 +664,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
   return 0;
 }
 
-void
+static void
 ensure_valid_thread (void)
 {
   if (ptid_equal (inferior_ptid, null_ptid)
@@ -676,7 +676,7 @@ ensure_valid_thread (void)
    is likely to mix up recorded and live target data.  So simply
    disallow those commands.  */
 
-void
+static void
 ensure_not_tfind_mode (void)
 {
   if (get_traceframe_number () >= 0)
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 327385a..00f6fa3 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -741,7 +741,7 @@ info_inferiors_command (char *args, int from_tty)
 
 /* remove-inferior ID */
 
-void
+static void
 remove_inferior_command (char *args, int from_tty)
 {
   int num;
@@ -800,7 +800,7 @@ add_inferior_with_spaces (void)
 
 /* add-inferior [-copies N] [-exec FILENAME]  */
 
-void
+static void
 add_inferior_command (char *args, int from_tty)
 {
   int i, copies = 1;
@@ -863,7 +863,7 @@ add_inferior_command (char *args, int from_tty)
 
 /* clone-inferior [-copies N] [ID] */
 
-void
+static void
 clone_inferior_command (char *args, int from_tty)
 {
   int i, copies = 1;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index e426387..dd6b689 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -5091,7 +5091,7 @@ linux_nat_close (int quitting)
    lwpid is a "main" process id or not (it assumes so).  We reverse
    look up the "main" process id from the lwp here.  */
 
-struct address_space *
+static struct address_space *
 linux_nat_thread_address_space (struct target_ops *t, ptid_t ptid)
 {
   struct lwp_info *lwp;
@@ -5184,7 +5184,7 @@ linux_nat_core_of_thread_1 (ptid_t ptid)
 
 /* Return the cached value of the processor core for thread PTID.  */
 
-int
+static int
 linux_nat_core_of_thread (struct target_ops *ops, ptid_t ptid)
 {
   struct lwp_info *info = find_lwp_pid (ptid);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 1aee071..d94cf6e 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -864,6 +864,9 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 					linux_has_shared_address_space);
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_linux_tdep;
+
 void
 _initialize_linux_tdep (void)
 {
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 76b97ef..74528c8 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1766,6 +1766,9 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
   return 0;
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_objc_lang;
+
 void
 _initialize_objc_lang (void)
 {
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 80f978c..3554d18 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -68,7 +68,7 @@ enum opencl_primitive_types {
 
 static struct gdbarch_data *opencl_type_data;
 
-struct type **
+static struct type **
 builtin_opencl_type (struct gdbarch *gdbarch)
 {
   return gdbarch_data (gdbarch, opencl_type_data);
@@ -961,7 +961,7 @@ Cannot perform conditional operation on vectors with different sizes"));
   return evaluate_subexp_c (expect_type, exp, pos, noside);
 }
 
-void
+static void
 opencl_language_arch_info (struct gdbarch *gdbarch,
 			   struct language_arch_info *lai)
 {
@@ -1116,6 +1116,9 @@ build_opencl_types (struct gdbarch *gdbarch)
   return types;
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_opencl_language;
+
 void
 _initialize_opencl_language (void)
 {
diff --git a/gdb/record.c b/gdb/record.c
index 3a6598c..9b7ee2f 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -2924,6 +2924,9 @@ cmd_record_goto (char *arg, int from_tty)
   print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_record;
+
 void
 _initialize_record (void)
 {
diff --git a/gdb/remote.c b/gdb/remote.c
index baa3dda..09bf18e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1583,7 +1583,7 @@ remote_notice_new_inferior (ptid_t currthread, int running)
 
 /* Return the private thread data, creating it if necessary.  */
 
-struct private_thread_info *
+static struct private_thread_info *
 demand_private_info (ptid_t ptid)
 {
   struct thread_info *info = find_thread_ptid (ptid);
@@ -8989,7 +8989,7 @@ remote_get_thread_local_address (struct target_ops *ops,
 /* Provide thread local base, i.e. Thread Information Block address.
    Returns 1 if ptid is found and thread_local_base is non zero.  */
 
-int
+static int
 remote_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
 {
   if (remote_protocol_packets[PACKET_qGetTIBAddr].support != PACKET_DISABLE)
@@ -9914,7 +9914,7 @@ remote_supports_multi_process (void)
   return rs->extended && remote_multi_process_p (rs);
 }
 
-int
+static int
 remote_supports_cond_tracepoints (void)
 {
   struct remote_state *rs = get_remote_state ();
@@ -9930,7 +9930,7 @@ remote_supports_cond_breakpoints (void)
   return rs->cond_breakpoints;
 }
 
-int
+static int
 remote_supports_fast_tracepoints (void)
 {
   struct remote_state *rs = get_remote_state ();
@@ -10388,7 +10388,7 @@ remote_get_trace_status (struct trace_status *ts)
   return ts->running;
 }
 
-void
+static void
 remote_get_tracepoint_status (struct breakpoint *bp,
 			      struct uploaded_tp *utp)
 {
diff --git a/gdb/skip.c b/gdb/skip.c
index d983a80..da748e7 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -542,6 +542,9 @@ skip_re_set (void)
     }
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_step_skip;
+
 void
 _initialize_step_skip (void)
 {
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f746551..c2580a1 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2600,7 +2600,7 @@ find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
    table.  If such an entry cannot be found, return FUNC_ADDR
    unaltered.  */
 
-CORE_ADDR
+static CORE_ADDR
 skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
 {
   CORE_ADDR func_start, func_end;
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 824d572..0442a60 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -347,7 +347,7 @@ find_trace_state_variable (const char *name)
   return NULL;
 }
 
-void
+static void
 delete_trace_state_variable (const char *name)
 {
   struct trace_state_variable *tsv;
@@ -367,7 +367,7 @@ delete_trace_state_variable (const char *name)
 /* The 'tvariable' command collects a name and optional expression to
    evaluate into an initial value.  */
 
-void
+static void
 trace_variable_command (char *args, int from_tty)
 {
   struct expression *expr;
@@ -429,7 +429,7 @@ trace_variable_command (char *args, int from_tty)
   do_cleanups (old_chain);
 }
 
-void
+static void
 delete_trace_variable_command (char *args, int from_tty)
 {
   int ix;
@@ -3344,7 +3344,7 @@ free_uploaded_tps (struct uploaded_tp **utpp)
 /* Given a number and address, return an uploaded tracepoint with that
    number, creating if necessary.  */
 
-struct uploaded_tsv *
+static struct uploaded_tsv *
 get_uploaded_tsv (int num, struct uploaded_tsv **utsvp)
 {
   struct uploaded_tsv *utsv;
@@ -3391,7 +3391,7 @@ cond_string_is_same (char *str1, char *str2)
    toggle that freely, and may have done so in anticipation of the
    next trace run.  Return the location of matched tracepoint.  */
 
-struct bp_location *
+static struct bp_location *
 find_matching_tracepoint_location (struct uploaded_tp *utp)
 {
   VEC(breakpoint_p) *tp_vec = all_tracepoints ();
@@ -3474,7 +3474,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
 /* Trace state variables don't have much to identify them beyond their
    name, so just use that to detect matches.  */
 
-struct trace_state_variable *
+static struct trace_state_variable *
 find_matching_tsv (struct uploaded_tsv *utsv)
 {
   if (!utsv->name)
@@ -3483,7 +3483,7 @@ find_matching_tsv (struct uploaded_tsv *utsv)
   return find_trace_state_variable (utsv->name);
 }
 
-struct trace_state_variable *
+static struct trace_state_variable *
 create_tsv_from_upload (struct uploaded_tsv *utsv)
 {
   const char *namebase;
@@ -5052,7 +5052,7 @@ parse_traceframe_info (const char *tframe_info)
    This is where we avoid re-fetching the object from the target if we
    already have it cached.  */
 
-struct traceframe_info *
+static struct traceframe_info *
 get_traceframe_info (void)
 {
   if (traceframe_info == NULL)
diff --git a/gdb/value.c b/gdb/value.c
index 85ea970..c791a7c 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2929,7 +2929,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
 
 /* Pack NUM into BUF using a target format of TYPE.  */
 
-void
+static void
 pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
 {
   int len;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 8855ce3..88004fc 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -515,7 +515,7 @@ is_root_p (struct varobj *var)
 #ifdef HAVE_PYTHON
 /* Helper function to install a Python environment suitable for
    use during operations on VAR.  */
-struct cleanup *
+static struct cleanup *
 varobj_ensure_python_env (struct varobj *var)
 {
   return ensure_python_env (var->root->exp->gdbarch,
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index e111d41..6b84eff 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -425,6 +425,9 @@ init_w32_command_list (void)
     }
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_windows_tdep;
+
 void
 _initialize_windows_tdep (void)
 {
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 105b265..f4b16f4 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -151,7 +151,7 @@ free_syscalls_info (void *arg)
   xfree (sysinfo);
 }
 
-struct cleanup *
+static struct cleanup *
 make_cleanup_free_syscalls_info (struct syscalls_info *sysinfo)
 {
   return make_cleanup (free_syscalls_info, sysinfo);


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

* [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible).
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (11 preceding siblings ...)
  2012-02-29 17:07 ` [PATCH 13/14] -Wmissing-prototypes: All others Pedro Alves
@ 2012-02-29 17:08 ` Pedro Alves
  2012-02-29 17:18   ` Pedro Alves
  2012-02-29 17:12 ` [PATCH 12/14] -Wmissing-prototypes: Hook linux_has_shared_address_space Pedro Alves
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 17:08 UTC (permalink / raw)
  To: gdb-patches

$ make WERROR_CFLAGS="-Wmissing-prototypes" jit.o 1>/dev/null
In file included from ../../src/gdb/jit.c:23:0:
./jit-reader.h:48:14: warning: no previous prototype for ‘plugin_is_GPL_compatible’ [-Wmissing-prototypes]

2012-02-29  Pedro Alves  <palves@redhat.com>

	* jit-reader.in (plugin_is_GPL_compatible): Add declarations for
	both __cplusplus and !__cplusplus.
---
 gdb/jit-reader.in |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gdb/jit-reader.in b/gdb/jit-reader.in
index ccc68e4..42c28b5 100644
--- a/gdb/jit-reader.in
+++ b/gdb/jit-reader.in
@@ -36,6 +36,7 @@ extern "C" {
 #ifdef __cplusplus
 #define GDB_DECLARE_GPL_COMPATIBLE_READER       \
   extern "C" {                                  \
+  extern int plugin_is_GPL_compatible (void);   \
   extern int plugin_is_GPL_compatible (void)    \
   {                                             \
     return 0;                                   \
@@ -45,6 +46,7 @@ extern "C" {
 #else
 
 #define GDB_DECLARE_GPL_COMPATIBLE_READER
+  extern int plugin_is_GPL_compatible (void);   \
   extern int plugin_is_GPL_compatible (void)    \
   {                                             \
     return 0;                                   \


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

* [PATCH 12/14] -Wmissing-prototypes: Hook linux_has_shared_address_space.
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (12 preceding siblings ...)
  2012-02-29 17:08 ` [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible) Pedro Alves
@ 2012-02-29 17:12 ` Pedro Alves
  2012-02-29 17:27 ` [PATCH 00/14] -Wmissing-prototypes: Intro Joel Brobecker
  2012-03-01 21:19 ` Pedro Alves
  15 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 17:12 UTC (permalink / raw)
  To: gdb-patches

$ make -j8 1>/dev/null
../../src/gdb/linux-tdep.c:177:1: error: no previous prototype for ‘linux_has_shared_address_space’ [-Werror=missing-prototypes]
cc1: all warnings being treated as errors

This function isn't used today, but only because I had missed hooking
it, it seems.  This should make GDB handle multi-process breakpoints
better on non-MMU systems, though I haven't tried this in years.  Let
me know if you want to test this, or if this ends up causing any
trouble.  I ran the testsuite on x86_64 Fedora, with
linux_has_shared_address_space force-hacked to return 1, and
watchpoint-multi showed regressions, which were actually expected, as
they were caused by GDB thinking watchpoints on both processes only
needed to be inserted once (because they were at the same addresses),
which should be true on a non-MMU system.

2012-02-29  Pedro Alves  <palves@redhat.com>

	* linux-tdep.c (linux_has_shared_address_space): Make static.  Add
	gdbarch parameter.
	(linux_init_abi): Install it as has_shared_address_space gdbarch
	callback.
---
 gdb/linux-tdep.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 3ab98c7..1aee071 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -173,8 +173,8 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
   return siginfo_type;
 }
 
-int
-linux_has_shared_address_space (void)
+static int
+linux_has_shared_address_space (struct gdbarch *gdbarch)
 {
   /* Determine whether we are running on uClinux or normal Linux
      kernel.  */
@@ -860,6 +860,8 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_info_proc (gdbarch, linux_info_proc);
   set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions);
   set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes_1);
+  set_gdbarch_has_shared_address_space (gdbarch,
+					linux_has_shared_address_space);
 }
 
 void


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

* Re: [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible).
  2012-02-29 17:08 ` [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible) Pedro Alves
@ 2012-02-29 17:18   ` Pedro Alves
  2012-03-01 21:25     ` C version of jit-reader.h:plugin_is_GPL_compatible broken Pedro Alves
  0 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-02-29 17:18 UTC (permalink / raw)
  To: gdb-patches

On 02/29/2012 04:19 PM, Pedro Alves wrote:
>  #define GDB_DECLARE_GPL_COMPATIBLE_READER
> +  extern int plugin_is_GPL_compatible (void);   \
>    extern int plugin_is_GPL_compatible (void)    \

Hmm, I just noticed this is broken, even before my patch.
There's a `\' missing at the end of GDB_DECLARE_GPL_COMPATIBLE_READER,
like in:

 #define GDB_DECLARE_GPL_COMPATIBLE_READER       \
   extern int plugin_is_GPL_compatible (void)    \

This is the !__cplusplus variant.  The C++ variant is okay.

-- 
Pedro Alves


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

* Re: [PATCH 01/14] -Wmissing-prototypes: Ada.
  2012-02-29 16:17 ` [PATCH 01/14] -Wmissing-prototypes: Ada Pedro Alves
@ 2012-02-29 17:19   ` Joel Brobecker
  0 siblings, 0 replies; 25+ messages in thread
From: Joel Brobecker @ 2012-02-29 17:19 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> Okay to apply?
> 
> 2012-02-29  Pedro Alves  <palves@redhat.com>
> 
> 	* ada-lang.c (ada_modulus_from_name): Delete.
> 	* ada-lex.l (lexer_init): Make static.

Yes, please!

Thank you,
-- 
Joel


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

* Re: [PATCH 00/14] -Wmissing-prototypes: Intro
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (13 preceding siblings ...)
  2012-02-29 17:12 ` [PATCH 12/14] -Wmissing-prototypes: Hook linux_has_shared_address_space Pedro Alves
@ 2012-02-29 17:27 ` Joel Brobecker
  2012-02-29 17:42   ` Joel Brobecker
  2012-03-01 21:19 ` Pedro Alves
  15 siblings, 1 reply; 25+ messages in thread
From: Joel Brobecker @ 2012-02-29 17:27 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> This warning is quite useful as it catches these kinds of issues:

Thanks for working on this, Pedro.  I think it's going to be a really
useful addition to our warning flags. I would have never guessed...

-- 
Joel


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

* Re: [PATCH 00/14] -Wmissing-prototypes: Intro
  2012-02-29 17:27 ` [PATCH 00/14] -Wmissing-prototypes: Intro Joel Brobecker
@ 2012-02-29 17:42   ` Joel Brobecker
  0 siblings, 0 replies; 25+ messages in thread
From: Joel Brobecker @ 2012-02-29 17:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

And FWIW, I scanned the patch series, and nothing jumped at me. On
the contrary, a lot of positive changes brought about by this new
flag... Really nice!

-- 
Joel


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

* Re: [PATCH 04/14] -Wmissing-prototypes: Python.
  2012-02-29 16:18 ` [PATCH 04/14] -Wmissing-prototypes: Python Pedro Alves
@ 2012-02-29 18:09   ` Tom Tromey
  0 siblings, 0 replies; 25+ messages in thread
From: Tom Tromey @ 2012-02-29 18:09 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Most are obvious, and I think including the public "python.h" in
Pedro> py-breakpoint.c and py-value.c is the right thing to do, given that
Pedro> the functions in question are indeed public and to be used by core
Pedro> gdb.

I completely agree.

Tom


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

* Re: [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default.
  2012-02-29 16:44 ` [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default Pedro Alves
@ 2012-02-29 19:11   ` Tom Tromey
  2012-02-29 22:41     ` Joel Brobecker
  0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2012-02-29 19:11 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> So I propose turning this warning flag on before we bit rot and pile
Pedro> up another set of problems.

Pedro> It's likely that on other hosts we will see other related build
Pedro> failures, but going ahead and turning this on is the only way we will
Pedro> ever get those fixed, and, any build error this causes should be quite
Pedro> trivial to fix, as can be inferred from the changes in this series.

I agree.  I'm definitely in favor of this; and I think your series shows
nicely the benefits of this switch.

Tom


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

* Re: [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default.
  2012-02-29 19:11   ` Tom Tromey
@ 2012-02-29 22:41     ` Joel Brobecker
  0 siblings, 0 replies; 25+ messages in thread
From: Joel Brobecker @ 2012-02-29 22:41 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

> Pedro> So I propose turning this warning flag on before we bit rot and pile
> Pedro> up another set of problems.
> 
> Pedro> It's likely that on other hosts we will see other related build
> Pedro> failures, but going ahead and turning this on is the only way we will
> Pedro> ever get those fixed, and, any build error this causes should be quite
> Pedro> trivial to fix, as can be inferred from the changes in this series.
> 
> I agree.  I'm definitely in favor of this; and I think your series shows
> nicely the benefits of this switch.

Seconded.

-- 
Joel


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

* Re: [PATCH 00/14] -Wmissing-prototypes: Intro
  2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
                   ` (14 preceding siblings ...)
  2012-02-29 17:27 ` [PATCH 00/14] -Wmissing-prototypes: Intro Joel Brobecker
@ 2012-03-01 21:19 ` Pedro Alves
  2012-03-02 12:03   ` Pedro Alves
  15 siblings, 1 reply; 25+ messages in thread
From: Pedro Alves @ 2012-03-01 21:19 UTC (permalink / raw)
  To: gdb-patches

Given the strongly positive comments, I've checked this series in now.

Thanks all!

-- 
Pedro Alves


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

* C version of jit-reader.h:plugin_is_GPL_compatible broken
  2012-02-29 17:18   ` Pedro Alves
@ 2012-03-01 21:25     ` Pedro Alves
  0 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-03-01 21:25 UTC (permalink / raw)
  To: gdb-patches

On 02/29/2012 05:11 PM, Pedro Alves wrote:
> On 02/29/2012 04:19 PM, Pedro Alves wrote:
>>  #define GDB_DECLARE_GPL_COMPATIBLE_READER
>> +  extern int plugin_is_GPL_compatible (void);   \
>>    extern int plugin_is_GPL_compatible (void)    \
> 
> Hmm, I just noticed this is broken, even before my patch.
> There's a `\' missing at the end of GDB_DECLARE_GPL_COMPATIBLE_READER,
> like in:
> 
>  #define GDB_DECLARE_GPL_COMPATIBLE_READER       \
>    extern int plugin_is_GPL_compatible (void)    \
> 
> This is the !__cplusplus variant.  The C++ variant is okay.
> 

I'm checking this in.

2012-03-01  Pedro Alves  <palves@redhat.com>

	* jit-reader.in [!__cplusplus]
	(GDB_DECLARE_GPL_COMPATIBLE_READER): Add missing backslash.

---

diff --git a/gdb/jit-reader.in b/gdb/jit-reader.in
index 42c28b5..3ad521a 100644
--- a/gdb/jit-reader.in
+++ b/gdb/jit-reader.in
@@ -45,7 +45,7 @@ extern "C" {

 #else

-#define GDB_DECLARE_GPL_COMPATIBLE_READER
+#define GDB_DECLARE_GPL_COMPATIBLE_READER       \
   extern int plugin_is_GPL_compatible (void);   \
   extern int plugin_is_GPL_compatible (void)    \
   {                                             \


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

* Re: [PATCH 00/14] -Wmissing-prototypes: Intro
  2012-03-01 21:19 ` Pedro Alves
@ 2012-03-02 12:03   ` Pedro Alves
  0 siblings, 0 replies; 25+ messages in thread
From: Pedro Alves @ 2012-03-02 12:03 UTC (permalink / raw)
  To: gdb-patches

And it seems I somehow missed doing a clean build from scratch, and
thus missed a bunch of warnings this introduces that I should have fixed
myself.  Sorry about that, and thanks everyone for having fixed
them already.

-- 
Pedro Alves


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

end of thread, other threads:[~2012-03-02 12:03 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro Pedro Alves
2012-02-29 16:17 ` [PATCH 02/14] -Wmissing-prototypes: proc-service Pedro Alves
2012-02-29 16:17 ` [PATCH 03/14] -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior Pedro Alves
2012-02-29 16:17 ` [PATCH 01/14] -Wmissing-prototypes: Ada Pedro Alves
2012-02-29 17:19   ` Joel Brobecker
2012-02-29 16:18 ` [PATCH 06/14] -Wmissing-prototypes: The TUI Pedro Alves
2012-02-29 16:18 ` [PATCH 04/14] -Wmissing-prototypes: Python Pedro Alves
2012-02-29 18:09   ` Tom Tromey
2012-02-29 16:18 ` [PATCH 05/14] -Wmissing-prototypes: The encode_actions hack Pedro Alves
2012-02-29 16:19 ` [PATCH 07/14] -Wmissing-prototypes: inline-frame.c Pedro Alves
2012-02-29 16:20 ` [PATCH 10/14] -Wmissing-prototypes: common/signals.c Pedro Alves
2012-02-29 16:20 ` [PATCH 08/14] -Wmissing-prototypes: The find_and_open_source hack Pedro Alves
2012-02-29 16:21 ` [PATCH 11/14] -Wmissing-prototypes: observer.c's testsuite helpers Pedro Alves
2012-02-29 16:44 ` [PATCH 14/14] -Wmissing-prototypes: Build with -Wmissing-prototypes by default Pedro Alves
2012-02-29 19:11   ` Tom Tromey
2012-02-29 22:41     ` Joel Brobecker
2012-02-29 17:07 ` [PATCH 13/14] -Wmissing-prototypes: All others Pedro Alves
2012-02-29 17:08 ` [PATCH 09/14] -Wmissing-prototypes: jit-reader.in (plugin_is_GPL_compatible) Pedro Alves
2012-02-29 17:18   ` Pedro Alves
2012-03-01 21:25     ` C version of jit-reader.h:plugin_is_GPL_compatible broken Pedro Alves
2012-02-29 17:12 ` [PATCH 12/14] -Wmissing-prototypes: Hook linux_has_shared_address_space Pedro Alves
2012-02-29 17:27 ` [PATCH 00/14] -Wmissing-prototypes: Intro Joel Brobecker
2012-02-29 17:42   ` Joel Brobecker
2012-03-01 21:19 ` Pedro Alves
2012-03-02 12:03   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox