r188905 - Tweak gnu-flags.c test for z, where globals have 2-byte alignment by default

Richard Sandiford rsandifo at linux.vnet.ibm.com
Thu Aug 22 09:21:29 PDT 2013


Dmitri Gribenko <gribozavr at gmail.com> writes:
> On Wed, Aug 21, 2013 at 6:37 PM, Peter N Lewis <peter at stairways.com.au> wrote:
>> On 22/08/2013, at 0:37 , Richard Sandiford
>> <rsandifo at linux.vnet.ibm.com> wrote:
>>> Author: rsandifo
>>> Date: Wed Aug 21 11:37:37 2013
>>> New Revision: 188905
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=188905&view=rev
>>> Log:
>>> Tweak gnu-flags.c test for z, where globals have 2-byte alignment by default
>>>
>>> Modified:
>>>    cfe/trunk/test/Sema/gnu-flags.c
>>>
>>> Modified: cfe/trunk/test/Sema/gnu-flags.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/gnu-flags.c?rev=188905&r1=188904&r2=188905&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Sema/gnu-flags.c (original)
>>> +++ cfe/trunk/test/Sema/gnu-flags.c Wed Aug 21 11:37:37 2013
>>> @@ -20,12 +20,18 @@
>>> #endif
>>>
>>>
>>> +#ifdef __s390x__
>>> +#define EXPECTED_ALIGN 2
>>> +#else
>>> +#define EXPECTED_ALIGN 1
>>> +#endif
>>> +
>>> #if ALL || ALIGNOF
>>> // expected-warning at +4 {{'_Alignof' applied to an expression is a GNU
>>> extension}}
>>> #endif
>>>
>>> char align;
>>> -_Static_assert(_Alignof(align) == 1, "align's alignment is wrong");
>>> +_Static_assert(_Alignof(align) == EXPECTED_ALIGN, "align's alignment
>>> is wrong");
>>
>> Since the test is only meant to be testing the _Alignof warning,
>> unless you really want to test the _Alignof value, a better patch
>> would be to just ignore the value of _Alignof :
>>
>> Index: gnu-flags.c
>> ===================================================================
>> --- gnu-flags.c (revision 188975)
>> +++ gnu-flags.c (working copy)
>> @@ -31,7 +31,7 @@
>>  #endif
>>
>>  char align;
>> -_Static_assert(_Alignof(align) == EXPECTED_ALIGN, "align's alignment
>> is wrong");
>> +const int alignis = _Alignof(align);
>>
>>
>>  #if ALL || CASERANGE
>>
>> That avoids any hardware dependencies.
>
> Relaxed the check in r188993.

Thanks.

Richard




More information about the cfe-commits mailing list