From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 10/14] -Wmissing-prototypes: common/signals.c.
Date: Wed, 29 Feb 2012 16:20:00 -0000 [thread overview]
Message-ID: <20120229162019.23918.43533.stgit@hit-nxdomain.opendns.com> (raw)
In-Reply-To: <20120229161628.23918.51354.stgit@hit-nxdomain.opendns.com>
$ 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);
next prev parent reply other threads:[~2012-02-29 16:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 16:17 [PATCH 00/14] -Wmissing-prototypes: Intro 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:17 ` [PATCH 03/14] -Wmissing-prototypes: Garbage collect inferior.c:delete_threads_of_inferior Pedro Alves
2012-02-29 16:17 ` [PATCH 02/14] -Wmissing-prototypes: proc-service Pedro Alves
2012-02-29 16:18 ` [PATCH 05/14] -Wmissing-prototypes: The encode_actions hack Pedro Alves
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:19 ` [PATCH 07/14] -Wmissing-prototypes: inline-frame.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:20 ` Pedro Alves [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120229162019.23918.43533.stgit@hit-nxdomain.opendns.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox