diff mbox

[ovs-dev] types: Fix defined but not used warning.

Message ID 1455917755-110920-1-git-send-email-u9012063@gmail.com
State Accepted
Headers show

Commit Message

William Tu Feb. 19, 2016, 9:35 p.m. UTC
warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
Found using CentOS 6.6 with gcc 6.6.0.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 include/openvswitch/types.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Feb. 19, 2016, 9:48 p.m. UTC | #1
On Fri, Feb 19, 2016 at 01:35:55PM -0800, William Tu wrote:
> warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
> Found using CentOS 6.6 with gcc 6.6.0.

Are you sure about that GCC version number?
William Tu Feb. 19, 2016, 10:38 p.m. UTC | #2
Sorry it's 6.0.0
CentOS 6.6 comes with gcc 4.4.7. I updated to version 6.0.0.

# gcc --version
gcc (GCC) 6.0.0 20160217 (experimental)
Copyright (C) 2016 Free Software Foundation, Inc.


On Fri, Feb 19, 2016 at 1:48 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Fri, Feb 19, 2016 at 01:35:55PM -0800, William Tu wrote:
> > warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
> > Found using CentOS 6.6 with gcc 6.6.0.
>
> Are you sure about that GCC version number?
>
Ben Pfaff Feb. 19, 2016, 10:56 p.m. UTC | #3
OK, thanks.  I adjusted that and applied this to master and branch-2.5.

On Fri, Feb 19, 2016 at 02:38:02PM -0800, William Tu wrote:
> Sorry it's 6.0.0
> CentOS 6.6 comes with gcc 4.4.7. I updated to version 6.0.0.
> 
> # gcc --version
> gcc (GCC) 6.0.0 20160217 (experimental)
> Copyright (C) 2016 Free Software Foundation, Inc.
> 
> 
> On Fri, Feb 19, 2016 at 1:48 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> > On Fri, Feb 19, 2016 at 01:35:55PM -0800, William Tu wrote:
> > > warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
> > > Found using CentOS 6.6 with gcc 6.6.0.
> >
> > Are you sure about that GCC version number?
> >
Panu Matilainen Feb. 22, 2016, 9:19 a.m. UTC | #4
On 02/19/2016 11:35 PM, William Tu wrote:
> warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
> Found using CentOS 6.6 with gcc 6.6.0.
>
> Signed-off-by: William Tu <u9012063@gmail.com>

Just FWIW, this particular gcc 6 behavior is still under debate:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

	- Panu -
Ben Pfaff Feb. 22, 2016, 5:29 p.m. UTC | #5
On Mon, Feb 22, 2016 at 11:19:07AM +0200, Panu Matilainen wrote:
> On 02/19/2016 11:35 PM, William Tu wrote:
> >warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
> >Found using CentOS 6.6 with gcc 6.6.0.
> >
> >Signed-off-by: William Tu <u9012063@gmail.com>
> 
> Just FWIW, this particular gcc 6 behavior is still under debate:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

Hmm, interesting.

The fix is harmless, at least.
diff mbox

Patch

diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h
index 658fb50..5f3347d 100644
--- a/include/openvswitch/types.h
+++ b/include/openvswitch/types.h
@@ -19,6 +19,7 @@ 
 
 #include <sys/types.h>
 #include <stdint.h>
+#include "openvswitch/compiler.h"
 
 #ifdef __CHECKER__
 #define OVS_BITWISE __attribute__((bitwise))
@@ -104,7 +105,7 @@  typedef union {
  * So we use these static definitions rather than using initializer macros. */
 static const ovs_u128 OVS_U128_MAX = { { UINT32_MAX, UINT32_MAX,
                                          UINT32_MAX, UINT32_MAX } };
-static const ovs_be128 OVS_BE128_MAX = { { OVS_BE32_MAX, OVS_BE32_MAX,
+static const ovs_be128 OVS_BE128_MAX OVS_UNUSED = { { OVS_BE32_MAX, OVS_BE32_MAX,
                                            OVS_BE32_MAX, OVS_BE32_MAX } };
 
 /* A 64-bit value, in network byte order, that is only aligned on a 32-bit