On Thu, Mar 09, 2017 at 07:00:28PM -0800, Daniele Di Proietto wrote:
> 2017-03-07 15:56 GMT-08:00 Ben Pfaff <b...@ovn.org>:
> > Various printf() format specifiers in the tree had minor technical issues
> > which the Mac OS build reported, e.g. here:
> > https://s3.amazonaws.com/archive.travis-ci.org/jobs/208718342/log.txt
> >
> > These tend to fall into two categories of harmless warnings:
> >
> > 1. Wrong width for types that are all promoted to 'int'.  For example,
> > both uint8_t and uint16_t are both promoted to 'int' as part of a call
> > to printf(), but using PRIu8 for a uint16_t causes a warning.
> >
> > 2. Wrong format specifier for type promoted to 'int' due to arithmetic.
> > For example, if 'x' is a uint8_t, then x >> 1 has type 'int' due to
> > C's promotion rules, so the correct format specifier is %d and using
> > PRIu8 will cause a warning.
> >
> > This commit fixes the warnings.  I didn't see anything that rose to the
> > level of a bug.
> >
> > These warnings only showed up on Mac OS X because of differences in the
> > format specifiers that Mac OS uses for PRI*.
> >
> > Reported-by: Shu Shen <shu.s...@gmail.com>
> > Signed-off-by: Ben Pfaff <b...@ovn.org>
> > ---
> >  lib/bfd.c                    |  4 ++--
> >  lib/match.c                  |  6 +++---
> >  lib/multipath.c              |  4 ++--
> >  lib/odp-util.c               | 10 +++++-----
> >  lib/ofp-actions.c            | 12 ++++++------
> >  lib/ofp-print.c              |  2 +-
> >  lib/ofp-util.c               |  2 +-
> >  lib/ovs-router.c             |  4 ++--
> >  ofproto/ofproto-dpif-xlate.c |  2 +-
> >  tests/test-netflow.c         |  4 ++--
> >  utilities/ovs-ofctl.c        |  2 +-
> >  vswitchd/bridge.c            |  4 ++--
> >  12 files changed, 28 insertions(+), 28 deletions(-)
> >
> > diff --git a/lib/bfd.c b/lib/bfd.c
> > index 87f3322ee461..1fb1cfb2bc34 100644
> > --- a/lib/bfd.c
> > +++ b/lib/bfd.c
> > @@ -1,4 +1,4 @@
> > -/* Copyright (c) 2013, 2014, 2015, 2016 Nicira, Inc.
> > +/* Copyright (c) 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -1061,7 +1061,7 @@ log_msg(enum vlog_level level, const struct msg *p, 
> > const char *message,
> >
> >      ds_put_format(&ds,
> >                    "%s: %s."
> > -                  "\n\tvers:%"PRIu8" diag:\"%s\" state:%s mult:%"PRIu8
> > +                  "\n\tvers:%d diag:\"%s\" state:%s mult:%"PRIu8
> >                    " length:%"PRIu8
> >                    "\n\tflags: %s"
> >                    "\n\tmy_disc:0x%"PRIx32" your_disc:0x%"PRIx32
> > diff --git a/lib/match.c b/lib/match.c
> > index 3fcaec5b08ca..6bbd34820aa1 100644
> > --- a/lib/match.c
> > +++ b/lib/match.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, 
> > Inc.
> > + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 
> > Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -1281,11 +1281,11 @@ match_format(const struct match *match, struct ds 
> > *s, int priority)
> >                        colors.param, colors.end, f->nw_tos & IP_DSCP_MASK);
> 
> The above ds_put_format has the same problem as well.

Thanks, I fixed this too.

> With this I'm able to build without warnings on Mac OS X.
> Perhaps we can also remove -Wno-error=format from .travis/osx-build.sh

Good idea, I'll submit a separate patch for that.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to