summaryrefslogtreecommitdiff
path: root/debian/patches/illumos-pragma-align.diff
blob: 4c6fdaf30a414b19fcb3e151050cb052ec2e6693 (plain)
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-9.git/src/gcc/config/sol2-c.c
===================================================================
--- gcc-9.git.orig/src/gcc/config/sol2-c.c
+++ gcc-9.git/src/gcc/config/sol2-c.c
@@ -112,8 +112,9 @@ solaris_pragma_align (cpp_reader *pfile
     {
       tree decl = identifier_global_value (t);
       if (decl && DECL_P (decl))
-	warning (0, "%<#pragma align%> must appear before the declaration of "
-		 "%qD, 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-9.git/src/gcc/testsuite/gcc.dg/pragma-align-2.c
===================================================================
--- gcc-9.git.orig/src/gcc/testsuite/gcc.dg/pragma-align-2.c
+++ gcc-9.git/src/gcc/testsuite/gcc.dg/pragma-align-2.c
@@ -26,9 +26,9 @@ void abort (void);
 #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 @@ main ()
   if (__alignof__ (x16) < 16)
     abort ();
 
+  if (__alignof__ (y16) < 16)
+    abort ();
+
   if (__alignof__ (x32) < 32)
     abort ();