From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH 2/3] add -Wold-style-declaration
Date: Mon, 17 Jun 2013 18:42:00 -0000 [thread overview]
Message-ID: <1371494572-26594-3-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1371494572-26594-1-git-send-email-tromey@redhat.com>
This adds -Wold-style-declaration to gdb's list of warnings.
It turns out that a few places use "const static" rather than
"static const". The former is deprecated according to the C standard.
Tested by rebuilding with --enable-targets=all on x86-64 Fedora 18.
This misses most of the "nat" code, but any needed fixes are trivial.
* configure.ac (build_warnings): Add -Wold-style-declaration.
* configure: Rebuild.
* dsrec.c (make_srec): Use "static const", not "const static".
* h8300-tdep.c (h8300_breakpoint_from_pc): Use "static const",
not "const static".
* mi/mi-parse.c (mi_no_values, mi_simple_values, mi_all_values):
Use "static const", not "const static".
* mn10300-tdep.c (mn10300_breakpoint_from_pc): Use "static const",
not "const static".
* moxie-tdep.c (moxie_breakpoint_from_pc): Use "static const",
not "const static".
* rs6000-tdep.c (rs6000_breakpoint_from_pc): Use "static const",
not "const static".
* v850-tdep.c (v850_breakpoint_from_pc): Use "static const",
not "const static".
(v850_dbtrap_breakpoint_from_pc): Likewise.
* xstormy16-tdep.c (xstormy16_breakpoint_from_pc): Use "static const",
not "const static".
---
gdb/configure | 3 ++-
gdb/configure.ac | 3 ++-
gdb/dsrec.c | 8 ++++----
gdb/h8300-tdep.c | 2 +-
gdb/mi/mi-parse.c | 6 +++---
gdb/mn10300-tdep.c | 2 +-
gdb/moxie-tdep.c | 2 +-
gdb/rs6000-tdep.c | 2 +-
gdb/v850-tdep.c | 4 ++--
gdb/xstormy16-tdep.c | 2 +-
10 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 7da2e15..0c9ac97 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12456,7 +12456,8 @@ build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wpointer-sign \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
--Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type"
+-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
+-Wold-style-declaration"
# 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 f9c04de..f2cd9dc 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1929,7 +1929,8 @@ build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wpointer-sign \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
--Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type"
+-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
+-Wold-style-declaration"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 04dd9c6..bc47f84 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -226,10 +226,10 @@ make_srec (char *srec, CORE_ADDR targ_addr, bfd *abfd, asection *sect,
{
unsigned char checksum;
int tmp;
- const static char hextab[] = "0123456789ABCDEF";
- const static char data_code_table[] = "123";
- const static char term_code_table[] = "987";
- const static char header_code_table[] = "000";
+ static const char hextab[] = "0123456789ABCDEF";
+ static const char data_code_table[] = "123";
+ static const char term_code_table[] = "987";
+ static const char header_code_table[] = "000";
char const *code_table;
int addr_size;
int payload_size;
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 0e9d6c4..ef80247 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1192,7 +1192,7 @@ h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
return regno;
}
-const static unsigned char *
+static const unsigned char *
h8300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 0f35f1d..a3c1849 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -28,9 +28,9 @@
#include "gdb_string.h"
#include "cli/cli-utils.h"
-const static char mi_no_values[] = "--no-values";
-const static char mi_simple_values[] = "--simple-values";
-const static char mi_all_values[] = "--all-values";
+static const char mi_no_values[] = "--no-values";
+static const char mi_simple_values[] = "--simple-values";
+static const char mi_all_values[] = "--all-values";
/* Like parse_escape, but leave the results as a host char, not a
target char. */
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index c31af8d..32aa5f5 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -326,7 +326,7 @@ mn10300_write_pc (struct regcache *regcache, CORE_ADDR val)
so we need a single byte breakpoint. Matsushita hasn't defined
one, so we defined it ourselves. */
-const static unsigned char *
+static const unsigned char *
mn10300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
int *bp_size)
{
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 79d160b..cb04786 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -72,7 +72,7 @@ moxie_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
/* Implement the "breakpoint_from_pc" gdbarch method. */
-const static unsigned char *
+static const unsigned char *
moxie_breakpoint_from_pc (struct gdbarch *gdbarch,
CORE_ADDR *pcptr, int *lenptr)
{
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index d3ff09d..59e129f 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -943,7 +943,7 @@ rs6000_fetch_pointer_argument (struct frame_info *frame, int argi,
/* Sequence of bytes for breakpoint instruction. */
-const static unsigned char *
+static const unsigned char *
rs6000_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
int *bp_size)
{
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 16fe825..becb051 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1170,7 +1170,7 @@ v850_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-const static unsigned char *
+static const unsigned char *
v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
@@ -1184,7 +1184,7 @@ v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
Older architectures had no such instruction. For those, an
unconditional branch to self instruction is used. */
-const static unsigned char *
+static const unsigned char *
v850_dbtrap_breakpoint_from_pc (struct gdbarch *gdbarch,
CORE_ADDR *pcptr, int *lenptr)
{
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index cb551ff..99b0c5e 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -505,7 +505,7 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
-const static unsigned char *
+static const unsigned char *
xstormy16_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
--
1.8.1.4
next prev parent reply other threads:[~2013-06-17 18:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-17 18:42 [PATCH 0/3] add a few new warning options Tom Tromey
2013-06-17 18:42 ` [PATCH 1/3] add -Wmissing-parameter-type Tom Tromey
2013-06-17 18:42 ` Tom Tromey [this message]
2013-07-01 19:49 ` [PATCH 2/3] add -Wold-style-declaration Tom Tromey
2013-06-17 18:59 ` [PATCH 3/3] add -Wold-style-definition Tom Tromey
2013-07-02 8:08 ` Build regression on CentOS-5 [Re: [PATCH 3/3] add -Wold-style-definition] Jan Kratochvil
2013-07-02 20:53 ` Tom Tromey
2013-07-02 20:54 ` Tom Tromey
2013-07-03 9:00 ` Jan Kratochvil
2013-07-10 16:28 ` Tom Tromey
2013-07-10 16:51 ` Michael Eager
2013-07-10 18:11 ` Tom Tromey
2013-07-10 18:24 ` Joel Brobecker
2013-07-10 19:11 ` Michael Eager
2013-06-18 5:14 ` [PATCH 0/3] add a few new warning options Joel Brobecker
2013-07-01 19:46 ` Tom Tromey
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=1371494572-26594-3-git-send-email-tromey@redhat.com \
--to=tromey@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