public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ada][PR65490] Fix bzero warning in child_setup_tty
@ 2015-03-30 14:00 Tom de Vries
  2015-03-31  7:58 ` Arnaud Charlet
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2015-03-30 14:00 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hi,

This patch fixes the warning:
...
terminals.c:1266:21: warning: argument to ‘sizeof’ in ‘bzero’ call is the same 
expression as the destination; did you mean to remove the addressof? 
[-Wsizeof-pointer-memaccess]
...

bootstrapped and reg-tested on x86_64.

OK for stage 4/stage1?

Thanks,
- Tom

[-- Attachment #2: 0001-Fix-bzero-warning-in-child_setup_tty.patch --]
[-- Type: text/x-patch, Size: 761 bytes --]

Fix bzero warning in child_setup_tty

2015-03-30  Tom de Vries  <tom@codesourcery.com>

	PR ada/65490
	* terminals.c (child_setup_tty): Fix warning 'argument to sizeof in
	bzero call is the same expression as the destination'.
---
 gcc/ada/terminals.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index a46e610..eaaf1c2 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1262,8 +1262,8 @@ child_setup_tty (int fd)
   struct termios s;
   int    status;
 
-  /* ensure that s is filled with 0 */
-  bzero (&s, sizeof (&s));
+  /* Ensure that s is filled with 0.  */
+  bzero (&s, sizeof (s));
 
   /* Get the current terminal settings */
   status = tcgetattr (fd, &s);
-- 
1.9.1


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

* Re: [PATCH][ada][PR65490] Fix bzero warning in child_setup_tty
  2015-03-30 14:00 [PATCH][ada][PR65490] Fix bzero warning in child_setup_tty Tom de Vries
@ 2015-03-31  7:58 ` Arnaud Charlet
  2015-03-31  7:59   ` Arnaud Charlet
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaud Charlet @ 2015-03-31  7:58 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches

> OK for stage 4/stage1?
> 
> Thanks,
> - Tom

> Fix bzero warning in child_setup_tty
> 
> 2015-03-30  Tom de Vries  <tom@codesourcery.com>
> 
> 	PR ada/65490
> 	* terminals.c (child_setup_tty): Fix warning 'argument to sizeof in
> 	bzero call is the same expression as the destination'.
> ---
>  gcc/ada/terminals.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
> index a46e610..eaaf1c2 100644
> --- a/gcc/ada/terminals.c
> +++ b/gcc/ada/terminals.c
> @@ -1262,8 +1262,8 @@ child_setup_tty (int fd)
>    struct termios s;
>    int    status;
>  
> -  /* ensure that s is filled with 0 */
> -  bzero (&s, sizeof (&s));
> +  /* Ensure that s is filled with 0.  */

Please keep the comment as is, we do not put dots on single partial sentences
(otherwise you would have to change these everywhere, and you and I do not
really want that).

> +  bzero (&s, sizeof (s));

the above single line change is OK for stage 4, thanks.

Arno

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

* Re: [PATCH][ada][PR65490] Fix bzero warning in child_setup_tty
  2015-03-31  7:58 ` Arnaud Charlet
@ 2015-03-31  7:59   ` Arnaud Charlet
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaud Charlet @ 2015-03-31  7:59 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches

> > -  /* ensure that s is filled with 0 */
> > -  bzero (&s, sizeof (&s));
> > +  /* Ensure that s is filled with 0.  */
> 
> Please keep the comment as is, we do not put dots on single partial sentences
> (otherwise you would have to change these everywhere, and you and I do not
> really want that).
> 
> > +  bzero (&s, sizeof (s));
> 
> the above single line change is OK for stage 4, thanks.

Plus the copyright update (to 2015).

--
--- terminals.c (revision 313797)
+++ terminals.c (working copy)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                          C Implementation File                           *
  *                                                                          *
- *                     Copyright (C) 2008-2014, AdaCore                     *
+ *                     Copyright (C) 2008-2015, AdaCore                     *
  *                                                                          *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -1263,7 +1263,7 @@
   int    status;

   /* ensure that s is filled with 0 */
-  bzero (&s, sizeof (&s));
+  bzero (&s, sizeof (s));

   /* Get the current terminal settings */
   status = tcgetattr (fd, &s);

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

end of thread, other threads:[~2015-03-31  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 14:00 [PATCH][ada][PR65490] Fix bzero warning in child_setup_tty Tom de Vries
2015-03-31  7:58 ` Arnaud Charlet
2015-03-31  7:59   ` Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).