Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA PATCH] Enable -Wpointer-sign by default.
@ 2013-04-20  7:04 Pedro Alves
  2013-04-20  7:38 ` Eli Zaretskii
  2013-04-21  2:03 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Pedro Alves @ 2013-04-20  7:04 UTC (permalink / raw)
  To: gdb-patches

This enables -Wpointer-sign by default.

I've checked that --enable-targets=all builds fine with the following
as --host, on x86_64 Fedora 17 --build:

x86_64 GNU/Linux
i386 GNU/Linux
i386 MinGW-w64
i386 msdos/djgpp

OK?

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* configure.ac (build_warnings): Replace -Wno-pointer-sign with
	-Wpointer-sign.
	* configure: Regenerate.

gdb/doc
2013-04-19  Pedro Alves  <palves@redhat.com>

	* gdbint.texinfo (Misc Guidelines) <Compiler Warnings>: Replace
	-Wno-pointer-sign text with text on -Wpointer-sign.
---
 gdb/configure          |    2 +-
 gdb/configure.ac       |    2 +-
 gdb/doc/gdbint.texinfo |   13 ++++++-------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index f9d9a17..c8f3f1f 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12452,7 +12452,7 @@ fi
 # NOTE: If you change this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-pointer-sign \
+-Wformat-nonliteral -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body"
diff --git a/gdb/configure.ac b/gdb/configure.ac
index ce6fa7a..884b40e 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1925,7 +1925,7 @@ fi
 # NOTE: If you change this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-pointer-sign \
+-Wformat-nonliteral -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body"
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 4a75c26..280a860 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -6339,13 +6339,12 @@ Since @value{GDBN} uses the @code{format printf} attribute on all
 @code{printf} like functions this checks not just @code{printf} calls
 but also calls to functions such as @code{fprintf_unfiltered}.
 
-@item -Wno-pointer-sign
-In version 4.0, GCC began warning about pointer argument passing or
-assignment even when the source and destination differed only in
-signedness.  However, most @value{GDBN} code doesn't distinguish
-carefully between @code{char} and @code{unsigned char}.  In early 2006
-the @value{GDBN} developers decided correcting these warnings wasn't
-worth the time it would take.
+@item -Wpointer-sign
+This helps make sure @value{GDBN} code uses @code{gdb_byte} which is
+really @code{unsigned char} for raw bytes instead of @code{char},
+whose signness is host-dependent.  @sc{gcc} enables this with
+@code{-Wall} since version 4.0.  We enable it explicitly too to be
+decoupled from future @sc{gcc} (or other compiler)'s choices.
 
 @item -Wno-unused-parameter
 Due to the way that @value{GDBN} is implemented many functions have


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

* Re: [RFA PATCH] Enable -Wpointer-sign by default.
  2013-04-20  7:04 [RFA PATCH] Enable -Wpointer-sign by default Pedro Alves
@ 2013-04-20  7:38 ` Eli Zaretskii
  2013-04-21  2:18   ` Pedro Alves
  2013-04-21  2:03 ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2013-04-20  7:38 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 19 Apr 2013 18:59:32 +0100
> 
> +@item -Wpointer-sign
> +This helps make sure @value{GDBN} code uses @code{gdb_byte} which is
> +really @code{unsigned char} for raw bytes instead of @code{char},
> +whose signness is host-dependent.  @sc{gcc} enables this with
> +@code{-Wall} since version 4.0.  We enable it explicitly too to be
> +decoupled from future @sc{gcc} (or other compiler)'s choices.

I'd use "defaults" instead of "choices".

As for "other compilers": do other compilers really have, or are
likely to have, options that are named like that?  If not, I suggest
to delete the part in the parentheses.

OK with those changes.

Thanks.


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

* Re: [RFA PATCH] Enable -Wpointer-sign by default.
  2013-04-20  7:04 [RFA PATCH] Enable -Wpointer-sign by default Pedro Alves
  2013-04-20  7:38 ` Eli Zaretskii
@ 2013-04-21  2:03 ` Tom Tromey
  2013-04-21  4:59   ` Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2013-04-21  2:03 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

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

Pedro> OK?

I'm all for it.

Pedro> +whose signness is host-dependent.  @sc{gcc} enables this with

"signedness" is more typical.

Tom


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

