From 4fb8df8cd1df4552e937d02fa78fc4993af81e63 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 15 Feb 2019 10:57:54 +0100 Subject: Revised attachment of name attributes to structs, unions, enums Consider: ``` struct s { ... } __attribute((aligned(N))); struct t { ... } __attribute((aligned(N))) struct t x; ``` In the first case, the aligned attribute should be attached to struct s, so that further references to struct s are aligned. In the second case, the aligned attribute should be attached to the variable x, because if we attach it to struct t, it will be ignored and cause a warning. This commit changes the attachment rule so that it treats both cases right. Extend regression test for "aligned" attribute accordingly, by testing aligned attribute applied to a name of struct type. --- test/regression/Results/aligned | 1 + 1 file changed, 1 insertion(+) (limited to 'test/regression/Results/aligned') diff --git a/test/regression/Results/aligned b/test/regression/Results/aligned index 7a4f7c9f..c42a5c40 100644 --- a/test/regression/Results/aligned +++ b/test/regression/Results/aligned @@ -9,3 +9,4 @@ i: size 16, offset mod 16 = 0 j: size 16, offset mod 16 = 0 T2: size 112, alignment 16 T4: size is that of a pointer, alignment is that of a pointer +t2: size 9, alignment 1 -- cgit