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

Peter N Lewis peter at stairways.com.au
Wed Aug 21 18:37:12 PDT 2013


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.

-- 
Keyboard Maestro 6.1 now out - set web checkboxes & radio buttons, exit from loops, and more.

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.keyboardmaestro.com/>





More information about the cfe-commits mailing list