* Re: [RFA PATCH] Enable -Wpointer-sign by default.
  2013-04-20  7:38 ` Eli Zaretskii
@ 2013-04-21  2:18   ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2013-04-21  2:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On 04/19/2013 07:16 PM, Eli Zaretskii wrote:

> I'd use "defaults" instead of "choices".

Done.

> As for "other compilers": do other compilers really have, or are
> likely to have, options that are named like that?  If not, I suggest
> to delete the part in the parentheses.

Yes, clang/llvm has it.

> OK with those changes.

Thanks.  I've applied it.

---------------
Subject: Enable -Wpointer-sign by default.

This enables -Wpointer-sign by default.

I've checked that --enable-targets=all builds fine with the following
as --host, on x86_64 Fedora 17 --build:

x86_64 GNU/Linux
i386 GNU/Linux
i386 MinGW-w64
i386 msdos/djgpp

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* configure.ac (build_warnings): Replace -Wno-pointer-sign with
	-Wpointer-sign.
	* configure: Regenerate.

gdb/doc
2013-04-19  Pedro Alves  <palves@redhat.com>

	* gdbint.texinfo (Misc Guidelines) <Compiler Warnings>: Replace
	-Wno-pointer-sign text with text on -Wpointer-sign.
---
 gdb/configure          |    2 +-
 gdb/configure.ac       |    2 +-
 gdb/doc/gdbint.texinfo |   13 ++++++-------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index f9d9a17..c8f3f1f 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12452,7 +12452,7 @@ fi
 # NOTE: If you change this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-pointer-sign \
+-Wformat-nonliteral -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body"
diff --git a/gdb/configure.ac b/gdb/configure.ac
index ce6fa7a..884b40e 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1925,7 +1925,7 @@ fi
 # NOTE: If you change this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-pointer-sign \
+-Wformat-nonliteral -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body"
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 4a75c26..34e75e2 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -6339,13 +6339,12 @@ Since @value{GDBN} uses the @code{format printf} attribute on all
 @code{printf} like functions this checks not just @code{printf} calls
 but also calls to functions such as @code{fprintf_unfiltered}.

-@item -Wno-pointer-sign
-In version 4.0, GCC began warning about pointer argument passing or
-assignment even when the source and destination differed only in
-signedness.  However, most @value{GDBN} code doesn't distinguish
-carefully between @code{char} and @code{unsigned char}.  In early 2006
-the @value{GDBN} developers decided correcting these warnings wasn't
-worth the time it would take.
+@item -Wpointer-sign
+This helps make sure @value{GDBN} code uses @code{gdb_byte} which is
+really @code{unsigned char} for raw bytes instead of @code{char},
+whose signness is host-dependent.  @sc{gcc} enables this with
+@code{-Wall} since version 4.0.  We enable it explicitly too to be
+decoupled from future @sc{gcc} (or other compiler)'s defaults.

 @item -Wno-unused-parameter
 Due to the way that @value{GDBN} is implemented many functions have


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

* Re: [RFA PATCH] Enable -Wpointer-sign by default.
  2013-04-21  2:03 ` Tom Tromey
@ 2013-04-21  4:59   ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2013-04-21  4:59 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04/19/2013 07:33 PM, Tom Tromey wrote:
> Pedro> +whose signness is host-dependent.  @sc{gcc} enables this with
> 
> "signedness" is more typical.

Whoops.  I'm applying this then.

Thanks,
-- 
Pedro Alves

-----------
s/signness/signedness in gdbint.texinfo.

"signedness" is more typical.

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* gdbint.texinfo (Misc Guidelines) <Compiler Warnings>: Write
	"signedness" instead of "signness".

Index: src/gdb/doc/gdbint.texinfo
===================================================================
--- src.orig/gdb/doc/gdbint.texinfo
+++ src/gdb/doc/gdbint.texinfo
@@ -6342,7 +6342,7 @@ but also calls to functions such as @cod
 @item -Wpointer-sign
 This helps make sure @value{GDBN} code uses @code{gdb_byte} which is
 really @code{unsigned char} for raw bytes instead of @code{char},
-whose signness is host-dependent.  @sc{gcc} enables this with
+whose signedness is host-dependent.  @sc{gcc} enables this with
 @code{-Wall} since version 4.0.  We enable it explicitly too to be
 decoupled from future @sc{gcc} (or other compiler)'s defaults.
 


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

end of thread, other threads:[~2013-04-19 18:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-20  7:04 [RFA PATCH] Enable -Wpointer-sign by default Pedro Alves
2013-04-20  7:38 ` Eli Zaretskii
2013-04-21  2:18   ` Pedro Alves
2013-04-21  2:03 ` Tom Tromey
2013-04-21  4:59   ` Pedro Alves

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