On Thu, Mar 13, 2014 at 9:57 AM, Gurucharan Shetty <[email protected]> wrote:
> On Tue, Mar 11, 2014 at 1:56 PM, Ben Pfaff <[email protected]> wrote:
>> This is broken out into a separate commit because it adds new MSVC
>> specific code and I don't have MSVC around to test whether it's correct.
>>
>> CC: Gurucharan Shetty <[email protected]>
>> Signed-off-by: Ben Pfaff <[email protected]>
>
> Looks good to me.
>
> I do not see any users of it though.
I do see the users (Hadn't refreshed by tags). The change looks good to me.
>
> The idea is to do something like this, right?
>
> #define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG
>
> struct test {
> int a;
> int b;
> char c;
> };
> OVS_ALIGNED_STRUCT(64, test);
>
> Thanks,
> Guru
>
>
>> ---
>> lib/compiler.h | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/compiler.h b/lib/compiler.h
>> index e867d72..3b59813 100644
>> --- a/lib/compiler.h
>> +++ b/lib/compiler.h
>> @@ -1,5 +1,5 @@
>> /*
>> - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
>> + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
>> *
>> * Licensed under the Apache License, Version 2.0 (the "License");
>> * you may not use this file except in compliance with the License.
>> @@ -179,6 +179,20 @@
>> #define OVS_PACKED(DECL) __pragma(pack(push, 1)) DECL __pragma(pack(pop))
>> #endif
>>
>> +/* For defining a structure whose instances should aligned on an N-byte
>> + * boundary.
>> + *
>> + * e.g. The following:
>> + * OVS_ALIGNED_STRUCT(64, mystruct) { ... };
>> + * is equivalent to the following except that it specifies 64-byte
>> alignment:
>> + * struct mystruct { ... };
>> + */
>> +#ifndef _MSC_VER
>> +#define OVS_ALIGNED_STRUCT(N, TAG) struct __attribute__((aligned(N))) TAG
>> +#else
>> +#define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG
>> +#endif
>> +
>> #ifdef _MSC_VER
>> #define CCALL __cdecl
>> #pragma section(".CRT$XCU",read)
>> --
>> 1.7.10.4
>>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev