Re: [ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-03-07 Thread Ben Pfaff
On Thu, Feb 02, 2017 at 03:31:03PM -0800, Shu Shen wrote: > On Thu, Feb 02, 2017 at 03:08:09PM -0800, Ben Pfaff wrote: > > On Thu, Feb 02, 2017 at 02:55:03PM -0800, Shu Shen wrote: > > > On Tue, Jan 31, 2017 at 10:45:31AM -0800, Ben Pfaff wrote: > > > > By my count, vlan_tci_to_pcp() is used in

[ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-02-02 Thread Shu Shen
On macOS, PRIu8 and PRIx8 the specifiers are not promoted to 'u' and 'x' respectively. For example, for PRIu*, on Mac OS, /usr/include/inttypes.h: # define __PRI_8_LENGTH_MODIFIER__ "hh" # define __PRI_64_LENGTH_MODIFIER__ "ll" # define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" #

Re: [ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-01-31 Thread Ben Pfaff
By my count, vlan_tci_to_pcp() is used in printf-like format specifiers in 7 places in the tree. Before this patch, it is used with the following format specifiers: %d 3 times %x 1 time PRIu8 1 time PRIx8 1 time Both %d and %x are obviously correct,

Re: [ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-01-14 Thread Shu Shen
Sorry I missed the list in my reply. On Sat, Jan 14, 2017 at 9:59 AM, Shu Shen wrote: > The main change of this patch is in lib/packets.h, where the return type of > vlan_tci_to_pcp() and vlan_tci_to_cfi() are changed from int to uint8_t. > > Changes to the format specifiers

Re: [ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-01-14 Thread Ben Pfaff
On Fri, Jan 13, 2017 at 02:04:38PM -0800, Shu Shen wrote: > The return type of vlan_tci_to_pcp() was int where it's expected to be > uint8_t and causing implicit truncation when the function is used. On > some platforms such as macOS, where PRIu8 is defined as "hhx" and no > promotion of short to

[ovs-dev] [PATCH v2] packet: proper return type for vlan_tci_to_pcp()

2017-01-13 Thread Shu Shen
The return type of vlan_tci_to_pcp() was int where it's expected to be uint8_t and causing implicit truncation when the function is used. On some platforms such as macOS, where PRIu8 is defined as "hhx" and no promotion of short to int is done, the compiler might throw out Wformat message for