On Fri, Mar 30, 2012 at 09:24:06AM -0700, Ben Pfaff wrote:
> The header files that check-structs checks should only contain big-endian
> data, never native-endian data, so disallow uint<N>_t entirely.  (We had
> a couple of mistakes in this area until recently.)
> 
> uint8_t is an obvious exception.
> 
> Reported-by: Simon Horman <ho...@verge.net.au>
> Signed-off-by: Ben Pfaff <b...@nicira.com>

Reviewed-by: Simon Horman <ho...@verge.net.au>

> ---
>  build-aux/check-structs |    3 ---
>  tests/check-structs.at  |   12 ++++++------
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/build-aux/check-structs b/build-aux/check-structs
> index 731a4e2..e50e310 100755
> --- a/build-aux/check-structs
> +++ b/build-aux/check-structs
> @@ -11,9 +11,6 @@ anyWarnings = False
>  types = {}
>  types['char'] = {"size": 1, "alignment": 1}
>  types['uint8_t'] = {"size": 1, "alignment": 1}
> -types['uint16_t'] = {"size": 2, "alignment": 2}
> -types['uint32_t'] = {"size": 4, "alignment": 4}
> -types['uint64_t'] = {"size": 8, "alignment": 8}
>  types['ovs_be16'] = {"size": 2, "alignment": 2}
>  types['ovs_be32'] = {"size": 4, "alignment": 4}
>  types['ovs_be64'] = {"size": 8, "alignment": 8}
> diff --git a/tests/check-structs.at b/tests/check-structs.at
> index a926a0f..4163c30 100644
> --- a/tests/check-structs.at
> +++ b/tests/check-structs.at
> @@ -11,7 +11,7 @@ m4_define([RUN_STRUCT_CHECKER],
>  AT_SETUP([check struct tail padding])
>  RUN_STRUCT_CHECKER(
>  [struct xyz {
> -    uint16_t x;
> +    ovs_be16 x;
>  };], 
>    [1], [], 
>    [test.h:3: warning: struct xyz needs 2 bytes of tail padding
> @@ -21,8 +21,8 @@ AT_CLEANUP
>  AT_SETUP([check struct internal alignment])
>  RUN_STRUCT_CHECKER(
>  [struct xyzzy {
> -    uint16_t x;
> -    uint32_t y;
> +    ovs_be16 x;
> +    ovs_be32 y;
>  };], 
>    [1], [], 
>    [test.h:3: warning: struct xyzzy member y is 2 bytes short of 4-byte 
> alignment
> @@ -32,7 +32,7 @@ AT_CLEANUP
>  AT_SETUP([check struct declared size])
>  RUN_STRUCT_CHECKER(
>  [struct wibble {
> -    uint64_t z;
> +    ovs_be64 z;
>  };
>  OFP_ASSERT(sizeof(struct wibble) == 12);
>  ], 
> @@ -44,11 +44,11 @@ AT_CLEANUP
>  AT_SETUP([check wrong struct's declared size])
>  RUN_STRUCT_CHECKER(
>  [struct moo {
> -    uint64_t bar;
> +    ovs_be64 bar;
>  };
>  OFP_ASSERT(sizeof(struct moo) == 8);
>  struct wibble {
> -    uint64_t z;
> +    ovs_be64 z;
>  };
>  OFP_ASSERT(sizeof(struct moo) == 8);
>  ], [1], [], [test.h:8: warning: checking size of struct moo but struct 
> wibble was most recently defined
> -- 
> 1.7.2.5
> 
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to