tall: fix or silence all INSTALL warnings on macOS - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 310ae03327a815e721166b64aa3af27b1cc8c2ff
 (DIR) parent 9e0d3750c543de49ccc43512cb3fbaa1f42f1648
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Fri,  6 Jan 2017 16:32:31 -0500
       
       all: fix or silence all INSTALL warnings on macOS
       
       Should be a clean build now.
       
       Change-Id: Id3460371cb5e8d4071f8faa9c2aec870d213a067
       Reviewed-on: https://plan9port-review.googlesource.com/2781
       Reviewed-by: Russ Cox <rsc@swtch.com>
       
       Diffstat:
         M bin/9c                              |       6 +++---
         M lib/yaccpar                         |       3 ++-
         M src/cmd/9660srv/iobuf.c             |       4 ++--
         M src/cmd/acme/exec.c                 |       2 +-
         M src/cmd/dd.c                        |       7 +++----
         M src/cmd/devdraw/cocoa-screen.m      |     140 ++++++++++++++++++-------------
         M src/cmd/devdraw/devdraw.c           |       4 ++--
         M src/cmd/devdraw/macargv.m           |       4 ++--
         M src/cmd/fossil/mkfile               |       2 +-
         M src/cmd/grep/sub.c                  |       4 ++--
         M src/cmd/map/libmap/perspective.c    |       2 +-
         M src/cmd/venti/srv/graph.c           |       2 +-
         M src/libmach/mach386.c               |       2 +-
         M src/libmach/machpower.c             |       6 +++---
         M src/libregexp/regcomp.c             |       5 +----
       
       15 files changed, 106 insertions(+), 87 deletions(-)
       ---
 (DIR) diff --git a/bin/9c b/bin/9c
       t@@ -41,8 +41,10 @@ quiet()
                ignore=$ignore'|        from'
                ignore=$ignore'|use of C99 long long'
                ignore=$ignore'|ISO C forbids conversion'
       +        ignore=$ignore'|marked deprecated'
                ignore=$ignore'|is deprecated'
                ignore=$ignore'|warn_unused_result'
       +        ignore=$ignore'|expanded from macro'
        
                grep -v '__p9l_autolib_' $1 |
                egrep -v "$ignore" |
       t@@ -80,12 +82,10 @@ case "$tag" in
        *FreeBSD*gcc*)        usegcc ;;
        *FreeBSD*clang*)        useclang ;;
        *DragonFly*|*BSD*)        usegcc ;;
       -*Darwin-x86_64*clang*)
       +*Darwin-x86_64*)
                        useclang
                        cflags="$ngflags -g3 -m64"
                        ;;
       -*Darwin-x86_64*) usegcc
       -                cflags="$ngflags -g3 -no-cpp-precomp -m64" ;;
        *Darwin*clang*)
                        useclang
                        cflags="$ngflags -g3 -m32"
 (DIR) diff --git a/lib/yaccpar b/lib/yaccpar
       t@@ -128,7 +128,8 @@ yyparse(void)
                yychar = -1;
                yynerrs = 0;
                yyerrflag = 0;
       -        yyp = &yys[-1];
       +        yyp = &yys[0];
       +        yyp--;
                goto yystack;
        
        ret0:
 (DIR) diff --git a/src/cmd/9660srv/iobuf.c b/src/cmd/9660srv/iobuf.c
       t@@ -46,8 +46,8 @@ iobuf_init(void)
        
                n = nclust*sizeof(Ioclust) +
                        nclust*BUFPERCLUST*(sizeof(Iobuf)+Sectorsize);
       -        mem = sbrk(n);
       -        if(mem == (void*)-1)
       +        mem = malloc(n);
       +        if(mem == (void*)0)
                        panic(0, "iobuf_init");
                memset(mem, 0, n);
        
 (DIR) diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c
       t@@ -652,7 +652,7 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
                d = dirstat(name);
                if(d!=nil && runeeq(namer, nname, f->name, f->nname)){
                        /* f->mtime+1 because when talking over NFS it's often off by a second */
       -                if(f->dev!=d->dev || f->qidpath!=d->qid.path || abs(f->mtime-d->mtime) > 1){
       +                if(f->dev!=d->dev || f->qidpath!=d->qid.path || labs((long)(f->mtime-d->mtime)) > 1){
                                if(f->unread)
                                        warning(nil, "%s not written; file already exists\n", name);
                                else
 (DIR) diff --git a/src/cmd/dd.c b/src/cmd/dd.c
       t@@ -219,13 +219,12 @@ main(int argc, char *argv[])
                        fprint(2, "dd: counts: cannot be zero\n");
                        exits("counts");
                }
       -        ibuf = sbrk(ibs);
       +        ibuf = malloc(ibs);
                if(fflag)
                        obuf = ibuf;
                else
       -                obuf = sbrk(obs);
       -        sbrk(64);        /* For good measure */
       -        if(ibuf == (char *)-1 || obuf == (char *)-1) {
       +                obuf = malloc(obs);
       +        if(ibuf == (char *)0 || obuf == (char *)0) {
                        fprint(2, "dd: not enough memory: %r\n");
                        exits("memory");
                }
 (DIR) diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m
       t@@ -28,6 +28,30 @@
        #include "bigarrow.h"
        #include "glendapng.h"
        
       +// Use non-deprecated names.
       +#define NSKeyDown NSEventTypeKeyDown
       +#define NSAlternateKeyMask NSEventModifierFlagOption
       +#define NSCommandKeyMask NSEventModifierFlagCommand
       +#define NSResizableWindowMask NSWindowStyleMaskResizable
       +#define NSLeftMouseDown NSEventTypeLeftMouseDown
       +#define NSLeftMouseUp NSEventTypeLeftMouseUp
       +#define NSRightMouseDown NSEventTypeRightMouseDown
       +#define NSRightMouseUp NSEventTypeRightMouseUp
       +#define NSOtherMouseDown NSEventTypeOtherMouseDown
       +#define NSOtherMouseUp NSEventTypeOtherMouseUp
       +#define NSScrollWheel NSEventTypeScrollWheel
       +#define NSMouseMoved NSEventTypeMouseMoved
       +#define NSLeftMouseDragged NSEventTypeLeftMouseDragged
       +#define NSRightMouseDragged NSEventTypeRightMouseDragged
       +#define NSOtherMouseDragged NSEventTypeOtherMouseDragged
       +#define NSCompositeCopy NSCompositingOperationCopy
       +#define NSCompositeSourceIn NSCompositingOperationSourceIn
       +#define NSFlagsChanged NSEventTypeFlagsChanged
       +#define NSTitledWindowMask NSWindowStyleMaskTitled
       +#define NSClosableWindowMask NSWindowStyleMaskClosable
       +#define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable
       +#define NSBorderlessWindowMask NSWindowStyleMaskBorderless
       +
        AUTOFRAMEWORK(Cocoa)
        
        #define LOG        if(0)NSLog
       t@@ -53,7 +77,9 @@ usage(void)
                threadexitsall("usage");
        }
        
       -@interface appdelegate : NSObject @end
       +@interface appdelegate : NSObject<NSApplicationDelegate,NSWindowDelegate> @end
       +
       +NSObject<NSApplicationDelegate,NSWindowDelegate> *myApp;
        
        void
        threadmain(int argc, char **argv)
       t@@ -97,7 +123,8 @@ threadmain(int argc, char **argv)
        
                [NSApplication sharedApplication];
                [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
       -        [NSApp setDelegate:[appdelegate new]];
       +        myApp = [appdelegate new];
       +        [NSApp setDelegate:myApp];
                [NSApp run];
        }
        
       t@@ -402,7 +429,7 @@ makewin(char *s)
                        backing:NSBackingStoreBuffered defer:YES];
                for(i=0; i<2; i++){
                        [win.ofs[i] setAcceptsMouseMovedEvents:YES];
       -                [win.ofs[i] setDelegate:[NSApp delegate]];
       +                [win.ofs[i] setDelegate:myApp];
                        [win.ofs[i] setDisplaysWhenScreenProfileChanges:NO];
                }
                win.isofs = 0;
       t@@ -567,7 +594,7 @@ flushimg(NSRect rect)
                rect = dilate(scalerect(rect, win.topointscale));
                r.size.height -= Cornersize;
                dr = NSIntersectionRect(r, rect);
       -        LOG(@"r %.0f %.0f", r.origin.x, r.origin.y, rect.size.width, rect.size.height);
       +        LOG(@"r %.0f %.0f %.0f %.0f", r.origin.x, r.origin.y, rect.size.width, rect.size.height);
                LOG(@"rect in points %f %f %.0f %.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
                LOG(@"dr in points %f %f %.0f %.0f", dr.origin.x, dr.origin.y, dr.size.width, dr.size.height);
                drawimg(dr, NSCompositeCopy);
       t@@ -792,52 +819,52 @@ static void updatecursor(void);
        
        static int keycvt[] =
        {
       -        [QZ_IBOOK_ENTER] '\n',
       -        [QZ_RETURN] '\n',
       -        [QZ_ESCAPE] 27,
       -        [QZ_BACKSPACE] '\b',
       -        [QZ_LALT] Kalt,
       -        [QZ_LCTRL] Kctl,
       -        [QZ_LSHIFT] Kshift,
       -        [QZ_F1] KF+1,
       -        [QZ_F2] KF+2,
       -        [QZ_F3] KF+3,
       -        [QZ_F4] KF+4,
       -        [QZ_F5] KF+5,
       -        [QZ_F6] KF+6,
       -        [QZ_F7] KF+7,
       -        [QZ_F8] KF+8,
       -        [QZ_F9] KF+9,
       -        [QZ_F10] KF+10,
       -        [QZ_F11] KF+11,
       -        [QZ_F12] KF+12,
       -        [QZ_INSERT] Kins,
       -        [QZ_DELETE] 0x7F,
       -        [QZ_HOME] Khome,
       -        [QZ_END] Kend,
       -        [QZ_KP_PLUS] '+',
       -        [QZ_KP_MINUS] '-',
       -        [QZ_TAB] '\t',
       -        [QZ_PAGEUP] Kpgup,
       -        [QZ_PAGEDOWN] Kpgdown,
       -        [QZ_UP] Kup,
       -        [QZ_DOWN] Kdown,
       -        [QZ_LEFT] Kleft,
       -        [QZ_RIGHT] Kright,
       -        [QZ_KP_MULTIPLY] '*',
       -        [QZ_KP_DIVIDE] '/',
       -        [QZ_KP_ENTER] '\n',
       -        [QZ_KP_PERIOD] '.',
       -        [QZ_KP0] '0',
       -        [QZ_KP1] '1',
       -        [QZ_KP2] '2',
       -        [QZ_KP3] '3',
       -        [QZ_KP4] '4',
       -        [QZ_KP5] '5',
       -        [QZ_KP6] '6',
       -        [QZ_KP7] '7',
       -        [QZ_KP8] '8',
       -        [QZ_KP9] '9',
       +        [QZ_IBOOK_ENTER]= '\n',
       +        [QZ_RETURN]= '\n',
       +        [QZ_ESCAPE]= 27,
       +        [QZ_BACKSPACE]= '\b',
       +        [QZ_LALT]= Kalt,
       +        [QZ_LCTRL]= Kctl,
       +        [QZ_LSHIFT]= Kshift,
       +        [QZ_F1]= KF+1,
       +        [QZ_F2]= KF+2,
       +        [QZ_F3]= KF+3,
       +        [QZ_F4]= KF+4,
       +        [QZ_F5]= KF+5,
       +        [QZ_F6]= KF+6,
       +        [QZ_F7]= KF+7,
       +        [QZ_F8]= KF+8,
       +        [QZ_F9]= KF+9,
       +        [QZ_F10]= KF+10,
       +        [QZ_F11]= KF+11,
       +        [QZ_F12]= KF+12,
       +        [QZ_INSERT]= Kins,
       +        [QZ_DELETE]= 0x7F,
       +        [QZ_HOME]= Khome,
       +        [QZ_END]= Kend,
       +        [QZ_KP_PLUS]= '+',
       +        [QZ_KP_MINUS]= '-',
       +        [QZ_TAB]= '\t',
       +        [QZ_PAGEUP]= Kpgup,
       +        [QZ_PAGEDOWN]= Kpgdown,
       +        [QZ_UP]= Kup,
       +        [QZ_DOWN]= Kdown,
       +        [QZ_LEFT]= Kleft,
       +        [QZ_RIGHT]= Kright,
       +        [QZ_KP_MULTIPLY]= '*',
       +        [QZ_KP_DIVIDE]= '/',
       +        [QZ_KP_ENTER]= '\n',
       +        [QZ_KP_PERIOD]= '.',
       +        [QZ_KP0]= '0',
       +        [QZ_KP1]= '1',
       +        [QZ_KP2]= '2',
       +        [QZ_KP3]= '3',
       +        [QZ_KP4]= '4',
       +        [QZ_KP5]= '5',
       +        [QZ_KP6]= '6',
       +        [QZ_KP7]= '7',
       +        [QZ_KP8]= '8',
       +        [QZ_KP9]= '9',
        };
        
        @interface apptext : NSTextView @end
       t@@ -1138,30 +1165,25 @@ sendmouse(void)
        void
        setmouse(Point p)
        {
       -        static int first = 1;
                NSPoint q;
                NSRect r;
        
                if([NSApp isActive]==0 && in.willactivate==0)
                        return;
        
       -        if(first){
       -                /* Try to move Acme's scrollbars without that! */
       -                CGSetLocalEventsSuppressionInterval(0);
       -                first = 0;
       -        }
                if([WIN inLiveResize])
                        return;
        
                in.mpos = scalepoint(NSMakePoint(p.x, p.y), win.topointscale);        // race condition
        
                q = [win.content convertPoint:in.mpos toView:nil];
       -        q = [WIN convertBaseToScreen:q];
       +        q = [WIN convertRectToScreen:NSMakeRect(q.x, q.y, 0, 0)].origin;
        
                r = [[[NSScreen screens] objectAtIndex:0] frame];
                q.y = r.size.height - q.y;        /* Quartz is top-left-based here */
        
                CGWarpMouseCursorPosition(NSPointToCGPoint(q));
       +        CGAssociateMouseAndMouseCursorPosition(true);
        }
        
        /*
       t@@ -1431,14 +1453,14 @@ makecursor(Cursor *c)
                        samplesPerPixel:2
                        hasAlpha:YES
                        isPlanar:YES
       -                colorSpaceName:NSDeviceBlackColorSpace
       +                colorSpaceName:NSDeviceWhiteColorSpace
                        bytesPerRow:2
                        bitsPerPixel:1];
        
                [r getBitmapDataPlanes:plane];
        
                for(b=0; b<2*16; b++){
       -                plane[0][b] = c->set[b];
       +                plane[0][b] = ~c->set[b];
                        plane[1][b] = c->clr[b];
                }
                p = NSMakePoint(-c->offset.x, -c->offset.y);
 (DIR) diff --git a/src/cmd/devdraw/devdraw.c b/src/cmd/devdraw/devdraw.c
       t@@ -727,10 +727,10 @@ drawcoord(uchar *p, uchar *maxp, int oldx, int *newx)
                        x |= *p++ << 7;
                        x |= *p++ << 15;
                        if(x & (1<<22))
       -                        x |= ~0<<23;
       +                        x |= ~0U<<23;
                }else{
                        if(b & 0x40)
       -                        x |= ~0<<7;
       +                        x |= ~0U<<7;
                        x += oldx;
                }
                *newx = x;
 (DIR) diff --git a/src/cmd/devdraw/macargv.m b/src/cmd/devdraw/macargv.m
       t@@ -7,7 +7,7 @@
        AUTOFRAMEWORK(Foundation)
        AUTOFRAMEWORK(Cocoa)
        
       -@interface appdelegate : NSObject @end
       +@interface appdelegate : NSObject<NSApplicationDelegate> @end
        
        void
        main(void)
       t@@ -16,7 +16,7 @@ main(void)
                        [NSAutoreleasePool new];
        
                [NSApplication sharedApplication];
       -        NSObject *delegate = [appdelegate new];
       +        NSObject<NSApplicationDelegate> *delegate = [appdelegate new];
                [NSApp setDelegate:delegate];
        
                NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];    /* Register a call-back for URL Events */
 (DIR) diff --git a/src/cmd/fossil/mkfile b/src/cmd/fossil/mkfile
       t@@ -66,7 +66,7 @@ $O.flfmt: flfmt9660.$O
        
        flfmt%.$O: flfmt9660.h
        
       -$O.conf:D: conf.rc
       +$O.conf:DQ: conf.rc
                {
                        echo '#!/usr/local/plan9/bin/rc'
                        echo '# THIS FILE IS AUTOMATICALLY GENERATED'
 (DIR) diff --git a/src/cmd/grep/sub.c b/src/cmd/grep/sub.c
       t@@ -10,11 +10,11 @@ mal(int n)
                n = (n+3) & ~3;
                if(m < n) {
                        if(n > Nhunk) {
       -                        v = sbrk(n);
       +                        v = malloc(n);
                                memset(v, 0, n);
                                return v;
                        }
       -                s = sbrk(Nhunk);
       +                s = malloc(Nhunk);
                        m = Nhunk;
                }
                v = s;
 (DIR) diff --git a/src/cmd/map/libmap/perspective.c b/src/cmd/map/libmap/perspective.c
       t@@ -9,7 +9,7 @@ static int
        Xperspective(struct place *place, double *x, double *y)
        {
                double r;
       -        if(viewpt<=1+FUZZ && fabs(place->nlat.s<=viewpt+.01))
       +        if(viewpt<=1+FUZZ && fabs(place->nlat.s)<=viewpt+.01)
                        return(-1);
                r = place->nlat.c*(viewpt - 1.)/(viewpt - place->nlat.s);
                *x = - r*place->wlon.s;
 (DIR) diff --git a/src/cmd/venti/srv/graph.c b/src/cmd/venti/srv/graph.c
       t@@ -154,7 +154,7 @@ statgraph(Graph *g)
        
                qlock(&memdrawlock);
                ginit();
       -        if(smallfont==nil || black==nil || blue==nil || red==nil || hifill==nil || lofill==nil){
       +        if(smallfont==nil || black==nil || blue==nil || red==nil || hifill[0]==nil || lofill[0]==nil){
                        werrstr("graphics initialization failed: %r");
                        qunlock(&memdrawlock);
                        return nil;
 (DIR) diff --git a/src/libmach/mach386.c b/src/libmach/mach386.c
       t@@ -1701,7 +1701,7 @@ badop:
                                                return 0;
                                        ip->imm64 = ip->imm;
                                        if(ip->rex&REXW && (ip->imm & (1<<31)) != 0)
       -                                        ip->imm64 |= (vlong)~0 << 32;
       +                                        ip->imm64 |= (vlong)(~0ULL << 32);
                                } else {
                                        if (igets(map, ip, &s)< 0)
                                                return 0;
 (DIR) diff --git a/src/libmach/machpower.c b/src/libmach/machpower.c
       t@@ -138,7 +138,7 @@ typedef struct {
                char        *err;                /* errmsg */
        } Instr;
        
       -#define        IBF(v,a,b) (((ulong)(v)>>(32-(b)-1)) & ~(~0L<<(((b)-(a)+1))))
       +#define        IBF(v,a,b) (((ulong)(v)>>(32-(b)-1)) & ~(~0UL<<(((b)-(a)+1))))
        #define        IB(v,b) IBF((v),(b),(b))
        
        static void
       t@@ -165,7 +165,7 @@ decode(ulong pc, Instr *i)
                i->crbb = IBF(w, 16, 20);
                i->bd = IBF(w, 16, 29)<<2;
                if(i->bd & 0x8000)
       -                i->bd |= ~0L<<16;
       +                i->bd |= ~0UL<<16;
                i->crfd = IBF(w, 6, 8);
                i->crfs = IBF(w, 11, 13);
                i->bi = IBF(w, 11, 15);
       t@@ -181,7 +181,7 @@ decode(ulong pc, Instr *i)
                i->crm = IBF(w, 12, 19);
                i->li = IBF(w, 6, 29)<<2;
                if(IB(w, 6))
       -                i->li |= ~0<<25;
       +                i->li |= ~0UL<<25;
                i->lk = IB(w, 31);
                i->mb = IBF(w, 21, 25);
                i->me = IBF(w, 26, 30);
 (DIR) diff --git a/src/libregexp/regcomp.c b/src/libregexp/regcomp.c
       t@@ -15,9 +15,6 @@ struct Node
                Reinst*        last;
        }Node;
        
       -/* max character classes per program is nelem(reprog->class) */
       -static Reprog        *reprog;
       -
        /* max rune ranges per character class is nelem(classp->spans)/2 */
        #define NCCRUNE        nelem(classp->spans)
        
       t@@ -327,7 +324,7 @@ dump(Reprog *pp)
        static        Reclass*
        newclass(void)
        {
       -        if(nclass >= nelem(reprog->class))
       +        if(nclass >= nelem(((Reprog*)0)->class))
                        rcerror("too many character classes; increase Reprog.class size");
                return &(classp[nclass++]);
        }