bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] avoid spurious parentheses/arith-op-related warnings from newer


From: Jim Meyering
Subject: [PATCH] avoid spurious parentheses/arith-op-related warnings from newer gcc
Date: Thu, 05 Feb 2009 19:00:08 +0100

FYI, building with the very latest gcc,
I get new warnings.  This fixes them:


>From 8ed84c34388b3e475ece2f93ac22e25546503f16 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 5 Feb 2009 14:53:10 +0100
Subject: [PATCH] avoid spurious parentheses/arith-op-related warnings from 
newer gcc

* src/copy.c (set_owner): Use && rather than &.
* src/stty.c (main): Likewise.
* src/wc.c (wc): Likewise.
---
 src/copy.c |    2 +-
 src/stty.c |    4 ++--
 src/wc.c   |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 85d1fea..a6ca9dd 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -275,7 +275,7 @@ set_owner (const struct cp_options *x, char const 
*dst_name, int dest_desc,
      group.  Avoid the window by first changing to a restrictive
      temporary mode if necessary.  */

-  if (!new_dst & (x->preserve_mode | x->move_mode | x->set_mode))
+  if (!new_dst && (x->preserve_mode | x->move_mode | x->set_mode))
     {
       mode_t old_mode = dst_sb->st_mode;
       mode_t new_mode =
diff --git a/src/stty.c b/src/stty.c
index eb4f30f..389ab9e 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -1,5 +1,5 @@
 /* stty -- change and print terminal line settings
-   Copyright (C) 1990-2005, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -815,7 +815,7 @@ main (int argc, char **argv)
             "mutually exclusive"));

   /* Specifying any other arguments with -a or -g gets an error.  */
-  if (!noargs & (verbose_output | recoverable_output))
+  if (!noargs && (verbose_output | recoverable_output))
     error (EXIT_FAILURE, 0,
           _("when specifying an output style, modes may not be set"));

diff --git a/src/wc.c b/src/wc.c
index b1afe14..e6ffd1a 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -1,5 +1,5 @@
 /* wc - print the number of lines, words, and bytes in files
-   Copyright (C) 85, 91, 1995-2008 Free Software Foundation, Inc.
+   Copyright (C) 85, 91, 1995-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -249,7 +249,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
            }
        }
     }
-  else if (!count_chars & !count_complicated)
+  else if (!count_chars && !count_complicated)
     {
       /* Use a separate loop when counting only lines or lines and bytes --
         but not chars or words.  */
--
1.6.1.2.511.gc5d3f




reply via email to

[Prev in Thread] Current Thread [Next in Thread]