From 494adeed0b1e2afdf696baeff995ee80e0f37e8b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 7 Nov 2005 17:21:23 +0000 Subject: [PATCH] silence gcc warnings --- Make.win32 | 2 +- gui-win32/screen.c | 22 +++++++++++----------- include/9windows.h | 2 ++ kern/devfs-win32.c | 3 +-- kern/devip-win32.c | 2 ++ kern/win32.c | 11 +++++------ 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Make.win32 b/Make.win32 index 687e543..c6bf99d 100644 --- a/Make.win32 +++ b/Make.win32 @@ -9,7 +9,7 @@ AR=$(MING)ar CC=$(MING)gcc AS=$(MING)as RANLIB=$(MING)ranlib -CFLAGS=-I$(ROOT)/include -I$(ROOT) -I$(ROOT)/kern -c -D_X86_ -DIS_32 -DWINDOWS +CFLAGS=-Wall -Wno-missing-braces -I$(ROOT)/include -I$(ROOT) -I$(ROOT)/kern -c -D_X86_ -DIS_32 -DWINDOWS O=o FS=fs-win32 IP=win32 diff --git a/gui-win32/screen.c b/gui-win32/screen.c index bee9dce..5492232 100644 --- a/gui-win32/screen.c +++ b/gui-win32/screen.c @@ -3,15 +3,16 @@ #undef Rectangle #define Rectangle _Rectangle -#include -#include -#include +#include "u.h" +#include "lib.h" +#include "kern/dat.h" +#include "kern/fns.h" +#include "error.h" +#include "user.h" #include #include -#include "error.h" #include "screen.h" #include "keyboard.h" -#include "fns.h" Memimage *gscreen; Screeninfo screen; @@ -31,14 +32,13 @@ static void winproc(void *); static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); static void paletteinit(void); static void bmiinit(void); -static void screenload2(Rectangle r, int ldepth, uchar *p, Point pt, int step); static int readybit; static Rendez rend; Point ZP; -static +static int isready(void*a) { return readybit; @@ -82,7 +82,7 @@ screeninit(void) gscreen = allocmemimage(Rect(0,0,dx,dy), fmt); kproc("winscreen", winproc, 0); - sleep(&rend, isready, 0); + ksleep(&rend, isready, 0); } uchar* @@ -123,7 +123,7 @@ screenload(Rectangle r, int depth, uchar *p, Point pt, int step) if(rectclip(&r, gscreen->r) == 0) return; - if(step&3 != 0 || ((pt.x*depth)%32) != 0 || (ulong)p&3 != 0) + if((step&3) != 0 || ((pt.x*depth)%32) != 0 || ((ulong)p&3) != 0) panic("screenload: bad params %d %d %ux", step, pt.x, p); dx = r.max.x - r.min.x; dy = r.max.y - r.min.y; @@ -574,9 +574,9 @@ clipread(void) return strdup(""); } - if(h = GetClipboardData(CF_UNICODETEXT)) + if((h = GetClipboardData(CF_UNICODETEXT))) p = clipreadunicode(h); - else if(h = GetClipboardData(CF_TEXT)) + else if((h = GetClipboardData(CF_TEXT))) p = clipreadutf(h); else { oserror(); diff --git a/include/9windows.h b/include/9windows.h index 82fa75a..153e30f 100644 --- a/include/9windows.h +++ b/include/9windows.h @@ -12,7 +12,9 @@ #include /* disable various silly warnings */ +#ifdef MSVC #pragma warning( disable : 4245 4305 4244 4102 4761 4090 4028 4024) +#endif typedef __int64 p9_vlong; typedef unsigned __int64 p9_uvlong; diff --git a/kern/devfs-win32.c b/kern/devfs-win32.c index c934b80..ee6750a 100644 --- a/kern/devfs-win32.c +++ b/kern/devfs-win32.c @@ -56,7 +56,6 @@ static void fspath(Chan*, char*, char*); static ulong fsdirread(Chan*, uchar*, int, ulong); static int fsomode(int); static int chown(char *path, int uid, int); -static int link(char *path, char *next); /* clumsy hack, but not worse than the Path stuff in the last one */ static char* @@ -132,7 +131,7 @@ fswalk1(Chan *c, char *name) fspath(c, name, path); - /* print("** fs walk '%s' -> %s\n", path, name); /**/ + /* print("** fs walk '%s' -> %s\n", path, name); */ if(stat(path, &stbuf) < 0) return 0; diff --git a/kern/devip-win32.c b/kern/devip-win32.c index d577300..acf22ca 100644 --- a/kern/devip-win32.c +++ b/kern/devip-win32.c @@ -7,7 +7,9 @@ #include "devip.h" +#ifdef MSVC #pragma comment(lib, "wsock32.lib") +#endif #undef listen #undef accept diff --git a/kern/win32.c b/kern/win32.c index e448081..105123c 100644 --- a/kern/win32.c +++ b/kern/win32.c @@ -54,7 +54,7 @@ osinit(void) t->sema = CreateSemaphore(0, 0, 1000, 0); if(t->sema == 0) { oserror(); - fatal("could not create semaphore: %r"); + panic("could not create semaphore: %r"); } } @@ -67,7 +67,7 @@ osnewproc(Proc *p) op->sema = CreateSemaphore(0, 0, 1000, 0); if (op->sema == 0) { oserror(); - fatal("could not create semaphore: %r"); + panic("could not create semaphore: %r"); } } @@ -92,7 +92,7 @@ osproc(Proc *p) if(CreateThread(0, 0, tramp, p, 0, &tid) == 0) { oserror(); - fatal("osproc: %r"); + panic("osproc: %r"); } Sleep(0); @@ -109,7 +109,7 @@ tramp(LPVOID vp) op->sema = CreateSemaphore(0, 0, 1000, 0); if(op->sema == 0) { oserror(); - fatal("could not create semaphore: %r"); + panic("could not create semaphore: %r"); } (*p->fn)(p->arg); @@ -162,7 +162,7 @@ seconds(void) return time(0); } -int +ulong ticks(void) { return GetTickCount(); @@ -182,7 +182,6 @@ fastticks(uvlong *v) #endif extern int main(int, char*[]); -static int args(char *argv[], int n, char *p); int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR arg, int nshow)