~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/cmd/gc/align.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
static int defercalc;
17
17
 
18
 
uint32
19
 
rnd(uint32 o, uint32 r)
 
18
vlong
 
19
rnd(vlong o, vlong r)
20
20
{
21
21
        if(r < 1 || r > 8 || (r&(r-1)) != 0)
22
22
                fatal("rnd");
46
46
widstruct(Type *errtype, Type *t, vlong o, int flag)
47
47
{
48
48
        Type *f;
49
 
        int32 w, maxalign;
 
49
        int64 w;
 
50
        int32 maxalign;
50
51
        
51
52
        maxalign = flag;
52
53
        if(maxalign < 1)
54
55
        for(f=t->type; f!=T; f=f->down) {
55
56
                if(f->etype != TFIELD)
56
57
                        fatal("widstruct: not TFIELD: %lT", f);
 
58
                if(f->type == T) {
 
59
                        // broken field, just skip it so that other valid fields
 
60
                        // get a width.
 
61
                        continue;
 
62
                }
57
63
                dowidth(f->type);
58
64
                if(f->type->align > maxalign)
59
65
                        maxalign = f->type->align;
248
254
                        checkwidth(t->type);
249
255
                        t->align = widthptr;
250
256
                }
251
 
                else if(t->bound == -100)
252
 
                        yyerror("use of [...] array outside of array literal");
 
257
                else if(t->bound == -100) {
 
258
                        if(!t->broke) {
 
259
                                yyerror("use of [...] array outside of array literal");
 
260
                                t->broke = 1;
 
261
                        }
 
262
                }
253
263
                else
254
264
                        fatal("dowidth %T", t); // probably [...]T
255
265
                break;
607
617
                        fatal("typeinit: %s already defined", s->name);
608
618
 
609
619
                t = typ(etype);
610
 
                t->sym = s;
 
620
                t->sym = s1;
611
621
 
612
622
                dowidth(t);
613
623
                types[etype] = t;
615
625
        }
616
626
 
617
627
        Array_array = rnd(0, widthptr);
618
 
        Array_nel = rnd(Array_array+widthptr, types[TUINT32]->width);
619
 
        Array_cap = rnd(Array_nel+types[TUINT32]->width, types[TUINT32]->width);
620
 
        sizeof_Array = rnd(Array_cap+types[TUINT32]->width, widthptr);
 
628
        Array_nel = rnd(Array_array+widthptr, widthint);
 
629
        Array_cap = rnd(Array_nel+widthint, widthint);
 
630
        sizeof_Array = rnd(Array_cap+widthint, widthptr);
621
631
 
622
632
        // string is same as slice wo the cap
623
 
        sizeof_String = rnd(Array_nel+types[TUINT32]->width, widthptr);
 
633
        sizeof_String = rnd(Array_nel+widthint, widthptr);
624
634
 
625
635
        dowidth(types[TSTRING]);
626
636
        dowidth(idealstring);
634
644
{
635
645
        Iter save;
636
646
        Type *fp;
637
 
        int w, x;
 
647
        int64 w, x;
638
648
 
639
649
        w = 0;
640
650
 
655
665
        }
656
666
 
657
667
        w = (w+widthptr-1) & ~(widthptr-1);
 
668
        if((int)w != w)
 
669
                fatal("argsize too big");
658
670
        return w;
659
671
}