1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
Description: Allow #pragma align to be used after a variable is declared
GCC mandates that #pragma align precede any declaration, Sun C does not.
See http://wiki.illumos.org/display/illumos/GCC+Modifications
Index: gcc-48/src/gcc/config/sol2-c.c
===================================================================
--- gcc-48.orig/src/gcc/config/sol2-c.c 2013-01-11 00:38:27.000000000 +0400
+++ gcc-48/src/gcc/config/sol2-c.c 2013-11-07 13:15:05.497438976 +0400
@@ -113,8 +113,9 @@
{
tree decl = identifier_global_value (t);
if (decl && DECL_P (decl))
- warning (0, "%<#pragma align%> must appear before the declaration of "
- "%D, ignoring", decl);
+ decl_attributes (&decl, build_tree_list (get_identifier ("aligned"),
+ build_tree_list (NULL, x)),
+ 0);
else
solaris_pending_aligns = tree_cons (t, build_tree_list (NULL, x),
solaris_pending_aligns);
Index: gcc-48/src/gcc/testsuite/gcc.dg/pragma-align-2.c
===================================================================
--- gcc-48.orig/src/gcc/testsuite/gcc.dg/pragma-align-2.c 2011-11-08 01:02:57.000000000 +0400
+++ gcc-48/src/gcc/testsuite/gcc.dg/pragma-align-2.c 2013-11-07 13:15:05.499487945 +0400
@@ -26,9 +26,9 @@
#pragma align bad_align /* { dg-warning "malformed" } */
#pragma align 1(bad_align /* { dg-warning "malformed" } */
-int x, x1, x2, x4, x8, y8, z8, x16, x32, x64, x128, y128, z128;
+int x1, x2, x4, x8, y8, z8, x16, y16, x32, x64, x128, y128, z128
-#pragma align 16(x) /* { dg-warning "must appear before" } */
+#pragma align 16(y16)
int
main ()
@@ -48,6 +48,9 @@
if (__alignof__ (x16) < 16)
abort ();
+ if (__alignof__ (y16) < 16)
+ abort ();
+
if (__alignof__ (x32) < 32)
abort ();
|