Browse Source

Fix the rest of the warnings.

This fixes the rest of the warnings in the default build and
re-enable -Werror.  There may be some still lurking in the bits
of code that don't get built when we just run `util/build`
(e.g., other kernel configurations mostly) but this gets the
vast bulk of them.

Of note, RISC-V is currently broken due to unrelated missing
symbols called from the keyboard map driver.

Signed-off-by: Dan Cross <cross@gajendra.net>
Dan Cross 7 years ago
parent
commit
767cdc5325
100 changed files with 538 additions and 509 deletions
  1. 2 1
      aarch64/include/cflags.json
  2. 1 0
      aarch64/include/klib.json
  3. 2 0
      aarch64/include/u.h
  4. 1 1
      acme/bin/source/acd/main.c
  5. 2 2
      acme/bin/source/adict/adict.c
  6. 2 0
      amd64/clang-3.7.BUILD
  7. 2 0
      amd64/clang-3.8.BUILD
  8. 2 0
      amd64/clang-3.9.BUILD
  9. 2 0
      amd64/clang.BUILD
  10. 2 1
      amd64/gcc-4.8.BUILD
  11. 2 1
      amd64/gcc-5.BUILD
  12. 2 1
      amd64/gcc-6.BUILD
  13. 2 1
      amd64/gcc.BUILD
  14. 2 1
      amd64/include/cflags.json
  15. 1 0
      amd64/include/klib.json
  16. 1 0
      amd64/include/u.h
  17. 1 2
      amd64/include/x86_64-elf-gcc.json
  18. 1 2
      amd64/include/x86_64-none-elf-gcc.json
  19. 2 1
      amd64/x86_64-elf-gcc.BUILD
  20. 1 3
      riscv/include/cflags.json
  21. 1 4
      riscv/include/klib.json
  22. 27 0
      riscv/include/mach_acpi.h
  23. 1 6
      riscv/include/u.h
  24. 0 1
      sys/include/libc.h
  25. 1 5
      sys/man/2/getcallerpc
  26. 3 3
      sys/src/9/386/devrtc.c
  27. 5 5
      sys/src/9/386/ether8169.c
  28. 4 4
      sys/src/9/386/ether82557.c
  29. 2 2
      sys/src/9/386/etherigbe.c
  30. 16 16
      sys/src/9/386/etherm10g.c
  31. 5 5
      sys/src/9/386/pci.c
  32. 2 1
      sys/src/9/386/vgavesa.c
  33. 0 1
      sys/src/9/aarch64/core.json
  34. 1 0
      sys/src/9/aarch64/inith.json
  35. 1 11
      sys/src/9/amd64/BUILD
  36. 0 11
      sys/src/9/amd64/core.json
  37. 1 1
      sys/src/9/amd64/dat.h
  38. 19 1
      sys/src/9/amd64/devacpi.c
  39. 9 9
      sys/src/9/amd64/devarch.c
  40. 5 5
      sys/src/9/amd64/deviig.c
  41. 8 8
      sys/src/9/amd64/devpmc.c
  42. 1 1
      sys/src/9/amd64/devusb.c
  43. 19 19
      sys/src/9/amd64/devvga.c
  44. 3 3
      sys/src/9/amd64/ether8139.c
  45. 1 1
      sys/src/9/amd64/ether82563.c
  46. 4 0
      sys/src/9/amd64/fns.h
  47. 1 3
      sys/src/9/amd64/inith.json
  48. 1 1
      sys/src/9/amd64/ioapic.c
  49. 1 1
      sys/src/9/amd64/main.c
  50. 9 9
      sys/src/9/amd64/mouse.c
  51. 1 1
      sys/src/9/amd64/msi.c
  52. 6 3
      sys/src/9/amd64/pmcio.c
  53. 2 2
      sys/src/9/amd64/root/cpu.c
  54. 8 8
      sys/src/9/amd64/sdiahci.c
  55. 5 4
      sys/src/9/amd64/usbohci.c
  56. 4 3
      sys/src/9/amd64/usbuhci.c
  57. 1 3
      sys/src/9/boot/BUILD
  58. 1 1
      sys/src/9/boot/boot.c
  59. 1 3
      sys/src/9/boot/boot.json
  60. 1 1
      sys/src/9/boot/bootcache.c
  61. 1 1
      sys/src/9/ip/ethermedium.c
  62. 3 3
      sys/src/9/ip/ipifc.c
  63. 6 6
      sys/src/9/ip/iproute.c
  64. 3 3
      sys/src/9/ip/netlog.c
  65. 3 3
      sys/src/9/ip/tcp.c
  66. 11 11
      sys/src/9/port/devbridge.c
  67. 3 3
      sys/src/9/port/devcap.c
  68. 14 14
      sys/src/9/port/devcec.c
  69. 31 32
      sys/src/9/port/devcons.c
  70. 2 2
      sys/src/9/port/devcoreboot.c
  71. 4 4
      sys/src/9/port/devdraw.c
  72. 4 4
      sys/src/9/port/devfdmux.c
  73. 2 2
      sys/src/9/port/devkbin.c
  74. 2 2
      sys/src/9/port/devkbmap.c
  75. 4 4
      sys/src/9/port/devkprof.c
  76. 12 11
      sys/src/9/port/devmouse.c
  77. 2 2
      sys/src/9/port/devpci.c
  78. 3 3
      sys/src/9/port/devpipe.c
  79. 3 3
      sys/src/9/port/devprobe.c
  80. 61 61
      sys/src/9/port/devproc.c
  81. 1 1
      sys/src/9/port/devramfs.c
  82. 5 5
      sys/src/9/port/devregress.c
  83. 3 3
      sys/src/9/port/devroot.c
  84. 8 8
      sys/src/9/port/devsd.c
  85. 3 5
      sys/src/9/port/devtrace.c
  86. 1 1
      sys/src/9/port/devuart.c
  87. 2 2
      sys/src/9/port/devvcon.c
  88. 3 3
      sys/src/9/port/devwd.c
  89. 3 3
      sys/src/9/port/devws.c
  90. 3 3
      sys/src/9/port/devzp.c
  91. 2 2
      sys/src/9/port/edf.c
  92. 3 2
      sys/src/9/port/latin1.c
  93. 100 100
      sys/src/9/port/latin1.h
  94. 0 1
      sys/src/9/port/lib.h
  95. 3 3
      sys/src/9/port/pgrp.c
  96. 5 5
      sys/src/9/port/portclock.c
  97. 1 1
      sys/src/9/port/ps.c
  98. 1 1
      sys/src/9/port/qio.c
  99. 1 1
      sys/src/9/port/rmap.c
  100. 2 2
      sys/src/9/port/segment.c

+ 2 - 1
aarch64/include/cflags.json

@@ -9,7 +9,8 @@
 			"-ggdb",
 			"-ggdb",
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
-			"-Wall"
+			"-Wall",
+			"-Werror"
 		]
 		]
 	}
 	}
 }
 }

+ 1 - 0
aarch64/include/klib.json

@@ -5,6 +5,7 @@
 			"-ffreestanding",
 			"-ffreestanding",
 			"-fno-builtin",
 			"-fno-builtin",
 			"-Wall",
 			"-Wall",
+			"-Werror",
 			"-g"
 			"-g"
 		],
 		],
 		"Oflags": [
 		"Oflags": [

+ 2 - 0
aarch64/include/u.h

@@ -51,3 +51,5 @@ typedef __builtin_va_list va_list;
 #define va_end(v)       __builtin_va_end(v)
 #define va_end(v)       __builtin_va_end(v)
 #define va_arg(v,l)     __builtin_va_arg(v,l)
 #define va_arg(v,l)     __builtin_va_arg(v,l)
 #define va_copy(v,l)    __builtin_va_copy(v,l)
 #define va_copy(v,l)    __builtin_va_copy(v,l)
+
+#define getcallerpc()	((uintptr_t)__builtin_return_address(0))

+ 1 - 1
acme/bin/source/acd/main.c

@@ -112,7 +112,7 @@ threadmain(int argc, char **argv)
 	d = malloc(sizeof(*d));
 	d = malloc(sizeof(*d));
 	if(d == nil)
 	if(d == nil)
 		error("out of memory");
 		error("out of memory");
-	memset(d, 0, sizeof d);
+	memset(d, 0, sizeof *d);
 
 
 	d->scsi = s;
 	d->scsi = s;
 	d->w = newwindow();
 	d->w = newwindow();

+ 2 - 2
acme/bin/source/adict/adict.c

@@ -349,7 +349,7 @@ vopenwin(void *v)
 	name = arg[0];
 	name = arg[0];
 	buttons = arg[1];
 	buttons = arg[1];
 	twin = arg[2];
 	twin = arg[2];
-	wintype = (int)((intptr_t)arg[3]);
+	wintype = (int)((uintptr_t)arg[3]);
 	sendul(arg[4], 0);
 	sendul(arg[4], 0);
 
 
 	openwin(name, buttons, twin, wintype);
 	openwin(name, buttons, twin, wintype);
@@ -366,7 +366,7 @@ procopenwin(char *name, char *buttons, Win *twin, int wintype)
 	arg[0] = name;
 	arg[0] = name;
 	arg[1] = buttons;
 	arg[1] = buttons;
 	arg[2] = twin;
 	arg[2] = twin;
-	arg[3] = (void*)((intptr_t)wintype);
+	arg[3] = (void*)((uintptr_t)wintype);
 	arg[4] = c;
 	arg[4] = c;
 	proccreate(vopenwin, arg, STACK);
 	proccreate(vopenwin, arg, STACK);
 	recvul(c);
 	recvul(c);

+ 2 - 0
amd64/clang-3.7.BUILD

@@ -1,3 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
+  "-Wall",
+  "-Werror",
   "-mno-implicit-float",
   "-mno-implicit-float",
 ]
 ]

+ 2 - 0
amd64/clang-3.8.BUILD

@@ -1,3 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
+  "-Wall",
+  "-Werror",
   "-mno-implicit-float",
   "-mno-implicit-float",
 ]
 ]

+ 2 - 0
amd64/clang-3.9.BUILD

@@ -1,3 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
+  "-Wall",
+  "-Werror",
   "-mno-implicit-float",
   "-mno-implicit-float",
 ]
 ]

+ 2 - 0
amd64/clang.BUILD

@@ -1,3 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
+  "-Wall",
+  "-Werror",
   "-mno-implicit-float",
   "-mno-implicit-float",
 ]
 ]

+ 2 - 1
amd64/gcc-4.8.BUILD

@@ -1,5 +1,6 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
-  "-Wno-frame-address",
+  "-Wall",
+  "-Werror",
   "-fno-pie",
   "-fno-pie",
   "-fvar-tracking",
   "-fvar-tracking",
   "-fvar-tracking-assignments"
   "-fvar-tracking-assignments"

+ 2 - 1
amd64/gcc-5.BUILD

@@ -1,4 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
-  "-Wno-frame-address",
+  "-Wall",
+  "-Werror",
   "-fno-pie",
   "-fno-pie",
 ]
 ]

+ 2 - 1
amd64/gcc-6.BUILD

@@ -1,4 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
-  "-Wno-frame-address",
+  "-Wall",
+  "-Werror",
   "-fno-pie",
   "-fno-pie",
 ]
 ]

+ 2 - 1
amd64/gcc.BUILD

@@ -1,6 +1,7 @@
 # Assumes gcc-4.8 is the default compiler for gcc.
 # Assumes gcc-4.8 is the default compiler for gcc.
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
-  "-Wno-frame-address",
+  "-Wall",
+  "-Werror",
   "-fvar-tracking",
   "-fvar-tracking",
   "-fvar-tracking-assignments"
   "-fvar-tracking-assignments"
 ]
 ]

+ 2 - 1
amd64/include/cflags.json

@@ -14,7 +14,8 @@
 			"-mno-red-zone",
 			"-mno-red-zone",
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
-			"-Wall"
+			"-Wall",
+			"-Werror"
 		]
 		]
 	}
 	}
 }
 }

+ 1 - 0
amd64/include/klib.json

@@ -10,6 +10,7 @@
 			"-ffreestanding",
 			"-ffreestanding",
 			"-fno-builtin",
 			"-fno-builtin",
 			"-Wall",
 			"-Wall",
+			"-Werror",
 			"-g"
 			"-g"
 		],
 		],
 		"Oflags": [
 		"Oflags": [

+ 1 - 0
amd64/include/u.h

@@ -96,3 +96,4 @@ typedef __builtin_va_list va_list;
 #define va_arg(v,l)	__builtin_va_arg(v,l)
 #define va_arg(v,l)	__builtin_va_arg(v,l)
 #define va_copy(v,l)	__builtin_va_copy(v,l)
 #define va_copy(v,l)	__builtin_va_copy(v,l)
 
 
+#define	getcallerpc()	((uintptr_t)__builtin_return_address(0))

+ 1 - 2
amd64/include/x86_64-elf-gcc.json

@@ -1,7 +1,6 @@
 {
 {
 	"buildflags": {
 	"buildflags": {
 		"Cflags": [
 		"Cflags": [
-				"-Wno-frame-address"
-			]
+		]
 	}
 	}
 }
 }

+ 1 - 2
amd64/include/x86_64-none-elf-gcc.json

@@ -1,7 +1,6 @@
 {
 {
 	"buildflags": {
 	"buildflags": {
 		"Cflags": [
 		"Cflags": [
-				"-Wno-frame-address"
-			]
+		]
 	}
 	}
 }
 }

+ 2 - 1
amd64/x86_64-elf-gcc.BUILD

@@ -1,4 +1,5 @@
 COMPILER_FLAGS=[
 COMPILER_FLAGS=[
-  "-Wno-frame-address",
+  "-Wall",
+  "-Werror",
   "-fno-pie",
   "-fno-pie",
 ]
 ]

+ 1 - 3
riscv/include/cflags.json

@@ -11,9 +11,7 @@
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
 			"-Wall",
 			"-Wall",
-			"-Wno-missing-braces",
-			"-Wno-parentheses",
-			"-Wno-unknown-pragmas"
+			"-Werror"
 		],
 		],
 		"Oflags": [
 		"Oflags": [
 			"-T","/$ARCH/include/prog.ld",
 			"-T","/$ARCH/include/prog.ld",

+ 1 - 4
riscv/include/klib.json

@@ -5,10 +5,7 @@
 			"-ffreestanding",
 			"-ffreestanding",
 			"-fno-builtin",
 			"-fno-builtin",
 			"-Wall",
 			"-Wall",
-			"-Wno-missing-braces",
-			"-Wno-parentheses",
-			"-Wno-unknown-pragmas",
-			"-Wuninitialized",
+			"-Werror",
 			"-g"
 			"-g"
 		],
 		],
 		"Oflags": [
 		"Oflags": [

+ 27 - 0
riscv/include/mach_acpi.h

@@ -0,0 +1,27 @@
+/* acpi.h */
+/* File for Harvey-specific ACPI defines. */
+
+/*
+ * ACPI redefines things found in libc, but this one thing we need.
+ */
+
+#define ACPI_USE_SYSTEM_INTTYPES
+typedef uint8_t BOOLEAN;
+typedef QLock ACPI_MUTEX;
+typedef uint64_t COMPILER_DEPENDENT_UINT64;
+typedef uint64_t UINT64;
+typedef uint32_t UINT32;
+typedef uint16_t UINT16;
+typedef uint8_t UINT8;
+typedef int64_t COMPILER_DEPENDENT_INT64;
+typedef int64_t INT64;
+typedef int32_t INT32;
+typedef int16_t INT16;
+typedef int8_t INT8;
+typedef int ACPI_THREAD_ID;
+
+#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
+#define ACPI_MACHINE_WIDTH 64
+#pragma clang diagnostic ignored "-Wunused-variable"
+
+#define ACPI_GET_FUNCTION_NAME __func__

+ 1 - 6
riscv/include/u.h

@@ -54,9 +54,4 @@ typedef __builtin_va_list va_list;
 #define va_arg(v,l)	__builtin_va_arg(v,l)
 #define va_arg(v,l)	__builtin_va_arg(v,l)
 #define va_copy(v,l)	__builtin_va_copy(v,l)
 #define va_copy(v,l)	__builtin_va_copy(v,l)
 
 
-static inline uintptr_t getcallerpc(void)
-{
-	uintptr_t x = 0;
-	__asm__ __volatile__("sd ra, -24(s0)\n");
-	return x;
-}
+#define getcallerpc()	((uintptr_t)__builtin_return_address(0))

+ 0 - 1
sys/include/libc.h

@@ -321,7 +321,6 @@ extern	int	enc16(char*, int, uint8_t*, int);
 extern	int	encodefmt(Fmt*);
 extern	int	encodefmt(Fmt*);
 extern	void	exits(char*);
 extern	void	exits(char*);
 extern	double	frexp(double, int*);
 extern	double	frexp(double, int*);
-extern	uintptr	getcallerpc(void);
 extern	void	getcallstack(uintptr *, size_t);
 extern	void	getcallstack(uintptr *, size_t);
 extern	char*	getenv(const char*);
 extern	char*	getenv(const char*);
 extern	int	getfields(char*, char**, int, int, const char*);
 extern	int	getfields(char*, char**, int, int, const char*);

+ 1 - 5
sys/man/2/getcallerpc

@@ -31,8 +31,4 @@ main(int argc, char *argv[])
 }
 }
 .EE
 .EE
 .SH SOURCE
 .SH SOURCE
-.B /sys/src/libc/$objtype/getcallerpc.[cs]
-.SH BUGS
-The 
-.I firstarg
-parameter should not be necessary.
+.B /$arch/include/u.h

+ 3 - 3
sys/src/9/386/devrtc.c

@@ -55,9 +55,9 @@ enum{
 };
 };
 
 
 Dirtab rtcdir[]={
 Dirtab rtcdir[]={
-	".",	{Qdir, 0, QTDIR},	0,	0555,
-	"nvram",	{Qnvram, 0},	Nvsize,	0664,
-	"rtc",		{Qrtc, 0},	0,	0664,
+	{".",	{Qdir, 0, QTDIR},	0,	0555},
+	{"nvram",	{Qnvram, 0},	Nvsize,	0664},
+	{"rtc",		{Qrtc, 0},	0,	0664},
 };
 };
 
 
 static uint32_t rtc2sec(Rtc*);
 static uint32_t rtc2sec(Rtc*);

+ 5 - 5
sys/src/9/386/ether8169.c

@@ -500,8 +500,8 @@ ethercrcbe(unsigned char *addr, int32_t len)
 static uint32_t
 static uint32_t
 swabl(uint32_t l)
 swabl(uint32_t l)
 {
 {
-	return l>>24 | (l>>8) & (Bytemask<<8) |
-		(l<<8) & (Bytemask<<16) | l<<24;
+	return (l>>24) | ((l>>8)&(Bytemask<<8)) |
+		((l<<8)&(Bytemask<<16)) | (l<<24);
 }
 }
 
 
 static void
 static void
@@ -733,7 +733,7 @@ rtl8169init(Ether* edev)
 	ctlr->tdh = ctlr->tdt = ctlr->ntq = 0;
 	ctlr->tdh = ctlr->tdt = ctlr->ntq = 0;
 	ctlr->td[ctlr->ntd-1].control = Eor;
 	ctlr->td[ctlr->ntd-1].control = Eor;
 	for(i = 0; i < ctlr->ntd; i++)
 	for(i = 0; i < ctlr->ntd; i++)
-		if(bp = ctlr->tb[i]){
+		if((bp = ctlr->tb[i]) != nil){
 			ctlr->tb[i] = nil;
 			ctlr->tb[i] = nil;
 			freeb(bp);
 			freeb(bp);
 		}
 		}
@@ -746,7 +746,7 @@ rtl8169init(Ether* edev)
 	ctlr->nrdfree = ctlr->rdh = ctlr->rdt = 0;
 	ctlr->nrdfree = ctlr->rdh = ctlr->rdt = 0;
 	ctlr->rd[ctlr->nrd-1].control = Eor;
 	ctlr->rd[ctlr->nrd-1].control = Eor;
 	for(i = 0; i < ctlr->nrd; i++)
 	for(i = 0; i < ctlr->nrd; i++)
-		if(bp = ctlr->rb[i]){
+		if((bp = ctlr->rb[i]) != nil){
 			ctlr->rb[i] = nil;
 			ctlr->rb[i] = nil;
 			freeb(bp);
 			freeb(bp);
 		}
 		}
@@ -1194,7 +1194,7 @@ rtl8169pci(void)
 	uint macv;
 	uint macv;
 
 
 	p = nil;
 	p = nil;
-	while(p = pcimatch(p, 0, 0)){
+	while((p = pcimatch(p, 0, 0)) != nil){
 		if(p->ccrb != 0x02 || p->ccru != 0)
 		if(p->ccrb != 0x02 || p->ccru != 0)
 			continue;
 			continue;
 
 

+ 4 - 4
sys/src/9/386/ether82557.c

@@ -337,7 +337,7 @@ rfdalloc(uint32_t link)
 	Block *bp;
 	Block *bp;
 	Rfd *rfd;
 	Rfd *rfd;
 
 
-	if(bp = iallocb(sizeof(Rfd))){
+	if((bp = iallocb(sizeof(Rfd))) != nil){
 		rfd = (Rfd*)bp->rp;
 		rfd = (Rfd*)bp->rp;
 		rfd->field = 0;
 		rfd->field = 0;
 		rfd->link = link;
 		rfd->link = link;
@@ -656,7 +656,7 @@ receive(Ether* ether)
 				rfd->count = 0;
 				rfd->count = 0;
 				rfd->field = 0;
 				rfd->field = 0;
 			}
 			}
-			else if(xbp = rfdalloc(rfd->link)){
+			else if((xbp = rfdalloc(rfd->link)) != nil){
 				bp->rp += offsetof(Rfd, data[0]);
 				bp->rp += offsetof(Rfd, data[0]);
 				bp->wp = bp->rp + count;
 				bp->wp = bp->rp + count;
 
 
@@ -938,9 +938,9 @@ i82557pci(void)
 	Ctlr *ctlr;
 	Ctlr *ctlr;
 	int i, nop, port;
 	int i, nop, port;
 
 
-	p = nil;
 	nop = 0;
 	nop = 0;
-	while(p = pcimatch(p, 0x8086, 0)){
+	p = nil;
+	while((p = pcimatch(p, 0x8086, 0)) != nil){
 		switch(p->did){
 		switch(p->did){
 		default:
 		default:
 			continue;
 			continue;

+ 2 - 2
sys/src/9/386/etherigbe.c

@@ -701,7 +701,7 @@ enum {
 };
 };
 
 
 static Cmdtab igbectlmsg[] = {
 static Cmdtab igbectlmsg[] = {
-	CMrdtr,	"rdtr",	2,
+	{CMrdtr,	"rdtr",		2},
 };
 };
 
 
 static int32_t
 static int32_t
@@ -1968,7 +1968,7 @@ igbepci(void)
 	void *mem;
 	void *mem;
 
 
 	p = nil;
 	p = nil;
-	while(p = pcimatch(p, 0, 0)){
+	while((p = pcimatch(p, 0, 0)) != nil){
 		if(p->ccrb != 0x02 || p->ccru != 0)
 		if(p->ccrb != 0x02 || p->ccru != 0)
 			continue;
 			continue;
 
 

+ 16 - 16
sys/src/9/386/etherm10g.c

@@ -32,7 +32,7 @@
 #define MiB		1048576u		/* Mebi 0x0000000000100000 */
 #define MiB		1048576u		/* Mebi 0x0000000000100000 */
 #endif /* KiB */
 #endif /* KiB */
 
 
-#define	dprint(...)	if(debug) print(__VA_ARGS__)
+#define	dprint(...)	do{if(debug)print(__VA_ARGS__);}while(0)
 #define	pcicapdbg(...)
 #define	pcicapdbg(...)
 #define malign(n)	mallocalign((n), 4*KiB, 0, 0)
 #define malign(n)	mallocalign((n), 4*KiB, 0, 0)
 
 
@@ -1118,7 +1118,7 @@ m10rx(void *v)
 		replenish(&c->sm);
 		replenish(&c->sm);
 		replenish(&c->bg);
 		replenish(&c->bg);
 		sleep(&c->rxrendez, rxcansleep, c);
 		sleep(&c->rxrendez, rxcansleep, c);
-		while(b = nextblock(c))
+		while((b = nextblock(c)) != nil)
 			etheriq(e, b, 1);
 			etheriq(e, b, 1);
 	}
 	}
 }
 }
@@ -1139,7 +1139,7 @@ txcleanup(Tx *tx, uint32_t n)
 	 */
 	 */
 	for(;; tx->cnt++){
 	for(;; tx->cnt++){
 		j = tx->cnt & tx->m;
 		j = tx->cnt & tx->m;
-		if(b = tx->bring[j]){
+		if((b = tx->bring[j]) != nil){
 			tx->bring[j] = 0;
 			tx->bring[j] = 0;
 			tx->nbytes += BLEN(b);
 			tx->nbytes += BLEN(b);
 			freeb(b);
 			freeb(b);
@@ -1193,7 +1193,7 @@ submittx(Tx *tx, int n)
 	l = tx->lanai;
 	l = tx->lanai;
 	h = tx->host;
 	h = tx->host;
 	for(i = n-1; i >= 0; i--)
 	for(i = n-1; i >= 0; i--)
-		memmove(l+(i + i0 & m), h+(i + i0 & m), sizeof *h);
+		memmove(l+((i + i0) & m), h+((i + i0) & m), sizeof *h);
 	tx->i += n;
 	tx->i += n;
 //	coherence();
 //	coherence();
 }
 }
@@ -1207,7 +1207,7 @@ nsegments(Block *b, int segsz)
 	bus = PCIWADDR(b->rp);
 	bus = PCIWADDR(b->rp);
 	i = 0;
 	i = 0;
 	for(len = BLEN(b); len; len -= slen){
 	for(len = BLEN(b); len; len -= slen){
-		end = bus + segsz & ~(segsz-1);
+		end = (bus + segsz) & ~(segsz-1);
 		slen = end - bus;
 		slen = end - bus;
 		if(slen > len)
 		if(slen > len)
 			slen = len;
 			slen = len;
@@ -1248,7 +1248,7 @@ m10gtransmit(Ether *e)
 		rdma = nseg = nsegments(b, segsz);
 		rdma = nseg = nsegments(b, segsz);
 		bus = PCIWADDR(b->rp);
 		bus = PCIWADDR(b->rp);
 		for(; len; len -= slen){
 		for(; len; len -= slen){
-			end = bus + segsz & ~(segsz-1);
+			end = (bus + segsz) & ~(segsz-1);
 			slen = end - bus;
 			slen = end - bus;
 			if(slen > len)
 			if(slen > len)
 				slen = len;
 				slen = len;
@@ -1264,7 +1264,7 @@ m10gtransmit(Ether *e)
 			flags &= ~SFfirst;
 			flags &= ~SFfirst;
 			rdma = 1;
 			rdma = 1;
 		}
 		}
-		tx->bring[i + nseg - 1 & tx->m] = b;
+		tx->bring[(i + nseg - 1) & tx->m] = b;
 		if(1 || count > 0){
 		if(1 || count > 0){
 			submittx(tx, count);
 			submittx(tx, count);
 			count = 0;
 			count = 0;
@@ -1287,7 +1287,7 @@ checkstats(Ether *e, Ctlr *c, Stats *s)
 	i = gbit32(s->linkstat);
 	i = gbit32(s->linkstat);
 	if(c->linkstat != i){
 	if(c->linkstat != i){
 		e->Netif.link = i;
 		e->Netif.link = i;
-		if(c->linkstat = i)
+		if((c->linkstat = i) != 0)
 			dprint("m10g: link up\n");
 			dprint("m10g: link up\n");
 		else
 		else
 			dprint("m10g: link down\n");
 			dprint("m10g: link down\n");
@@ -1493,12 +1493,12 @@ enum {
 };
 };
 
 
 static Cmdtab ctab[] = {
 static Cmdtab ctab[] = {
-	CMdebug,	"debug",	2,
-	CMcoal,		"coal",		2,
-	CMwakeup,	"wakeup",	1,
-	CMtxwakeup,	"txwakeup",	1,
-//	CMqsummary,	"q",		1,
-	CMrxring,	"rxring",	1,
+	{CMdebug,	"debug",	2},
+	{CMcoal,	"coal",		2},
+	{CMwakeup,	"wakeup",	1},
+	{CMtxwakeup,	"txwakeup",	1},
+//	{CMqsummary,	"q",		1},
+	{CMrxring,	"rxring",	1},
 };
 };
 
 
 static int32_t
 static int32_t
@@ -1592,8 +1592,8 @@ m10gpci(void)
 	Pcidev *p;
 	Pcidev *p;
 	Ctlr *t, *c;
 	Ctlr *t, *c;
 
 
-	t = 0;
-	for(p = 0; p = pcimatch(p, 0x14c1, 0x0008); ){
+	t = nil;
+	for(p = nil; (p = pcimatch(p, 0x14c1, 0x0008)) != nil;){
 		c = malloc(sizeof *c);
 		c = malloc(sizeof *c);
 		if(c == nil)
 		if(c == nil)
 			continue;
 			continue;

+ 5 - 5
sys/src/9/386/pci.c

@@ -350,7 +350,7 @@ pcireservemem(void)
 	int i;
 	int i;
 	Pcidev *p;
 	Pcidev *p;
 
 
-	for(p = nil; p = pcimatch(p, 0, 0); )
+	for(p = nil; (p = pcimatch(p, 0, 0)) != nil;)
 		for(i=0; i<nelem(p->mem); i++)
 		for(i=0; i<nelem(p->mem); i++)
 			if(p->mem[i].bar && (p->mem[i].bar&1) == 0)
 			if(p->mem[i].bar && (p->mem[i].bar&1) == 0)
 				asmmapinit(p->mem[i].bar&~0x0F, p->mem[i].size, 5);
 				asmmapinit(p->mem[i].bar&~0x0F, p->mem[i].size, 5);
@@ -436,8 +436,8 @@ pcicfgrw(int tbdf, int r, int data, int rw, int w)
 		return -1;
 		return -1;
 
 
 	lock(&pcicfglock);
 	lock(&pcicfglock);
-	o = r & 4-w;
-	er = r&0xfc | (r & 0xf00)<<16;
+	o = r & (4-w);
+	er = (r&0xfc) | ((r & 0xf00)<<16);
 	outl(PciADDR, 0x80000000|BUSBDF(tbdf)|er);
 	outl(PciADDR, 0x80000000|BUSBDF(tbdf)|er);
 	if(rw == Read){
 	if(rw == Read){
 		x = -1;
 		x = -1;
@@ -526,7 +526,7 @@ pcimatchtbdf(int tbdf)
 {
 {
 	Pcidev *p;
 	Pcidev *p;
 
 
-	for(p = nil; p = pcimatch(p, 0, 0); )
+	for(p = nil; (p = pcimatch(p, 0, 0)) != nil; )
 		if(p->tbdf == tbdf)
 		if(p->tbdf == tbdf)
 			break;
 			break;
 	return p;
 	return p;
@@ -586,7 +586,7 @@ pcireset(void)
 {
 {
 	Pcidev *p;
 	Pcidev *p;
 
 
-	for(p = nil; p = pcimatch(p, 0, 0); )
+	for(p = nil; (p = pcimatch(p, 0, 0)) != nil;)
 		/* don't mess with the bridges */
 		/* don't mess with the bridges */
 		if(p->ccrb != 0x06)
 		if(p->ccrb != 0x06)
 			pciclrbme(p);
 			pciclrbme(p);

+ 2 - 1
sys/src/9/386/vgavesa.c

@@ -178,11 +178,12 @@ vesalinear(VGAscr *scr, int _1, int _2)
 	}
 	}
 
 
 	/* no pci - heuristic guess */
 	/* no pci - heuristic guess */
-	if (!havesize)
+	if(!havesize){
 		if(size < 4*1024*1024)
 		if(size < 4*1024*1024)
 			size = 4*1024*1024;
 			size = 4*1024*1024;
 		else
 		else
 			size = ROUND(size, 1024*1024);
 			size = ROUND(size, 1024*1024);
+	}
 	if(size > 16*1024*1024)		/* arbitrary */
 	if(size > 16*1024*1024)		/* arbitrary */
 		size = 16*1024*1024;
 		size = 16*1024*1024;
 
 

+ 0 - 1
sys/src/9/aarch64/core.json

@@ -8,7 +8,6 @@
 			"-DKERNDATE=1433623937",
 			"-DKERNDATE=1433623937",
 			"-g",
 			"-g",
 			"-Wall",
 			"-Wall",
-			"-W",
 			"-Werror",
 			"-Werror",
 			"-I", "/sys/src/9/aarch64",
 			"-I", "/sys/src/9/aarch64",
 			"-I", "/sys/src/9/port"
 			"-I", "/sys/src/9/port"

+ 1 - 0
sys/src/9/aarch64/inith.json

@@ -3,6 +3,7 @@
 		"Cflags": [
 		"Cflags": [
 			"-g",
 			"-g",
 			"-Wall",
 			"-Wall",
+			"-Werror",
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
 			"-ffreestanding",
 			"-ffreestanding",

+ 1 - 11
sys/src/9/amd64/BUILD

@@ -255,14 +255,6 @@ STD_COMPILER_OPTIONS = [
 	"-g",
 	"-g",
 	"-Wall",
 	"-Wall",
 	"-Werror",
 	"-Werror",
-	"-W",
-	"-Wno-sign-compare",
-	"-Wno-missing-field-initializers",
-	"-Wno-unused-parameter",
-	"-Wno-unused-function",
-	"-Wno-missing-braces",
-	"-Wno-parentheses",
-	"-Wno-unknown-pragmas",
 	"-D__HARVEY__",
 	"-D__HARVEY__",
 	"-U_LINUX",
 	"-U_LINUX",
 	"-U__linux__",
 	"-U__linux__",
@@ -423,9 +415,7 @@ cc_binary(
 		"-c",
 		"-c",
 		"-g",
 		"-g",
 		"-Wall",
 		"-Wall",
-		"-Wno-missing-braces",
-		"-Wno-parentheses",
-		"-Wno-unknown-pragmas",
+		"-Werror",
 		"-O0",
 		"-O0",
 		"-static",
 		"-static",
 		"-mno-red-zone",
 		"-mno-red-zone",

+ 0 - 11
sys/src/9/amd64/core.json

@@ -14,23 +14,12 @@
 			"-g",
 			"-g",
 			"-Wall",
 			"-Wall",
 			"-Werror",
 			"-Werror",
-			"-W",
-			"-Wno-sign-compare",
-			"-Wno-missing-field-initializers",
-			"-Wno-unused-parameter",
-			"-Wno-unused-function",
-			"-Wno-missing-braces",
-			"-Wno-parentheses",
-			"-Wno-unknown-pragmas",
 			"-D__HARVEY__",
 			"-D__HARVEY__",
 			"-U_LINUX", "-U__linux__",
 			"-U_LINUX", "-U__linux__",
 			"-I", "/sys/src/9/amd64",
 			"-I", "/sys/src/9/amd64",
 			"-I", "/sys/src/9/port",
 			"-I", "/sys/src/9/port",
 			"-I", "/sys/src/libc/9syscall"
 			"-I", "/sys/src/libc/9syscall"
 		],
 		],
-	    "NoCFlags": [
-			"-Werror"
-		],
 		"Libs": [
 		"Libs": [
 			"/$ARCH/lib/klibmemlayer.a",
 			"/$ARCH/lib/klibmemlayer.a",
 			"/$ARCH/lib/klibmemdraw.a",
 			"/$ARCH/lib/klibmemdraw.a",

+ 1 - 1
sys/src/9/amd64/dat.h

@@ -480,7 +480,7 @@ extern char*rolename[];
 #define DBGFLG		(0)
 #define DBGFLG		(0)
 #endif /* _DBGC_ */
 #endif /* _DBGC_ */
 
 
-#define DBG(...)	if(!DBGFLG){}else dbgprint(__VA_ARGS__)
+#define DBG(...)	do{if(DBGFLG)dbgprint(__VA_ARGS__);}while(0)
 
 
 extern char dbgflg[256];
 extern char dbgflg[256];
 
 

+ 19 - 1
sys/src/9/amd64/devacpi.c

@@ -67,7 +67,7 @@ static int32_t acpiintrread(Chan *c, void *a, int32_t n, int64_t off);
 
 
 static void acpiintr(Ureg *, void *);
 static void acpiintr(Ureg *, void *);
 
 
-static char * devname(void)
+static char *devname(void)
 {
 {
 	return acpidevtab.name;
 	return acpidevtab.name;
 }
 }
@@ -77,6 +77,8 @@ static int devdc(void)
 	return acpidevtab.dc;
 	return acpidevtab.dc;
 }
 }
 
 
+void outofyourelement(void);
+
 #if 0
 #if 0
 /*
 /*
  * ACPI 4.0 Support.
  * ACPI 4.0 Support.
@@ -1945,6 +1947,8 @@ static void acpiinitonce(void)
 	acpiioalloc(fadt->gpe1blk, fadt->gpe1blklen);
 	acpiioalloc(fadt->gpe1blk, fadt->gpe1blklen);
 
 
 	initgpes();
 	initgpes();
+
+	outofyourelement();
 }
 }
 
 
 static int acpienable(void)
 static int acpienable(void)
@@ -2406,6 +2410,20 @@ static char *raw(Atable *atbl, char *start, char *end, void *unused_arg)
 	return start + len;
 	return start + len;
 }
 }
 
 
+void outofyourelement(void)
+{
+	/*
+	 * These just shut the compiler up.
+	 */
+	if(0)pretty(nil, nil, nil, nil);
+	if(0)raw(nil, nil, nil, nil);
+	if(0)dumpxsdt();
+	if(0)dumptable(nil, nil, nil, nil, 0);
+	if(0)cmpslitent(nil, nil);
+	if(0)regio(nil, nil, 0, 0, 0);
+	if(0)acpiregid(nil);
+}
+
 Dev acpidevtab = {
 Dev acpidevtab = {
 	//.dc = L'α',
 	//.dc = L'α',
 	.dc = 'Z',
 	.dc = 'Z',

+ 9 - 9
sys/src/9/amd64/devarch.c

@@ -54,13 +54,13 @@ static Rdwrfn *readfn[Qmax];
 static Rdwrfn *writefn[Qmax];
 static Rdwrfn *writefn[Qmax];
 
 
 static Dirtab archdir[Qmax] = {
 static Dirtab archdir[Qmax] = {
-	".",		{ Qdir, 0, QTDIR },	0,	0555,
-	"ioalloc",	{ Qioalloc, 0 },	0,	0444,
+	{".",		{ Qdir, 0, QTDIR },	0,	0555},
+	{"ioalloc",	{ Qioalloc, 0 },	0,	0444},
 	/* NOTE: kludge until we have real permissions. */
 	/* NOTE: kludge until we have real permissions. */
-	"iob",		{ Qiob, 0 },		0,	0660 | 6,
-	"iow",		{ Qiow, 0 },		0,	0660 | 6,
-	"iol",		{ Qiol, 0 },		0,	0660 | 6,
-	"mapram",	{ Qmapram, 0 },	0,	0444,
+	{"iob",		{ Qiob, 0 },		0,	0660 | 6},
+	{"iow",		{ Qiow, 0 },		0,	0660 | 6},
+	{"iol",		{ Qiol, 0 },		0,	0660 | 6},
+	{"mapram",	{ Qmapram, 0 },	0,	0444},
 };
 };
 Lock archwlock;	/* the lock is only for changing archdir */
 Lock archwlock;	/* the lock is only for changing archdir */
 int narchdir = Qbase;
 int narchdir = Qbase;
@@ -293,9 +293,9 @@ iounused(int start, int end)
 {
 {
 	IOMap *map;
 	IOMap *map;
 
 
-	for(map = iomap.map; map; map = map->next){
-		if(start >= map->start && start < map->end
-		|| start <= map->start && end > map->start)
+	for(map = iomap.map; map != nil; map = map->next){
+		if((start >= map->start && start < map->end)
+		|| (start <= map->start && end > map->start))
 			return 0;
 			return 0;
 	}
 	}
 	return 1;
 	return 1;

+ 5 - 5
sys/src/9/amd64/deviig.c

@@ -30,8 +30,8 @@ enum {
 };
 };
 
 
 static Dirtab iigdir[] = {
 static Dirtab iigdir[] = {
-	".",	{ Qdir, 0, QTDIR },		0,	0550,
-	"iigctl",		{ Qiigctl, 0 },		0,	0660,
+	{".",		{ Qdir, 0, QTDIR },	0,	0550},
+	{"iigctl",	{ Qiigctl, 0 },		0,	0660},
 };
 };
 
 
 enum {
 enum {
@@ -41,9 +41,9 @@ enum {
 };
 };
 
 
 static Cmdtab iigctlmsg[] = {
 static Cmdtab iigctlmsg[] = {
-	CMsize,		"size",		1,
-	CMblank,  "blank", 1,
-	CMunblank,  "unblank", 1,
+	{CMsize,	"size",		1},
+	{CMblank,	"blank",	1},
+	{CMunblank,	"unblank",	1},
 };
 };
 typedef struct Iig Iig;
 typedef struct Iig Iig;
 
 

+ 8 - 8
sys/src/9/amd64/devpmc.c

@@ -277,14 +277,14 @@ enum{
 
 
 static Cmdtab pmcctlmsg[] =
 static Cmdtab pmcctlmsg[] =
 {
 {
-	Enable,		"enable",	0,
-	Disable,	"disable",	0,
-	User,		"user",		0,
-	Os,		"os",		0,
-	NoUser,		"nouser",		0,
-	NoOs,		"noos",		0,
-	Reset,		"reset",	0,
-	Debug, 		"debug",	0,
+	{Enable,	"enable",	0},
+	{Disable,	"disable",	0},
+	{User,		"user",		0},
+	{Os,		"os",		0},
+	{NoUser,	"nouser",	0},
+	{NoOs,		"noos",		0},
+	{Reset,		"reset",	0},
+	{Debug, 	"debug",	0},
 };
 };
 
 
 typedef void (*APfunc)(void);
 typedef void (*APfunc)(void);

+ 1 - 1
sys/src/9/amd64/devusb.c

@@ -146,7 +146,7 @@ static Cmdtab epctls[] =
 
 
 static Dirtab usbdir[] =
 static Dirtab usbdir[] =
 {
 {
-	"ctl",		{Qctl},		0,	0666,
+	{"ctl",		{Qctl},		0,	0666},
 };
 };
 
 
 char *usbmodename[] =
 char *usbmodename[] =

+ 19 - 19
sys/src/9/amd64/devvga.c

@@ -33,11 +33,11 @@ enum {
 };
 };
 
 
 static Dirtab vgadir[] = {
 static Dirtab vgadir[] = {
-	".",	{ Qdir, 0, QTDIR },		0,	0550,
-	"vgabios",	{ Qvgabios, 0 },	0x100000, 0440,
-	"vgactl",		{ Qvgactl, 0 },		0,	0660,
-	"vgaovl",		{ Qvgaovl, 0 },		0,	0660,
-	"vgaovlctl",	{ Qvgaovlctl, 0 },	0, 	0660,
+	{".",	{ Qdir, 0, QTDIR },		0,	0550},
+	{"vgabios",	{ Qvgabios, 0 },	0x100000, 0440},
+	{"vgactl",		{ Qvgactl, 0 },		0,	0660},
+	{"vgaovl",		{ Qvgaovl, 0 },		0,	0660},
+	{"vgaovlctl",	{ Qvgaovlctl, 0 },	0, 	0660},
 };
 };
 
 
 enum {
 enum {
@@ -58,20 +58,20 @@ enum {
 };
 };
 
 
 static Cmdtab vgactlmsg[] = {
 static Cmdtab vgactlmsg[] = {
-	CMactualsize,	"actualsize",	2,
-	CMblank,	"blank",	1,
-	CMblanktime,	"blanktime",	2,
-	CMdrawinit,	"drawinit",	1,
-	CMhwaccel,	"hwaccel",	2,
-	CMhwblank,	"hwblank",	2,
-	CMhwgc,		"hwgc",		2,
-	CMlinear,	"linear",	0,
-	CMpalettedepth,	"palettedepth",	2,
-	CMpanning,	"panning",	2,
-	CMsize,		"size",		3,
-	CMtextmode,	"textmode",	1,
-	CMtype,		"type",		2,
-	CMunblank,	"unblank",	1,
+	{CMactualsize,		"actualsize",	2},
+	{CMblank,		"blank",	1},
+	{CMblanktime,		"blanktime",	2},
+	{CMdrawinit,		"drawinit",	1},
+	{CMhwaccel,		"hwaccel",	2},
+	{CMhwblank,		"hwblank",	2},
+	{CMhwgc,		"hwgc",		2},
+	{CMlinear,		"linear",	0},
+	{CMpalettedepth,	"palettedepth",	2},
+	{CMpanning,		"panning",	2},
+	{CMsize,		"size",		3},
+	{CMtextmode,		"textmode",	1},
+	{CMtype,		"type",		2},
+	{CMunblank,		"unblank",	1},
 };
 };
 
 
 static long
 static long

+ 3 - 3
sys/src/9/amd64/ether8139.c

@@ -277,8 +277,8 @@ ethercrcbe(unsigned char *addr, int32_t len)
 static uint32_t
 static uint32_t
 swabl(uint32_t l)
 swabl(uint32_t l)
 {
 {
-	return l>>24 | (l>>8) & (Bytemask<<8) |
-		(l<<8) & (Bytemask<<16) | l<<24;
+	return (l>>24) | ((l>>8) & (Bytemask<<8)) |
+		((l<<8) & (Bytemask<<16)) | (l<<24);
 }
 }
 
 
 static void
 static void
@@ -801,7 +801,7 @@ rtl8139pnp(Ether* edev)
 	 */
 	 */
 	if(ctlrhead == nil){
 	if(ctlrhead == nil){
 		p = nil;
 		p = nil;
-		while(p = pcimatch(p, 0, 0)){
+		while((p = pcimatch(p, 0, 0)) != nil){
 			if(p->ccrb != 0x02 || p->ccru != 0)
 			if(p->ccrb != 0x02 || p->ccru != 0)
 				continue;
 				continue;
 			ctlr = malloc(sizeof(Ctlr));
 			ctlr = malloc(sizeof(Ctlr));

+ 1 - 1
sys/src/9/amd64/ether82563.c

@@ -1861,7 +1861,7 @@ i82563pci(void)
 	Ctlr *ctlr;
 	Ctlr *ctlr;
 
 
 	p = nil;
 	p = nil;
-	while(p = pcimatch(p, 0x8086, 0)){
+	while((p = pcimatch(p, 0x8086, 0)) != nil){
 		switch(p->did){
 		switch(p->did){
 		default:
 		default:
 			continue;
 			continue;

+ 4 - 0
sys/src/9/amd64/fns.h

@@ -297,12 +297,16 @@ static inline void __clobber_callee_regs(void)
 
 
 int slim_setlabel(Label*) __attribute__((returns_twice));
 int slim_setlabel(Label*) __attribute__((returns_twice));
 
 
+#ifndef __clang__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
 
 
 #define setlabel(label) ({int err;                                                 \
 #define setlabel(label) ({int err;                                                 \
                     __clobber_callee_regs();                               \
                     __clobber_callee_regs();                               \
                     err = slim_setlabel(label);                                     \
                     err = slim_setlabel(label);                                     \
                     err;})
                     err;})
 
 
+#ifndef __clang__
 #pragma GCC diagnostic pop
 #pragma GCC diagnostic pop
+#endif

+ 1 - 3
sys/src/9/amd64/inith.json

@@ -3,9 +3,7 @@
 		"Cflags": [
 		"Cflags": [
 			"-g",
 			"-g",
 			"-Wall",
 			"-Wall",
-			"-Wno-missing-braces",
-			"-Wno-parentheses",
-			"-Wno-unknown-pragmas",
+			"-Werror",
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
 			"-mno-red-zone",
 			"-mno-red-zone",

+ 1 - 1
sys/src/9/amd64/ioapic.c

@@ -419,7 +419,7 @@ irqenable(void)
 			rtblget(apic, i, &hi, &lo);
 			rtblget(apic, i, &hi, &lo);
 			/* if something is set in the vector, enable the
 			/* if something is set in the vector, enable the
 			 * rdtentry */
 			 * rdtentry */
-			if (lo&0xff != 0)
+			if ((lo&0xff) != 0)
 				rtblput(apic, i, hi, lo & ~Im);
 				rtblput(apic, i, hi, lo & ~Im);
 			unlock(&apic->Ioapic.l);
 			unlock(&apic->Ioapic.l);
 		}
 		}

+ 1 - 1
sys/src/9/amd64/main.c

@@ -143,7 +143,7 @@ options(int argc, char* argv[])
 	while(--argc > 0){
 	while(--argc > 0){
 		char* next = *++argv;
 		char* next = *++argv;
 		if(next[0] =='-' && next[1] != '-'){
 		if(next[0] =='-' && next[1] != '-'){
-			while(o = *++argv[0]){
+			while((o = *++argv[0]) != '\0'){
 				if(!(o >= 'A' && o <= 'Z') && !(o >= 'a' && o <= 'z'))
 				if(!(o >= 'A' && o <= 'Z') && !(o >= 'a' && o <= 'z'))
 					continue;
 					continue;
 				n = strtol(argv[0]+1, &p, 0);
 				n = strtol(argv[0]+1, &p, 0);

+ 9 - 9
sys/src/9/amd64/mouse.c

@@ -56,15 +56,15 @@ enum
 
 
 static Cmdtab mousectlmsg[] =
 static Cmdtab mousectlmsg[] =
 {
 {
-	CMaccelerated,		"accelerated",		0,
-	CMhwaccel,		"hwaccel",		2,
-	CMintellimouse,		"intellimouse",		1,
-	CMlinear,		"linear",		1,
-	CMps2,			"ps2",			1,
-	CMps2intellimouse,	"ps2intellimouse",	1,
-	CMres,			"res",			0,
-	CMreset,		"reset",		1,
-	CMserial,		"serial",		0,
+	{CMaccelerated,		"accelerated",		0},
+	{CMhwaccel,		"hwaccel",		2},
+	{CMintellimouse,	"intellimouse",		1},
+	{CMlinear,		"linear",		1},
+	{CMps2,			"ps2",			1},
+	{CMps2intellimouse,	"ps2intellimouse",	1},
+	{CMres,			"res",			0},
+	{CMreset,		"reset",		1},
+	{CMserial,		"serial",		0},
 };
 };
 
 
 /*
 /*

+ 1 - 1
sys/src/9/amd64/msi.c

@@ -93,7 +93,7 @@ pcimsienable(Pcidev *p, uint64_t vec)
 	}
 	}
 	dmode = (vec >> 8) & 7;
 	dmode = (vec >> 8) & 7;
 	pcicfgw16(p, c + datao, Msidassert | Msidlogical * logical
 	pcicfgw16(p, c + datao, Msidassert | Msidlogical * logical
-		| Msidmode * dmode | (uint)vec & 0xff);
+		| Msidmode * dmode | ((uint)vec & 0xff));
 	if(f & Vmask)
 	if(f & Vmask)
 		pcicfgw32(p, c + datao + 4, 0);
 		pcicfgw32(p, c + datao + 4, 0);
 
 

+ 6 - 3
sys/src/9/amd64/pmcio.c

@@ -148,23 +148,26 @@ setctl(PmcCtl *p, int regno)
 
 
 	v = rdmsr(regno + PerfEvtbase);
 	v = rdmsr(regno + PerfEvtbase);
 	v &= PeEvMskH|PeEvMskL|PeCtEna|PeOS|PeUsr|PeUnMsk;
 	v &= PeEvMskH|PeEvMskL|PeCtEna|PeOS|PeUsr|PeUnMsk;
-	if (p->enab != PmcCtlNullval)
+	if (p->enab != PmcCtlNullval) {
 		if (p->enab)
 		if (p->enab)
 			v |= PeCtEna;
 			v |= PeCtEna;
 		else
 		else
 			v &= ~PeCtEna;
 			v &= ~PeCtEna;
+	}
 
 
-	if (p->user != PmcCtlNullval)
+	if (p->user != PmcCtlNullval) {
 		if (p->user)
 		if (p->user)
 			v |= PeUsr;
 			v |= PeUsr;
 		else
 		else
 			v &= ~PeUsr;
 			v &= ~PeUsr;
+	}
 
 
-	if (p->os != PmcCtlNullval)
+	if (p->os != PmcCtlNullval) {
 		if (p->os)
 		if (p->os)
 			v |= PeOS;
 			v |= PeOS;
 		else
 		else
 			v &= ~PeOS;
 			v &= ~PeOS;
+	}
 
 
 	if (pmctrans(p) < 0)
 	if (pmctrans(p) < 0)
 		return -1;
 		return -1;

+ 2 - 2
sys/src/9/amd64/root/cpu.c

@@ -805,8 +805,8 @@ struct {
 	ulong	perm;
 	ulong	perm;
 } fstab[] =
 } fstab[] =
 {
 {
-	[Qdir]		{ ".",		{Qdir, 0, QTDIR},	DMDIR|0555	},
-	[Qcpunote]	{ "cpunote",	{Qcpunote, 0},		0444		},
+	[Qdir] =	{ ".",		{Qdir, 0, QTDIR},	DMDIR|0555	},
+	[Qcpunote] =	{ "cpunote",	{Qcpunote, 0},		0444		},
 };
 };
 
 
 typedef struct Note Note;
 typedef struct Note Note;

+ 8 - 8
sys/src/9/amd64/sdiahci.c

@@ -28,9 +28,9 @@ enum {
 	Vmarvell= 0x1b4b,
 	Vmarvell= 0x1b4b,
 };
 };
 
 
-#define	dprint(...)	if(debug)	iprint(__VA_ARGS__); else USED(debug)
-#define	idprint(...)	if(prid)	iprint(__VA_ARGS__);  else USED(prid)
-#define	aprint(...)	if(datapi)	iprint(__VA_ARGS__);  else USED(datapi)
+#define	dprint(...)	do if(debug)	iprint(__VA_ARGS__); while(0)
+#define	idprint(...)	do if(prid)	iprint(__VA_ARGS__); while(0)
+#define	aprint(...)	do if(datapi)	iprint(__VA_ARGS__); while(0)
 
 
 #define Tname(c)	tname[(c)->type]
 #define Tname(c)	tname[(c)->type]
 #define Intel(x)	((x)->pci->vid == Vintel)
 #define Intel(x)	((x)->pci->vid == Vintel)
@@ -960,7 +960,7 @@ updatedrive(Drive *d)
 		}
 		}
 		pr = 0;
 		pr = 0;
 	}
 	}
-	if(p->task & 1 && last != cause)
+	if((p->task & 1) && last != cause)
 		dprint("%s: err ca %#lx serr %#lx task %#lx sstat %#lx\n",
 		dprint("%s: err ca %#lx serr %#lx task %#lx sstat %#lx\n",
 			name, cause, serr, p->task, p->sstatus);
 			name, cause, serr, p->task, p->sstatus);
 	if(pr)
 	if(pr)
@@ -1545,7 +1545,7 @@ ahcibuild(Drive *d, unsigned char *cmd, void *data, int n, int64_t lba)
 	Actab *t;
 	Actab *t;
 	Aportm *pm;
 	Aportm *pm;
 	Aprdt *p;
 	Aprdt *p;
-	static unsigned char tab[2][2] = { 0xc8, 0x25, 0xca, 0x35, };
+	static unsigned char tab[2][2] = { {0xc8, 0x25}, {0xca, 0x35}, };
 
 
 	pm = &d->portm;
 	pm = &d->portm;
 	dir = *cmd != 0x28;
 	dir = *cmd != 0x28;
@@ -1773,7 +1773,7 @@ retry:
 	task = d->port->task;
 	task = d->port->task;
 	iunlock(&d->Lock);
 	iunlock(&d->Lock);
 
 
-	if(task & (Efatal<<8) || task & (ASbsy|ASdrq) && d->state == Dready){
+	if((task & (Efatal<<8)) || ((task & (ASbsy|ASdrq)) && d->state == Dready)){
 		d->port->ci = 0;
 		d->port->ci = 0;
 		ahcirecover(&d->portc);
 		ahcirecover(&d->portc);
 		task = d->port->task;
 		task = d->port->task;
@@ -1917,8 +1917,8 @@ retry:
 		task = d->port->task;
 		task = d->port->task;
 		iunlock(&d->Lock);
 		iunlock(&d->Lock);
 
 
-		if(task & (Efatal<<8) ||
-		    task & (ASbsy|ASdrq) && d->state == Dready){
+		if((task & (Efatal<<8)) ||
+		    ((task & (ASbsy|ASdrq)) && d->state == Dready)){
 			d->port->ci = 0;
 			d->port->ci = 0;
 			ahcirecover(&d->portc);
 			ahcirecover(&d->portc);
 			task = d->port->task;
 			task = d->port->task;

+ 5 - 4
sys/src/9/amd64/usbohci.c

@@ -361,9 +361,9 @@ struct Ctlr
 	Pcidev*	pcidev;
 	Pcidev*	pcidev;
 };
 };
 
 
-#define dqprint		if(debug || io && io->debug)print
+#define dqprint		if(debug || (io && io->debug))print
 #define ddqprint		if(debug>1 || (io && io->debug>1))print
 #define ddqprint		if(debug>1 || (io && io->debug>1))print
-#define diprint		if(debug || iso && iso->Qio.debug)print
+#define diprint		if(debug || (iso && iso->Qio.debug))print
 #define ddiprint		if(debug>1 || (iso && iso->Qio.debug>1))print
 #define ddiprint		if(debug>1 || (iso && iso->Qio.debug>1))print
 #define TRUNC(x, sz)	((x) & ((sz)-1))
 #define TRUNC(x, sz)	((x) & ((sz)-1))
 
 
@@ -1743,13 +1743,14 @@ epctlio(Ep *ep, Ctlio *cio, void *a, int32_t count)
 		cio->Qio.tok = Tdtokout;
 		cio->Qio.tok = Tdtokout;
 		len = count;
 		len = count;
 	}
 	}
-	if(len > 0)
+	if(len > 0){
 		if(waserror())
 		if(waserror())
 			len = -1;
 			len = -1;
 		else{
 		else{
 			len = epio(ep, &cio->Qio, a, len, 0);
 			len = epio(ep, &cio->Qio, a, len, 0);
 			poperror();
 			poperror();
 		}
 		}
+	}
 	if(c[Rtype] & Rd2h){
 	if(c[Rtype] & Rd2h){
 		count = Rsetuplen;
 		count = Rsetuplen;
 		cio->ndata = len;
 		cio->ndata = len;
@@ -2382,7 +2383,7 @@ scanpci(void)
 		return;
 		return;
 	already = 1;
 	already = 1;
 	p = nil;
 	p = nil;
-	while(p = pcimatch(p, 0, 0)) {
+	while((p = pcimatch(p, 0, 0)) != nil){
 		/*
 		/*
 		 * Find Ohci controllers (Programming Interface = 0x10).
 		 * Find Ohci controllers (Programming Interface = 0x10).
 		 */
 		 */

+ 4 - 3
sys/src/9/amd64/usbuhci.c

@@ -951,7 +951,7 @@ interrupt(Ureg *ureg, void *a)
 	}
 	}
 	OUTS(Status, sts & Sall);
 	OUTS(Status, sts & Sall);
 	cmd = INS(Cmd);
 	cmd = INS(Cmd);
-	if(cmd & Crun == 0){
+	if((cmd & Crun) == 0){
 		print("uhci %#x: not running: uhci bug?\n", ctlr->port);
 		print("uhci %#x: not running: uhci bug?\n", ctlr->port);
 		/* BUG: should abort everything in this case */
 		/* BUG: should abort everything in this case */
 	}
 	}
@@ -1544,13 +1544,14 @@ epctlio(Ep *ep, Ctlio *cio, void *a, int32_t count)
 		cio->Qio.tok = Tdtokout;
 		cio->Qio.tok = Tdtokout;
 		len = count;
 		len = count;
 	}
 	}
-	if(len > 0)
+	if(len > 0) {
 		if(waserror())
 		if(waserror())
 			len = -1;
 			len = -1;
 		else{
 		else{
 			len = epio(ep, &cio->Qio, a, len, 0);
 			len = epio(ep, &cio->Qio, a, len, 0);
 			poperror();
 			poperror();
 		}
 		}
+	}
 	if(c[Rtype] & Rd2h){
 	if(c[Rtype] & Rd2h){
 		count = Rsetuplen;
 		count = Rsetuplen;
 		cio->ndata = len;
 		cio->ndata = len;
@@ -2107,7 +2108,7 @@ scanpci(void)
 		return;
 		return;
 	already = 1;
 	already = 1;
 	p = nil;
 	p = nil;
-	while(p = pcimatch(p, 0, 0)){
+	while((p = pcimatch(p, 0, 0)) != nil){
 		/*
 		/*
 		 * Find UHCI controllers (Programming Interface = 0).
 		 * Find UHCI controllers (Programming Interface = 0).
 		 */
 		 */

+ 1 - 3
sys/src/9/boot/BUILD

@@ -22,9 +22,7 @@ cc_library(
 	copts=[
 	copts=[
 		"-g",
 		"-g",
 		"-Wall",
 		"-Wall",
-		"-Wno-missing-braces",
-		"-Wno-parentheses",
-		"-Wno-unknown-pragmas",
+		"-Werror",
 		"-O0",
 		"-O0",
 		"-static",
 		"-static",
 		"-mno-red-zone",
 		"-mno-red-zone",

+ 1 - 1
sys/src/9/boot/boot.c

@@ -232,7 +232,7 @@ boot(int argc, char *argv[])
 	cmd = iargv[0];
 	cmd = iargv[0];
 
 
 	/* make iargv[0] basename(iargv[0]) */
 	/* make iargv[0] basename(iargv[0]) */
-	if(iargv[0] = strrchr(iargv[0], '/'))
+	if((iargv[0] = strrchr(iargv[0], '/')) != nil)
 		iargv[0]++;
 		iargv[0]++;
 	else
 	else
 		iargv[0] = cmd;
 		iargv[0] = cmd;

+ 1 - 3
sys/src/9/boot/boot.json

@@ -3,9 +3,7 @@
 		"Cflags": [
 		"Cflags": [
 			"-g",
 			"-g",
 			"-Wall",
 			"-Wall",
-			"-Wno-missing-braces",
-			"-Wno-parentheses",
-			"-Wno-unknown-pragmas",
+			"-Werror",
 			"-O0",
 			"-O0",
 			"-static",
 			"-static",
 			"-ffreestanding",
 			"-ffreestanding",

+ 1 - 1
sys/src/9/boot/bootcache.c

@@ -41,7 +41,7 @@ cache(int fd)
 	if(*partition == 0){
 	if(*partition == 0){
 		readfile("#e/bootdisk", bd, sizeof(bd));
 		readfile("#e/bootdisk", bd, sizeof(bd));
 		if(*bd){
 		if(*bd){
-			if(pp = strchr(bd, ':'))
+			if((pp = strchr(bd, ':')) != nil)
 				*pp = 0;
 				*pp = 0;
 			/* damned artificial intelligence */
 			/* damned artificial intelligence */
 			i = strlen(bd);
 			i = strlen(bd);

+ 1 - 1
sys/src/9/ip/ethermedium.c

@@ -546,7 +546,7 @@ resolveaddr6(Ipifc *ifc, Arpent *a)
 	a->rxtsrem--;
 	a->rxtsrem--;
 	arprelease(er->f->arp, a);
 	arprelease(er->f->arp, a);
 
 
-	if(sflag = ipv6anylocal(ifc, ipsrc))
+	if((sflag = ipv6anylocal(ifc, ipsrc)) != 0)
 		icmpns(er->f, ipsrc, sflag, a->ip, TARG_MULTI, ifc->mac);
 		icmpns(er->f, ipsrc, sflag, a->ip, TARG_MULTI, ifc->mac);
 }
 }
 
 

+ 3 - 3
sys/src/9/ip/ipifc.c

@@ -1167,7 +1167,7 @@ v6addrtype(uint8_t *addr)
 	if(isv4(addr) || ipcmp(addr, IPnoaddr) == 0)
 	if(isv4(addr) || ipcmp(addr, IPnoaddr) == 0)
 		return unknownv6;
 		return unknownv6;
 	else if(islinklocal(addr) ||
 	else if(islinklocal(addr) ||
-	    isv6mcast(addr) && (addr[1] & 0xF) <= Link_local_scop)
+	    (isv6mcast(addr) && (addr[1] & 0xF) <= Link_local_scop))
 		return linklocalv6;
 		return linklocalv6;
 	else
 	else
 		return globalv6;
 		return globalv6;
@@ -1278,8 +1278,8 @@ findlocalip(Fs *f, uint8_t *local, uint8_t *remote)
 			for(lifc = ifc->lifc; lifc; lifc = lifc->next){
 			for(lifc = ifc->lifc; lifc; lifc = lifc->next){
 				atypel = v6addrtype(lifc->local);
 				atypel = v6addrtype(lifc->local);
 				/* prefer appropriate scope */
 				/* prefer appropriate scope */
-				if(atypel > atype && atype < atyper ||
-				   atypel < atype && atype > atyper){
+				if((atypel > atype && atype < atyper) ||
+				   (atypel < atype && atype > atyper)){
 					ipmove(local, lifc->local);
 					ipmove(local, lifc->local);
 					deprecated = !v6addrcurr(lifc);
 					deprecated = !v6addrcurr(lifc);
 					atype = atypel;
 					atype = atypel;

+ 6 - 6
sys/src/9/ip/iproute.c

@@ -219,8 +219,8 @@ balancetree(Route **cur)
 	 * rotate tree node
 	 * rotate tree node
 	 */
 	 */
 	p = *cur;
 	p = *cur;
-	dl = 0; if(l = p->RouteTree.left) dl = l->RouteTree.depth;
-	dr = 0; if(r = p->RouteTree.right) dr = r->RouteTree.depth;
+	dl = 0; if((l = p->RouteTree.left) != nil) dl = l->RouteTree.depth;
+	dr = 0; if((r = p->RouteTree.right) != nil) dr = r->RouteTree.depth;
 
 
 	if(dl > dr+1) {
 	if(dl > dr+1) {
 		p->RouteTree.left = l->RouteTree.right;
 		p->RouteTree.left = l->RouteTree.right;
@@ -319,7 +319,7 @@ v4addroute(Fs *f, char *tag, uint8_t *a, uint8_t *mask, uint8_t *gate, int type)
 
 
 		wlock(&routelock);
 		wlock(&routelock);
 		addnode(f, &f->v4root[h], p);
 		addnode(f, &f->v4root[h], p);
-		while(p = f->queue) {
+		while((p = f->queue) != nil){
 			f->queue = p->RouteTree.mid;
 			f->queue = p->RouteTree.mid;
 			walkadd(f, &f->v4root[h], p->RouteTree.left);
 			walkadd(f, &f->v4root[h], p->RouteTree.left);
 			freeroute(p);
 			freeroute(p);
@@ -365,7 +365,7 @@ v6addroute(Fs *f, char *tag, uint8_t *a, uint8_t *mask, uint8_t *gate, int type)
 
 
 		wlock(&routelock);
 		wlock(&routelock);
 		addnode(f, &f->v6root[h], p);
 		addnode(f, &f->v6root[h], p);
-		while(p = f->queue) {
+		while((p = f->queue) != nil){
 			f->queue = p->RouteTree.mid;
 			f->queue = p->RouteTree.mid;
 			walkadd(f, &f->v6root[h], p->RouteTree.left);
 			walkadd(f, &f->v6root[h], p->RouteTree.left);
 			freeroute(p);
 			freeroute(p);
@@ -431,7 +431,7 @@ v4delroute(Fs *f, uint8_t *a, uint8_t *mask, int dolock)
 				addqueue(&f->queue, p->RouteTree.mid);
 				addqueue(&f->queue, p->RouteTree.mid);
 				addqueue(&f->queue, p->RouteTree.right);
 				addqueue(&f->queue, p->RouteTree.right);
 				freeroute(p);
 				freeroute(p);
-				while(p = f->queue) {
+				while((p = f->queue) != nil){
 					f->queue = p->RouteTree.mid;
 					f->queue = p->RouteTree.mid;
 					walkadd(f, &f->v4root[h], p->RouteTree.left);
 					walkadd(f, &f->v4root[h], p->RouteTree.left);
 					freeroute(p);
 					freeroute(p);
@@ -475,7 +475,7 @@ v6delroute(Fs *f, uint8_t *a, uint8_t *mask, int dolock)
 				addqueue(&f->queue, p->RouteTree.mid);
 				addqueue(&f->queue, p->RouteTree.mid);
 				addqueue(&f->queue, p->RouteTree.right);
 				addqueue(&f->queue, p->RouteTree.right);
 				freeroute(p);
 				freeroute(p);
-				while(p = f->queue) {
+				while((p = f->queue) != nil){
 					f->queue = p->RouteTree.mid;
 					f->queue = p->RouteTree.mid;
 					walkadd(f, &f->v6root[h], p->RouteTree.left);
 					walkadd(f, &f->v6root[h], p->RouteTree.left);
 					freeroute(p);
 					freeroute(p);

+ 3 - 3
sys/src/9/ip/netlog.c

@@ -72,9 +72,9 @@ enum
 
 
 static
 static
 Cmdtab routecmd[] = {
 Cmdtab routecmd[] = {
-	CMset,		"set",		0,
-	CMclear,	"clear",	0,
-	CMonly,		"only",		0,
+	{CMset,		"set",		0},
+	{CMclear,	"clear",	0},
+	{CMonly,	"only",		0},
 };
 };
 
 
 void
 void

+ 3 - 3
sys/src/9/ip/tcp.c

@@ -642,7 +642,7 @@ tcprcvwin(Conv *s)				/* Call with tcb locked */
 	if(seq_lt(tcb->rcv.nxt + w, tcb->rcv.wptr))
 	if(seq_lt(tcb->rcv.nxt + w, tcb->rcv.wptr))
 		w = tcb->rcv.wptr - tcb->rcv.nxt;
 		w = tcb->rcv.wptr - tcb->rcv.nxt;
 	if(w != tcb->rcv.wnd)
 	if(w != tcb->rcv.wnd)
-	if(w>>tcb->rcv.scale == 0 || tcb->window > 4*tcb->mss && w < tcb->mss/4){
+	if(w>>tcb->rcv.scale == 0 || (tcb->window > 4*tcb->mss && w < tcb->mss/4)){
 		tcb->rcv.blocked = 1;
 		tcb->rcv.blocked = 1;
 		netlog(s->p->f, Logtcp, "tcprcvwin: window %lu qlen %d ws %u lport %d\n",
 		netlog(s->p->f, Logtcp, "tcprcvwin: window %lu qlen %d ws %u lport %d\n",
 			tcb->window, qlen(s->rq), tcb->rcv.scale, s->lport);
 			tcb->window, qlen(s->rq), tcb->rcv.scale, s->lport);
@@ -2656,8 +2656,8 @@ tcpoutput(Conv *s)
 
 
 		if(!(tcb->flags & FORCE))
 		if(!(tcb->flags & FORCE))
 			if(ssize == 0 ||
 			if(ssize == 0 ||
-			    ssize < tcb->mss && tcb->snd.nxt == tcb->snd.ptr &&
-			    sent > TCPREXMTTHRESH * tcb->mss)
+			    (ssize < tcb->mss && tcb->snd.nxt == tcb->snd.ptr &&
+			    sent > TCPREXMTTHRESH * tcb->mss))
 				break;
 				break;
 
 
 		tcb->flags &= ~FORCE;
 		tcb->flags &= ~FORCE;

+ 11 - 11
sys/src/9/port/devbridge.c

@@ -55,16 +55,16 @@ enum
 };
 };
 
 
 static Dirtab bridgedirtab[]={
 static Dirtab bridgedirtab[]={
-	"ctl",		{Qbctl},	0,	0666,
-	"stats",	{Qstats},	0,	0444,
-	"cache",	{Qcache},	0,	0444,
-	"log",		{Qlog},		0,	0666,
+	{"ctl",		{Qbctl},	0,	0666},
+	{"stats",	{Qstats},	0,	0444},
+	{"cache",	{Qcache},	0,	0444},
+	{"log",		{Qlog},		0,	0666},
 };
 };
 
 
 static Dirtab portdirtab[]={
 static Dirtab portdirtab[]={
-	"ctl",		{Qpctl},	0,	0666,
-	"local",	{Qlocal},	0,	0444,
-	"status",	{Qstatus},	0,	0444,
+	{"ctl",		{Qpctl},	0,	0666},
+	{"local",	{Qlocal},	0,	0444},
+	{"status",	{Qstatus},	0,	0444},
 };
 };
 
 
 enum {
 enum {
@@ -940,7 +940,7 @@ tcpmsshack(Etherpkt *epkt, int n)
 		return;
 		return;
 	// fit checksum
 	// fit checksum
 	cksum = nhgets(tcphdr->cksum);
 	cksum = nhgets(tcphdr->cksum);
-	if(optr-(uint8_t*)tcphdr & 1) {
+	if((optr-(uint8_t*)tcphdr) & 1) {
 print("tcpmsshack: odd alignment!\n");
 print("tcpmsshack: odd alignment!\n");
 		// odd alignments are a pain
 		// odd alignments are a pain
 		cksum += nhgets(optr+1);
 		cksum += nhgets(optr+1);
@@ -1124,10 +1124,10 @@ etherwrite(Port *port, Block *bp)
 
 
 		if((fragoff + seglen) >= dlen) {
 		if((fragoff + seglen) >= dlen) {
 			seglen = dlen - fragoff;
 			seglen = dlen - fragoff;
-			hnputs(feh->frag, (frag+fragoff)>>3 | mf);
+			hnputs(feh->frag, ((frag+fragoff)>>3) | mf);
 		}
 		}
-		else	
-			hnputs(feh->frag, (frag+fragoff>>3) | IP_MF);
+		else
+			hnputs(feh->frag, ((frag+fragoff)>>3) | IP_MF);
 
 
 		hnputs(feh->length, seglen + IPHDR);
 		hnputs(feh->length, seglen + IPHDR);
 		hnputs(feh->id, lid);
 		hnputs(feh->id, lid);

+ 3 - 3
sys/src/9/port/devcap.c

@@ -52,9 +52,9 @@ enum
 /* caphash must be last */
 /* caphash must be last */
 Dirtab capdir[] =
 Dirtab capdir[] =
 {
 {
-	".",		{Qdir,0,QTDIR},	0,		DMDIR|0500,
-	"capuse",	{Quse},		0,		0222,
-	"caphash",	{Qhash},	0,		0200,
+	{".",		{Qdir,0,QTDIR},	0,		DMDIR|0500},
+	{"capuse",	{Quse},		0,		0222},
+	{"caphash",	{Qhash},	0,		0200},
 };
 };
 int ncapdir = nelem(capdir);
 int ncapdir = nelem(capdir);
 
 

+ 14 - 14
sys/src/9/port/devcec.c

@@ -129,23 +129,23 @@ static	Rendez	trendez;
 static	int	tcond;
 static	int	tcond;
 static	uint8_t	broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 static	uint8_t	broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 static 	Dirtab	cecdir[] = {
 static 	Dirtab	cecdir[] = {
-	".",		{ Qdir, 0, QTDIR },	0,	DMDIR | 0555,
-	"cecstat",	{ Qstat},		1,	0444,
-	"cecctl",	{ Qctl},		1,	0777,
-//	"cecctl",	{ Qctl},		1,	0664,
+	{".",		{ Qdir, 0, QTDIR },	0,	DMDIR | 0555},
+	{"cecstat",	{ Qstat},		1,	0444},
+	{"cecctl",	{ Qctl},		1,	0777},
+//	{"cecctl",	{ Qctl},		1,	0664},
 
 
-	"cecdbg",	{ Qdbg }, 		1,	0444,
-	"ceccfg",	{ Qcfg },		1,	0444,
+	{"cecdbg",	{ Qdbg }, 		1,	0444},
+	{"ceccfg",	{ Qcfg },		1,	0444},
 };
 };
 static	Cmdtab	ceccmd[] = {
 static	Cmdtab	ceccmd[] = {
-	CMsetname,	"name",	2,
-	CMtraceon,	"traceon",	1,
-	CMtraceoff,	"traceoff",	1,
-	CMsetpasswd,	"password",	2,
-	CMcecon,		"cecon",		2,
-	CMcecoff,		"cecoff",		2,
-	CMsetshelf,	"shelf",	2,
-	CMwrite,	"write",	-1,
+	{CMsetname,	"name",	2},
+	{CMtraceon,	"traceon",	1},
+	{CMtraceoff,	"traceoff",	1},
+	{CMsetpasswd,	"password",	2},
+	{CMcecon,		"cecon",		2},
+	{CMcecoff,		"cecoff",		2},
+	{CMsetshelf,	"shelf",	2},
+	{CMwrite,	"write",	-1},
 };
 };
 
 
 /*
 /*

+ 31 - 32
sys/src/9/port/devcons.c

@@ -101,9 +101,9 @@ enum
 
 
 Cmdtab rebootmsg[] =
 Cmdtab rebootmsg[] =
 {
 {
-	CMhalt,		"halt",		1,
-	CMreboot,	"reboot",	0,
-	CMpanic,	"panic",	0,
+	{CMhalt,	"halt",		1},
+	{CMreboot,	"reboot",	0},
+	{CMpanic,	"panic",	0},
 };
 };
 
 
 int
 int
@@ -362,7 +362,6 @@ iprint(char *fmt, ...)
 	return n;
 	return n;
 }
 }
 
 
-#pragma profile 0
 void
 void
 panic(char *fmt, ...)
 panic(char *fmt, ...)
 {
 {
@@ -394,7 +393,7 @@ panic(char *fmt, ...)
 	die("wait forever");
 	die("wait forever");
 	exit(1);
 	exit(1);
 }
 }
-#pragma profile 1
+
 /* libmp at least contains a few calls to sysfatal; simulate with panic */
 /* libmp at least contains a few calls to sysfatal; simulate with panic */
 void
 void
 sysfatal(char *fmt, ...)
 sysfatal(char *fmt, ...)
@@ -641,32 +640,32 @@ enum
 };
 };
 
 
 static Dirtab consdir[]={
 static Dirtab consdir[]={
-	".",	{Qdir, 0, QTDIR},	0,		DMDIR|0555,
-	"bintime",	{Qbintime},	24,		0664,
-	"cons",		{Qcons},	0,		0660,
-	"consctl",	{Qconsctl},	0,		0220,
-	"cputime",	{Qcputime},	6*NUMSIZE,	0444,
-	"drivers",	{Qdrivers},	0,		0444,
-	"hostdomain",	{Qhostdomain},	DOMLEN,		0664,
-	"hostowner",	{Qhostowner},	0,		0664,
-	"kmesg",	{Qkmesg},	0,		0440,
-	"kprint",	{Qkprint, 0, QTEXCL},	0,	DMEXCL|0440,
-	"null",		{Qnull},	0,		0666,
-	"osversion",	{Qosversion},	0,		0444,
-	"pgrpid",	{Qpgrpid},	NUMSIZE,	0444,
-	"pid",		{Qpid},		NUMSIZE,	0444,
-	"ppid",		{Qppid},	NUMSIZE,	0444,
-	"random",	{Qrandom},	0,		0444,
-	"urandom",  {Qurandom}, 0,      0444,
-	"reboot",	{Qreboot},	0,		0664,
-	"swap",		{Qswap},	0,		0664,
-	"sysname",	{Qsysname},	0,		0664,
-	"sysstat",	{Qsysstat},	0,		0666,
-	"time",		{Qtime},	NUMSIZE+3*VLNUMSIZE,	0664,
-	"user",		{Quser},	0,		0666,
-	"zero",		{Qzero},	0,		0444,
-	"syscall",	{Qsyscall},	0,		0666,
-	"debug",	{Qdebug},	0,		0666,
+	{".",	{Qdir, 0, QTDIR},	0,		DMDIR|0555},
+	{"bintime",	{Qbintime},	24,		0664},
+	{"cons",	{Qcons},	0,		0660},
+	{"consctl",	{Qconsctl},	0,		0220},
+	{"cputime",	{Qcputime},	6*NUMSIZE,	0444},
+	{"drivers",	{Qdrivers},	0,		0444},
+	{"hostdomain",	{Qhostdomain},	DOMLEN,		0664},
+	{"hostowner",	{Qhostowner},	0,		0664},
+	{"kmesg",	{Qkmesg},	0,		0440},
+	{"kprint",	{Qkprint, 0, QTEXCL},	0,	DMEXCL|0440},
+	{"null",	{Qnull},	0,		0666},
+	{"osversion",	{Qosversion},	0,		0444},
+	{"pgrpid",	{Qpgrpid},	NUMSIZE,	0444},
+	{"pid",		{Qpid},		NUMSIZE,	0444},
+	{"ppid",	{Qppid},	NUMSIZE,	0444},
+	{"random",	{Qrandom},	0,		0444},
+	{"urandom",	{Qurandom},	0,		0444},
+	{"reboot",	{Qreboot},	0,		0664},
+	{"swap",	{Qswap},	0,		0664},
+	{"sysname",	{Qsysname},	0,		0664},
+	{"sysstat",	{Qsysstat},	0,		0666},
+	{"time",	{Qtime},	NUMSIZE+3*VLNUMSIZE,	0664},
+	{"user",	{Quser},	0,		0666},
+	{"zero",	{Qzero},	0,		0444},
+	{"syscall",	{Qsyscall},	0,		0666},
+	{"debug",	{Qdebug},	0,		0666},
 };
 };
 
 
 int
 int
@@ -1061,7 +1060,7 @@ conswrite(Chan *c, void *va, int32_t n, int64_t off)
 				printallsyscalls = ! printallsyscalls;
 				printallsyscalls = ! printallsyscalls;
 				print("%sracing syscalls\n", printallsyscalls ? "T" : "Not t");
 				print("%sracing syscalls\n", printallsyscalls ? "T" : "Not t");
 			}
 			}
-			if(a = strchr(a, ' '))
+			if((a = strchr(a, ' ')) != nil)
 				a++;
 				a++;
 		}
 		}
 		break;
 		break;

+ 2 - 2
sys/src/9/port/devcoreboot.c

@@ -305,8 +305,8 @@ enum{
 };
 };
 
 
 static Dirtab corebootdir[]={
 static Dirtab corebootdir[]={
-	".",	{Qdir, 0, QTDIR},	0,			DMDIR|0555,
-	"table",	{Qtable},	0,			0444,
+	{".",	{Qdir, 0, QTDIR},	0,			DMDIR|0555},
+	{"table",	{Qtable},	0,			0444},
 };
 };
 
 
 struct sysinfo_t cbinfo;
 struct sysinfo_t cbinfo;

+ 4 - 4
sys/src/9/port/devdraw.c

@@ -653,7 +653,7 @@ drawfreedscreen(DScreen *this)
 		dscreen = this->next;
 		dscreen = this->next;
 		goto Found;
 		goto Found;
 	}
 	}
-	while(next = ds->next){	/* assign = */
+	while((next = ds->next) != nil){
 		if(next == this){
 		if(next == this){
 			ds->next = this->next;
 			ds->next = this->next;
 			goto Found;
 			goto Found;
@@ -728,7 +728,7 @@ drawuninstallscreen(Client *client, CScreen *this)
 		free(this);
 		free(this);
 		return;
 		return;
 	}
 	}
-	while(next = cs->next){	/* assign = */
+	while((next = cs->next) != nil){
 		if(next == this){
 		if(next == this){
 			cs->next = this->next;
 			cs->next = this->next;
 			drawfreedscreen(this->dscreen);
 			drawfreedscreen(this->dscreen);
@@ -752,7 +752,7 @@ drawuninstall(Client *client, int id)
 		drawfreedimage(d);
 		drawfreedimage(d);
 		return;
 		return;
 	}
 	}
-	while(next = d->next){	/* assign = */
+	while((next = d->next) != nil){
 		if(next->id == id){
 		if(next->id == id){
 			d->next = next->next;
 			d->next = next->next;
 			drawfreedimage(next);
 			drawfreedimage(next);
@@ -1138,7 +1138,7 @@ drawclose(Chan *c)
 	if(QID(c->qid) == Qctl)
 	if(QID(c->qid) == Qctl)
 		cl->busy = 0;
 		cl->busy = 0;
 	if((c->flag&COPEN) && (decref(&cl->r)==0)){
 	if((c->flag&COPEN) && (decref(&cl->r)==0)){
-		while(r = cl->refresh){	/* assign = */
+		while((r = cl->refresh) != nil){
 			cl->refresh = r->next;
 			cl->refresh = r->next;
 			free(r);
 			free(r);
 		}
 		}

+ 4 - 4
sys/src/9/port/devfdmux.c

@@ -56,10 +56,10 @@ enum
  */
  */
 Dirtab fdmuxdir[] =
 Dirtab fdmuxdir[] =
 {
 {
-	".",		{Qdir,0,QTDIR},	0,		DMDIR|0500,
-	"m",		{Qdata0},	0,		0600,
-	"cons",	{Qdata1},	0,		0600,
-	"consctl",		{Qctl},	0,		0600,
+	{".",		{Qdir,0,QTDIR},	0,		DMDIR|0500},
+	{"m",		{Qdata0},	0,		0600},
+	{"cons",	{Qdata1},	0,		0600},
+	{"consctl",		{Qctl},	0,		0600},
 };
 };
 #define NFDMUXDIR 4
 #define NFDMUXDIR 4
 
 

+ 2 - 2
sys/src/9/port/devkbin.c

@@ -18,8 +18,8 @@ enum {
 };
 };
 
 
 Dirtab kbintab[] = {
 Dirtab kbintab[] = {
-	".",	{Qdir, 0, QTDIR},	0,	0555,
-	"kbin",	{Qkbd, 0},		0,	0200,
+	{".",		{Qdir, 0, QTDIR},	0,	0555},
+	{"kbin",	{Qkbd, 0},		0,	0200},
 };
 };
 
 
 Lock	kbinlck;
 Lock	kbinlck;

+ 2 - 2
sys/src/9/port/devkbmap.c

@@ -14,8 +14,8 @@ enum{
 	Qdata,
 	Qdata,
 };
 };
 Dirtab kbmaptab[]={
 Dirtab kbmaptab[]={
-	".",		{Qdir, 0, QTDIR},	0,	0555,
-	"kbmap",	{Qdata, 0},		0,	0600,
+	{".",		{Qdir, 0, QTDIR},	0,	0555},
+	{"kbmap",	{Qdata, 0},		0,	0600},
 };
 };
 #define	NKBFILE	sizeof(kbmaptab)/sizeof(kbmaptab[0])
 #define	NKBFILE	sizeof(kbmaptab)/sizeof(kbmaptab[0])
 
 

+ 4 - 4
sys/src/9/port/devkprof.c

@@ -38,10 +38,10 @@ enum{
 };
 };
 
 
 Dirtab kproftab[]={
 Dirtab kproftab[]={
-	".",		{Kprofdirqid, 0, QTDIR},0,	DMDIR|0550,
-	"kpdata",	{Kprofdataqid},		0,	0600,
-	"kpctl",	{Kprofctlqid},		0,	0600,
-	"kpoprofile",	{Kprofoprofileqid},	0,	0600,
+	{".",		{Kprofdirqid, 0, QTDIR},0,	DMDIR|0550},
+	{"kpdata",	{Kprofdataqid},		0,	0600},
+	{"kpctl",	{Kprofctlqid},		0,	0600},
+	{"kpoprofile",	{Kprofoprofileqid},	0,	0600},
 };
 };
 
 
 void oprof_alarm_handler(Ureg *u)
 void oprof_alarm_handler(Ureg *u)

+ 12 - 11
sys/src/9/port/devmouse.c

@@ -71,10 +71,10 @@ enum
 
 
 static Cmdtab mousectlmsg[] =
 static Cmdtab mousectlmsg[] =
 {
 {
-	CMbuttonmap,	"buttonmap",	0,
-	CMscrollswap,	"scrollswap",	0,
-	CMswap,		"swap",		1,
-	CMwildcard,	"*",		0,
+	{CMbuttonmap,	"buttonmap",	0},
+	{CMscrollswap,	"scrollswap",	0},
+	{CMswap,	"swap",		1},
+	{CMwildcard,	"*",		0},
 };
 };
 
 
 Mouseinfo	mouse;
 Mouseinfo	mouse;
@@ -98,11 +98,11 @@ enum{
 };
 };
 
 
 static Dirtab mousedir[]={
 static Dirtab mousedir[]={
-	".",	{Qdir, 0, QTDIR},	0,			DMDIR|0555,
-	"cursor",	{Qcursor},	0,			0666,
-	"mouse",	{Qmouse},	0,			0666,
-	"mousein",	{Qmousein},	0,			0220,
-	"mousectl",	{Qmousectl},	0,			0220,
+	{".",	{Qdir, 0, QTDIR},	0,			DMDIR|0555},
+	{"cursor",	{Qcursor},	0,			0666},
+	{"mouse",	{Qmouse},	0,			0666},
+	{"mousein",	{Qmousein},	0,			0220},
+	{"mousectl",	{Qmousectl},	0,			0220},
 };
 };
 
 
 static unsigned char buttonmap[8] = {
 static unsigned char buttonmap[8] = {
@@ -296,11 +296,12 @@ mouseread(Chan *c, void *va, int32_t n, int64_t off)
 		b = buttonmap[m.buttons&7];
 		b = buttonmap[m.buttons&7];
 		/* put buttons 4 and 5 back in */
 		/* put buttons 4 and 5 back in */
 		b |= m.buttons & (3<<3);
 		b |= m.buttons & (3<<3);
-		if (scrollswap)
+		if(scrollswap){
 			if (b == 8)
 			if (b == 8)
 				b = 16;
 				b = 16;
 			else if (b == 16)
 			else if (b == 16)
 				b = 8;
 				b = 8;
+		}
 		snprint(buf, sizeof buf, "m%11d %11d %11d %11lu ",
 		snprint(buf, sizeof buf, "m%11d %11d %11d %11lu ",
 			m.xy.x, m.xy.y,
 			m.xy.x, m.xy.y,
 			b,
 			b,
@@ -652,7 +653,7 @@ m3mouseputc(Queue *queue, int c)
 	msg[nb] = c;
 	msg[nb] = c;
 	if(++nb == 3){
 	if(++nb == 3){
 		nb = 0;
 		nb = 0;
-		newbuttons = middle | b[(msg[0]>>4)&3 | (mouseshifted ? 4 : 0)];
+		newbuttons = middle | b[((msg[0]>>4)&3) | (mouseshifted?4:0)];
 		x = (msg[0]&0x3)<<14;
 		x = (msg[0]&0x3)<<14;
 		dx = (x>>8) | msg[1];
 		dx = (x>>8) | msg[1];
 		x = (msg[0]&0xc)<<12;
 		x = (msg[0]&0xc)<<12;

+ 2 - 2
sys/src/9/port/devpci.c

@@ -28,8 +28,8 @@ enum {
 #define QID(c, t)	(((c)<<4)|(t))
 #define QID(c, t)	(((c)<<4)|(t))
 
 
 static Dirtab topdir[] = {
 static Dirtab topdir[] = {
-	".",	{ Qtopdir, 0, QTDIR },	0,	0555,
-	"pci",	{ Qpcidir, 0, QTDIR },	0,	0555,
+	{".",	{ Qtopdir, 0, QTDIR },	0,	0555},
+	{"pci",	{ Qpcidir, 0, QTDIR },	0,	0555},
 };
 };
 
 
 extern Dev pcidevtab;
 extern Dev pcidevtab;

+ 3 - 3
sys/src/9/port/devpipe.c

@@ -40,9 +40,9 @@ enum
 
 
 Dirtab pipedir[] =
 Dirtab pipedir[] =
 {
 {
-	".",		{Qdir,0,QTDIR},	0,		DMDIR|0500,
-	"data",		{Qdata0},	0,		0600,
-	"data1",	{Qdata1},	0,		0600,
+	{".",		{Qdir,0,QTDIR},	0,		DMDIR|0500},
+	{"data",	{Qdata0},	0,		0600},
+	{"data1",	{Qdata1},	0,		0600},
 };
 };
 #define NPIPEDIR 3
 #define NPIPEDIR 3
 
 

+ 3 - 3
sys/src/9/port/devprobe.c

@@ -61,9 +61,9 @@ static char eventname[] = {
 };
 };
 
 
 static Dirtab probedir[]={
 static Dirtab probedir[]={
-	".",		{Qdir, 0, QTDIR},	0,		DMDIR|0555,
-	"probectl",	{Qctl},		0,		0664,
-	"probe",	{Qdata},	0,		0440,
+	{".",		{Qdir, 0, QTDIR},	0,		DMDIR|0555},
+	{"probectl",	{Qctl},		0,		0664},
+	{"probe",	{Qdata},	0,		0440},
 };
 };
 
 
 char hex[] = {
 char hex[] = {

+ 61 - 61
sys/src/9/port/devproc.c

@@ -100,65 +100,64 @@ enum{
  */
  */
 Dirtab procdir[] =
 Dirtab procdir[] =
 {
 {
-	"args",		{Qargs},	0,			0660,
-	"ctl",		{Qctl},		0,			0000,
-	"fd",		{Qfd},		0,			0444,
-	"fpregs",	{Qfpregs},	0,			0000,
-	"kregs",	{Qkregs},	sizeof(Ureg),		0600,
-	"mem",		{Qmem},		0,			0000,
-	"note",		{Qnote},	0,			0000,
-	"noteid",	{Qnoteid},	0,			0664,
-	"notepg",	{Qnotepg},	0,			0000,
-	"ns",		{Qns},		0,			0444,
-	"proc",		{Qproc},	0,			0400,
-	"gdbregs",	{Qgdbregs},	GDB_NUMREGBYTES,	0000,
-	"regs",		{Qregs},	sizeof(Ureg),		0000,
-	"segment",	{Qsegment},	0,			0444,
-	"status",	{Qstatus},	STATSIZE,		0444,
-	"strace",       {Qstrace},      0,                      0666,
-	"text",		{Qtext},	0,			0000,
-	"wait",		{Qwait},	0,			0400,
-	"profile",	{Qprofile},	0,			0400,
-	"syscall",	{Qsyscall},	0,			0400,
-	"core",		{Qcore},	0,			0444,
-	"tls",		{Qtls},		0,			0600,
-	"pager",	{Qpager},	0,			0600|DMEXCL,
+	{"args",	{Qargs},	0,			0660},
+	{"ctl",		{Qctl},		0,			0000},
+	{"fd",		{Qfd},		0,			0444},
+	{"fpregs",	{Qfpregs},	0,			0000},
+	{"kregs",	{Qkregs},	sizeof(Ureg),		0600},
+	{"mem",		{Qmem},		0,			0000},
+	{"note",	{Qnote},	0,			0000},
+	{"noteid",	{Qnoteid},	0,			0664},
+	{"notepg",	{Qnotepg},	0,			0000},
+	{"ns",		{Qns},		0,			0444},
+	{"proc",	{Qproc},	0,			0400},
+	{"gdbregs",	{Qgdbregs},	GDB_NUMREGBYTES,	0000},
+	{"regs",	{Qregs},	sizeof(Ureg),		0000},
+	{"segment",	{Qsegment},	0,			0444},
+	{"status",	{Qstatus},	STATSIZE,		0444},
+	{"strace",	{Qstrace},      0,                      0666},
+	{"text",	{Qtext},	0,			0000},
+	{"wait",	{Qwait},	0,			0400},
+	{"profile",	{Qprofile},	0,			0400},
+	{"syscall",	{Qsyscall},	0,			0400},
+	{"core",	{Qcore},	0,			0444},
+	{"tls",		{Qtls},		0,			0600},
+	{"pager",	{Qpager},	0,			0600|DMEXCL},
 
 
 };
 };
 
 
 static
 static
 Cmdtab proccmd[] = {
 Cmdtab proccmd[] = {
-	CMclose,		"close",		2,
-	CMclosefiles,		"closefiles",		1,
-	CMfixedpri,		"fixedpri",		2,
-	CMhang,			"hang",			1,
-	CMnohang,		"nohang",		1,
-	CMnoswap,		"noswap",		1,
-	CMkill,			"kill",			1,
-	CMpri,			"pri",			2,
-	CMprivate,		"private",		1,
-	CMprofile,		"profile",		1,
-	CMstart,		"start",		1,
-	CMstartstop,		"startstop",		1,
-	CMstartsyscall,		"startsyscall",		1,
-	CMstop,			"stop",			1,
-	CMwaitstop,		"waitstop",		1,
-	CMwired,		"wired",		2,
-	CMtrace,		"trace",		0,
-	CMperiod,		"period",		2,
-	CMdeadline,		"deadline",		2,
-	CMcost,			"cost",			2,
-	CMsporadic,		"sporadic",		1,
-	CMdeadlinenotes,	"deadlinenotes",	1,
-	CMadmit,		"admit",		1,
-	CMextra,		"extra",		1,
-	CMexpel,		"expel",		1,
-	CMevent,		"event",		1,
-	CMcore,			"core",			2,
-	CMstraceme,             "straceme",             0,
-	CMstraceall, "straceall", 0,
-	CMstraceoff, "straceoff", 0,
-
+	{CMclose,		"close",		2},
+	{CMclosefiles,		"closefiles",		1},
+	{CMfixedpri,		"fixedpri",		2},
+	{CMhang,		"hang",			1},
+	{CMnohang,		"nohang",		1},
+	{CMnoswap,		"noswap",		1},
+	{CMkill,		"kill",			1},
+	{CMpri,			"pri",			2},
+	{CMprivate,		"private",		1},
+	{CMprofile,		"profile",		1},
+	{CMstart,		"start",		1},
+	{CMstartstop,		"startstop",		1},
+	{CMstartsyscall,	"startsyscall",		1},
+	{CMstop,		"stop",			1},
+	{CMwaitstop,		"waitstop",		1},
+	{CMwired,		"wired",		2},
+	{CMtrace,		"trace",		0},
+	{CMperiod,		"period",		2},
+	{CMdeadline,		"deadline",		2},
+	{CMcost,		"cost",			2},
+	{CMsporadic,		"sporadic",		1},
+	{CMdeadlinenotes,	"deadlinenotes",	1},
+	{CMadmit,		"admit",		1},
+	{CMextra,		"extra",		1},
+	{CMexpel,		"expel",		1},
+	{CMevent,		"event",		1},
+	{CMcore,		"core",			2},
+	{CMstraceme,		"straceme",		0},
+	{CMstraceall,		"straceall",		0},
+	{CMstraceoff,		"straceoff",		0},
 };
 };
 
 
 /*
 /*
@@ -172,7 +171,7 @@ Cmdtab proccmd[] = {
 #define	QSHIFT	5	/* location in qid of proc slot # */
 #define	QSHIFT	5	/* location in qid of proc slot # */
 #define	SLOTBITS 23	/* number of bits in the slot */
 #define	SLOTBITS 23	/* number of bits in the slot */
 #define	QIDMASK	((1<<QSHIFT)-1)
 #define	QIDMASK	((1<<QSHIFT)-1)
-#define	SLOTMASK	((1<<SLOTBITS)-1 << QSHIFT)
+#define	SLOTMASK	(((1<<SLOTBITS)-1) << QSHIFT)
 
 
 #define QID(q)		((((uint32_t)(q).path)&QIDMASK)>>0)
 #define QID(q)		((((uint32_t)(q).path)&QIDMASK)>>0)
 #define SLOT(q)		(((((uint32_t)(q).path)&SLOTMASK)>>QSHIFT)-1)
 #define SLOT(q)		(((((uint32_t)(q).path)&SLOTMASK)>>QSHIFT)-1)
@@ -863,11 +862,12 @@ procread(Chan *c, void *va, int32_t n, int64_t off)
 		return rptr - (uint8_t*)va;
 		return rptr - (uint8_t*)va;
 	}
 	}
 
 
-	if(QID(c->qid) == Qtracepids)
+	if(QID(c->qid) == Qtracepids){
 		if(tpids == nil)
 		if(tpids == nil)
 			return 0;
 			return 0;
 		else
 		else
 			return readstr(off, va, n, tpids);
 			return readstr(off, va, n, tpids);
+	}
 
 
 	if((p = psincref(SLOT(c->qid))) == nil || p->pid != PID(c->qid))
 	if((p = psincref(SLOT(c->qid))) == nil || p->pid != PID(c->qid))
 		error(Eprocdied);
 		error(Eprocdied);
@@ -1810,15 +1810,15 @@ print("Set up tracing for pid %d\n", p->pid);
 	case CMperiod:
 	case CMperiod:
 		if(p->edf == nil)
 		if(p->edf == nil)
 			edfinit(p);
 			edfinit(p);
-		if(e=parsetime(&time, cb->f[1]))	/* time in ns */
+		if((e=parsetime(&time, cb->f[1])) != nil)	/* time in ns */
 			error(e);
 			error(e);
 		edfstop(p);
 		edfstop(p);
-		p->edf->T = time/1000;			/* Edf times are in µs */
+		p->edf->T = time/1000;				/* Edf times are in µs */
 		break;
 		break;
 	case CMdeadline:
 	case CMdeadline:
 		if(p->edf == nil)
 		if(p->edf == nil)
 			edfinit(p);
 			edfinit(p);
-		if(e=parsetime(&time, cb->f[1]))
+		if((e=parsetime(&time, cb->f[1])) != nil)
 			error(e);
 			error(e);
 		edfstop(p);
 		edfstop(p);
 		p->edf->D = time/1000;
 		p->edf->D = time/1000;
@@ -1826,7 +1826,7 @@ print("Set up tracing for pid %d\n", p->pid);
 	case CMcost:
 	case CMcost:
 		if(p->edf == nil)
 		if(p->edf == nil)
 			edfinit(p);
 			edfinit(p);
-		if(e=parsetime(&time, cb->f[1]))
+		if((e=parsetime(&time, cb->f[1])) != nil)
 			error(e);
 			error(e);
 		edfstop(p);
 		edfstop(p);
 		p->edf->C = time/1000;
 		p->edf->C = time/1000;
@@ -1844,7 +1844,7 @@ print("Set up tracing for pid %d\n", p->pid);
 	case CMadmit:
 	case CMadmit:
 		if(p->edf == 0)
 		if(p->edf == 0)
 			error("edf params");
 			error("edf params");
-		if(e = edfadmit(p))
+		if((e = edfadmit(p)) != nil)
 			error(e);
 			error(e);
 		break;
 		break;
 	case CMextra:
 	case CMextra:

+ 1 - 1
sys/src/9/port/devramfs.c

@@ -220,7 +220,7 @@ delete(struct RamFile* file)
 			prev->sibling = file->sibling;
 			prev->sibling = file->sibling;
 		}
 		}
 	}
 	}
-	if(!file->perm & DMDIR){
+	if(!(file->perm & DMDIR)){
 		free(file->data);
 		free(file->data);
 	}
 	}
 	file->magic = 0;
 	file->magic = 0;

+ 5 - 5
sys/src/9/port/devregress.c

@@ -17,11 +17,11 @@ enum {
 };
 };
 
 
 static Dirtab regressdir[Qmax] = {
 static Dirtab regressdir[Qmax] = {
-	".",		{ Qdir, 0, QTDIR },	0,	0555,
-	"regressctl",	{ Qctl, 0 },	0,	0666,
-	"malloc",	{ Qmalloc, 0 },	0,	0666,
-	"tsleep",	{ Qtsleep, 0 },	0,	0666,
-	"qlock",	{ Qlock, 0 },	0,	0666,
+	{".",		{ Qdir, 0, QTDIR },	0,	0555},
+	{"regressctl",	{ Qctl, 0 },	0,	0666},
+	{"malloc",	{ Qmalloc, 0 },	0,	0666},
+	{"tsleep",	{ Qtsleep, 0 },	0,	0666},
+	{"qlock",	{ Qlock, 0 },	0,	0666},
 };
 };
 
 
 int verbose = 0;
 int verbose = 0;

+ 3 - 3
sys/src/9/port/devroot.c

@@ -34,8 +34,8 @@ struct Dirlist
 };
 };
 
 
 static Dirtab rootdir[Nrootfiles] = {
 static Dirtab rootdir[Nrootfiles] = {
-	"#/",	{Qdir, 0, QTDIR},	0,		DMDIR|0555,
-	"boot",	{Qboot, 0, QTDIR},	0,		DMDIR|0555,
+	{"#/",		{Qdir, 0, QTDIR},	0,		DMDIR|0555},
+	{"boot",	{Qboot, 0, QTDIR},	0,		DMDIR|0555},
 };
 };
 static uint8_t *rootdata[Nrootfiles];
 static uint8_t *rootdata[Nrootfiles];
 static Dirlist rootlist =
 static Dirlist rootlist =
@@ -48,7 +48,7 @@ static Dirlist rootlist =
 };
 };
 
 
 static Dirtab bootdir[Nbootfiles] = {
 static Dirtab bootdir[Nbootfiles] = {
-	"boot",	{Qboot, 0, QTDIR},	0,		DMDIR|0555,
+	{"boot",	{Qboot, 0, QTDIR},	0,		DMDIR|0555},
 };
 };
 static uint8_t *bootdata[Nbootfiles];
 static uint8_t *bootdata[Nbootfiles];
 static Dirlist bootlist =
 static Dirlist bootlist =

+ 8 - 8
sys/src/9/port/devsd.c

@@ -268,7 +268,7 @@ sdgetdev(int idno)
 		return nil;
 		return nil;
 
 
 	qlock(&devslock);
 	qlock(&devslock);
-	if(sdev = devs[i])
+	if((sdev = devs[i]) != nil)
 		incref(&sdev->r);
 		incref(&sdev->r);
 	qunlock(&devslock);
 	qunlock(&devslock);
 	return sdev;
 	return sdev;
@@ -1503,7 +1503,7 @@ unconfigure(char* spec)
 		sdev->ifc->disable(sdev);
 		sdev->ifc->disable(sdev);
 
 
 	for(i = 0; i != sdev->nunit; i++){
 	for(i = 0; i != sdev->nunit; i++){
-		if(unit = sdev->unit[i]){
+		if((unit = sdev->unit[i]) != nil){
 			free(unit->SDperm.name);
 			free(unit->SDperm.name);
 			free(unit->SDperm.user);
 			free(unit->SDperm.user);
 			free(unit);
 			free(unit);
@@ -1645,12 +1645,12 @@ static struct {
 	char	*name;
 	char	*name;
 	void	(*parse)(Confdata*, char*);
 	void	(*parse)(Confdata*, char*);
 } options[] = {
 } options[] = {
-	"switch",	parseswitch,
-	"spec",		parsespec,
-	"port",		parseport,
-	"size",		parsesize,
-	"irq",		parseirq,
-	"type",		parsetype,
+	{"switch",	parseswitch},
+	{"spec",	parsespec},
+	{"port",	parseport},
+	{"size",	parsesize},
+	{"irq",		parseirq},
+	{"type",	parsetype},
 };
 };
 
 
 static void
 static void

+ 3 - 5
sys/src/9/port/devtrace.c

@@ -15,8 +15,6 @@
 #include	"../port/error.h"
 #include	"../port/error.h"
 #include	"netif.h"
 #include	"netif.h"
 
 
-#pragma profile 0
-
 typedef struct Trace Trace;
 typedef struct Trace Trace;
 /* This is a trace--a segment of memory to watch for entries and exits */
 /* This is a trace--a segment of memory to watch for entries and exits */
 struct Trace {
 struct Trace {
@@ -95,9 +93,9 @@ static char eventname[] = {
 };
 };
 
 
 static Dirtab tracedir[]={
 static Dirtab tracedir[]={
-	".",		{Qdir, 0, QTDIR},	0,		DMDIR|0555,
-	"tracectl",	{Qctl},		0,		0664,
-	"trace",	{Qdata},	0,		0440,
+	{".",		{Qdir, 0, QTDIR},	0,		DMDIR|0555},
+	{"tracectl",	{Qctl},		0,		0664},
+	{"trace",	{Qdata},	0,		0440},
 };
 };
 
 
 char hex[] = {
 char hex[] = {

+ 1 - 1
sys/src/9/port/devuart.c

@@ -177,7 +177,7 @@ uartreset(void)
 
 
 	uartndir = 1 + 3*uartnuart;
 	uartndir = 1 + 3*uartnuart;
 	uartdir = malloc(uartndir * sizeof(Dirtab));
 	uartdir = malloc(uartndir * sizeof(Dirtab));
-	if(uartnuart > 0 && uart == nil || uartdir == nil)
+	if(uartnuart > 0 && (uart == nil || uartdir == nil))
 		panic("uartreset: no memory");
 		panic("uartreset: no memory");
 	dp = uartdir;
 	dp = uartdir;
 	strcpy(dp->name, ".");
 	strcpy(dp->name, ".");

+ 2 - 2
sys/src/9/port/devvcon.c

@@ -34,8 +34,8 @@ enum
 };
 };
 
 
 static Dirtab topdir[] = {
 static Dirtab topdir[] = {
-	".",		{ Qtopdir, 0, QTDIR },	0,	DMDIR|0555,
-	"virtcon",	{ Qvirtcon, 0, QTDIR },	0,	DMDIR|0555,
+	{".",		{ Qtopdir, 0, QTDIR },	0,	DMDIR|0555},
+	{"virtcon",	{ Qvirtcon, 0, QTDIR },	0,	DMDIR|0555},
 };
 };
 
 
 extern Dev vcondevtab;
 extern Dev vcondevtab;

+ 3 - 3
sys/src/9/port/devwd.c

@@ -22,8 +22,8 @@ enum {
 
 
 static Watchdog *wd;
 static Watchdog *wd;
 static Dirtab wddir[] = {
 static Dirtab wddir[] = {
-	".",		{ Qdir, 0, QTDIR },	0,		0550,
-	"wdctl",	{ Qwdctl, 0 },		0,		0660,
+	{".",		{ Qdir, 0, QTDIR },	0,		0550},
+	{"wdctl",	{ Qwdctl, 0 },		0,		0660},
 };
 };
 
 
 
 
@@ -109,7 +109,7 @@ wdwrite(Chan* c, void* a, int32_t n, int64_t off)
 		if(off != 0ll)
 		if(off != 0ll)
 			error(Ebadarg);
 			error(Ebadarg);
 
 
-		if(p = strchr(a, '\n'))
+		if((p = strchr(a, '\n')) != nil)
 			*p = 0;
 			*p = 0;
 
 
 		if(!strncmp(a, "enable", n))
 		if(!strncmp(a, "enable", n))

+ 3 - 3
sys/src/9/port/devws.c

@@ -30,9 +30,9 @@ enum{
 };
 };
 
 
 Dirtab Wstab[]={
 Dirtab Wstab[]={
-	".",		{WSdirqid, 0, QTDIR},0,	DMDIR|0550,
-	"wsdata",	{WSdataqid},		0,	0600,
-	"wsctl",	{WSctlqid},		0,	0600,
+	{".",		{WSdirqid, 0, QTDIR},0,	DMDIR|0550},
+	{"wsdata",	{WSdataqid},		0,	0600},
+	{"wsctl",	{WSctlqid},		0,	0600},
 };
 };
 
 
 
 

+ 3 - 3
sys/src/9/port/devzp.c

@@ -61,9 +61,9 @@ enum
 
 
 Dirtab zpdir[] =
 Dirtab zpdir[] =
 {
 {
-	".",		{Qdir,0,QTDIR},	0,		DMDIR|0500,
-	"data",		{Qdata0},	0,		0600,
-	"data1",	{Qdata1},	0,		0600,
+	{".",		{Qdir,0,QTDIR},	0,		DMDIR|0500},
+	{"data",	{Qdata0},	0,		0600},
+	{"data1",	{Qdata1},	0,		0600},
 };
 };
 #define NZPDIR 3
 #define NZPDIR 3
 
 

+ 2 - 2
sys/src/9/port/edf.c

@@ -373,7 +373,7 @@ edfadmit(Proc *p)
 		return "C > D";
 		return "C > D";
 
 
 	qlock(&edfschedlock);
 	qlock(&edfschedlock);
-	if (err = testschedulability(p)){
+	if ((err = testschedulability(p)) != nil){
 		qunlock(&edfschedlock);
 		qunlock(&edfschedlock);
 		return err;
 		return err;
 	}
 	}
@@ -449,7 +449,7 @@ edfstop(Proc *p)
 {
 {
 	Edf *e;
 	Edf *e;
 
 
-	if(e = edflock(p)){
+	if((e = edflock(p)) != nil){
 		DPRINT("%lu edfstop %d[%s]\n", now, p->pid, statename[p->state]);
 		DPRINT("%lu edfstop %d[%s]\n", now, p->pid, statename[p->state]);
 		if(p->trace)
 		if(p->trace)
 			proctrace(p, SExpel, 0);
 			proctrace(p, SExpel, 0);

+ 3 - 2
sys/src/9/port/latin1.c

@@ -20,7 +20,7 @@ struct cvlist
 	int32_t	*so;		/* the corresponding Rune for each si entry */
 	int32_t	*so;		/* the corresponding Rune for each si entry */
 } latintab[] = {
 } latintab[] = {
 #include "../port/latin1.h"
 #include "../port/latin1.h"
-	0,	0,		0
+	{nil,	nil,		nil}
 };
 };
 
 
 /*
 /*
@@ -59,11 +59,12 @@ latin1(Rune *k, int n)
 	int c;
 	int c;
 	char* p;
 	char* p;
 
 
-	if(k[0] == 'X')
+	if(k[0] == 'X'){
 		if(n>=5)
 		if(n>=5)
 			return unicode(k);
 			return unicode(k);
 		else
 		else
 			return -5;
 			return -5;
+	}
 	for(l=latintab; l->ld!=0; l++)
 	for(l=latintab; l->ld!=0; l++)
 		if(k[0] == l->ld[0]){
 		if(k[0] == l->ld[0]){
 			if(n == 1)
 			if(n == 1)

+ 100 - 100
sys/src/9/port/latin1.h

@@ -7,103 +7,103 @@
  * in the LICENSE file.
  * in the LICENSE file.
  */
  */
 
 
-	" ", " i",	(int32_t *)L"␣ı",
-	"!~", "-=~",	(int32_t *)L"≄≇≉",
-	"!", "!<=>?bmp",	(int32_t *)L"¡≮≠≯‽⊄∉⊅",
-	"\"*", "IUiu",	(int32_t *)L"ΪΫϊϋ",
-	"\"", "\"AEIOUYaeiouy",	(int32_t *)L"¨ÄËÏÖÜŸäëïöüÿ",
-	"$*", "fhk",	(int32_t *)L"ϕϑϰ",
-	"$", "BEFHILMRVaefglopv",	(int32_t *)L"ℬℰℱℋℐℒℳℛƲɑℯƒℊℓℴ℘ʋ",
-	"\'\"", "Uu",	(int32_t *)L"Ǘǘ",
-	"\'", "\'ACEILNORSUYZacegilnorsuyz",	(int32_t *)L"´ÁĆÉÍĹŃÓŔŚÚÝŹáćéģíĺńóŕśúýź",
-	"*", "*ABCDEFGHIKLMNOPQRSTUWXYZabcdefghiklmnopqrstuwxyz",	(int32_t *)L"∗ΑΒΞΔΕΦΓΘΙΚΛΜΝΟΠΨΡΣΤΥΩΧΗΖαβξδεφγθικλμνοπψρστυωχηζ",
-	"+", "-O",	(int32_t *)L"±⊕",
-	",", ",ACEGIKLNORSTUacegiklnorstu",	(int32_t *)L"¸ĄÇĘĢĮĶĻŅǪŖŞŢŲąçęģįķļņǫŗşţų",
-	"-*", "l",	(int32_t *)L"ƛ",
-	"-", "+-2:>DGHILOTZbdghiltuz~",	(int32_t *)L"∓­ƻ÷→ÐǤĦƗŁ⊖ŦƵƀðǥℏɨłŧʉƶ≂",
-	".", ".CEGILOZceglz",	(int32_t *)L"·ĊĖĠİĿ⊙Żċėġŀż",
-	"/", "Oo",	(int32_t *)L"Øø",
-	"1", ".234568",	(int32_t *)L"․½⅓¼⅕⅙⅛",
-	"2", "-.35",	(int32_t *)L"ƻ‥⅔⅖",
-	"3", ".458",	(int32_t *)L"…¾⅗⅜",
-	"4", "5",	(int32_t *)L"⅘",
-	"5", "68",	(int32_t *)L"⅚⅝",
-	"7", "8",	(int32_t *)L"⅞",
-	":", "()-=",	(int32_t *)L"☹☺÷≔",
-	"<!", "=~",	(int32_t *)L"≨⋦",
-	"<", "-<=>~",	(int32_t *)L"←«≤≶≲",
-	"=", ":<=>OV",	(int32_t *)L"≕⋜≡⋝⊜⇒",
-	">!", "=~",	(int32_t *)L"≩⋧",
-	">", "<=>~",	(int32_t *)L"≷≥»≳",
-	"?", "!?",	(int32_t *)L"‽¿",
-	"@\'", "\'",	(int32_t *)L"ъ",
-	"@@", "\'EKSTYZekstyz",	(int32_t *)L"ьЕКСТЫЗекстыз",
-	"@C", "Hh",	(int32_t *)L"ЧЧ",
-	"@E", "Hh",	(int32_t *)L"ЭЭ",
-	"@K", "Hh",	(int32_t *)L"ХХ",
-	"@S", "CHch",	(int32_t *)L"ЩШЩШ",
-	"@T", "Ss",	(int32_t *)L"ЦЦ",
-	"@Y", "AEOUaeou",	(int32_t *)L"ЯЕЁЮЯЕЁЮ",
-	"@Z", "Hh",	(int32_t *)L"ЖЖ",
-	"@c", "h",	(int32_t *)L"ч",
-	"@e", "h",	(int32_t *)L"э",
-	"@k", "h",	(int32_t *)L"х",
-	"@s", "ch",	(int32_t *)L"щш",
-	"@t", "s",	(int32_t *)L"ц",
-	"@y", "aeou",	(int32_t *)L"яеёю",
-	"@z", "h",	(int32_t *)L"ж",
-	"@", "ABDFGIJLMNOPRUVXabdfgijlmnopruvx",	(int32_t *)L"АБДФГИЙЛМНОПРУВХабдфгийлмнопрувх",
-	"A", "E",	(int32_t *)L"Æ",
-	"C", "ACU",	(int32_t *)L"⋂ℂ⋃",
-	"Dv", "Zz",	(int32_t *)L"DŽDž",
-	"D", "-e",	(int32_t *)L"Ð∆",
-	"G", "-",	(int32_t *)L"Ǥ",
-	"H", "-H",	(int32_t *)L"Ħℍ",
-	"I", "-J",	(int32_t *)L"ƗIJ",
-	"L", "&-Jj|",	(int32_t *)L"⋀ŁLJLj⋁",
-	"M", "#48bs",	(int32_t *)L"♮♩♪♭♯",
-	"N", "JNj",	(int32_t *)L"NJℕNj",
-	"O", "*+-./=EIcoprx",	(int32_t *)L"⊛⊕⊖⊙⊘⊜ŒƢ©⊚℗®⊗",
-	"P", "P",	(int32_t *)L"ℙ",
-	"Q", "Q",	(int32_t *)L"ℚ",
-	"R", "R",	(int32_t *)L"ℝ",
-	"S", "123S",	(int32_t *)L"¹²³§",
-	"T", "-u",	(int32_t *)L"Ŧ⊨",
-	"V", "=",	(int32_t *)L"⇐",
-	"Y", "R",	(int32_t *)L"Ʀ",
-	"Z", "-ACSZ",	(int32_t *)L"Ƶℤ",
-	"^", "ACEGHIJOSUWYaceghijosuwy",	(int32_t *)L"ÂĈÊĜĤÎĴÔŜÛŴŶâĉêĝĥîĵôŝûŵŷ",
-	"_\"", "AUau",	(int32_t *)L"ǞǕǟǖ",
-	"_,", "Oo",	(int32_t *)L"Ǭǭ",
-	"_.", "Aa",	(int32_t *)L"Ǡǡ",
-	"_", "AEIOU_aeiou",	(int32_t *)L"ĀĒĪŌŪ¯āēīōū",
-	"`\"", "Uu",	(int32_t *)L"Ǜǜ",
-	"`", "AEIOUaeiou",	(int32_t *)L"ÀÈÌÒÙàèìòù",
-	"a", "ben",	(int32_t *)L"↔æ∠",
-	"b", "()+-0123456789=bknpqru",	(int32_t *)L"₍₎₊₋₀₁₂₃₄₅₆₇₈₉₌♝♚♞♟♛♜•",
-	"c", "$Oagu",	(int32_t *)L"¢©∩≅∪",
-	"dv", "z",	(int32_t *)L"dž",
-	"d", "-adegz",	(int32_t *)L"ð↓‡°†ʣ",
-	"e", "$lmns",	(int32_t *)L"€⋯—–∅",
-	"f", "a",	(int32_t *)L"∀",
-	"g", "$-r",	(int32_t *)L"¤ǥ∇",
-	"h", "-v",	(int32_t *)L"ℏƕ",
-	"i", "-bfjps",	(int32_t *)L"ɨ⊆∞ij⊇∫",
-	"l", "\"$&\'-jz|",	(int32_t *)L"“£∧‘łlj⋄∨",
-	"m", "iou",	(int32_t *)L"µ∈×",
-	"n", "jo",	(int32_t *)L"nj¬",
-	"o", "AOUaeiu",	(int32_t *)L"Å⊚Ůåœƣů",
-	"p", "Odgrt",	(int32_t *)L"℗∂¶∏∝",
-	"r", "\"\'O",	(int32_t *)L"”’®",
-	"s", "()+-0123456789=abnoprstu",	(int32_t *)L"⁽⁾⁺⁻⁰ⁱ⁲⁳⁴⁵⁶⁷⁸⁹⁼ª⊂ⁿº⊃√ß∍∑",
-	"t", "-efmsu",	(int32_t *)L"ŧ∃∴™ς⊢",
-	"u", "-AEGIOUaegiou",	(int32_t *)L"ʉĂĔĞĬŎŬ↑ĕğĭŏŭ",
-	"v\"", "Uu",	(int32_t *)L"Ǚǚ",
-	"v", "ACDEGIKLNORSTUZacdegijklnorstuz",	(int32_t *)L"ǍČĎĚǦǏǨĽŇǑŘŠŤǓŽǎčďěǧǐǰǩľňǒřšťǔž",
-	"w", "bknpqr",	(int32_t *)L"♗♔♘♙♕♖",
-	"x", "O",	(int32_t *)L"⊗",
-	"y", "$",	(int32_t *)L"¥",
-	"z", "-",	(int32_t *)L"ƶ",
-	"|", "Pp|",	(int32_t *)L"Þþ¦",
-	"~!", "=",	(int32_t *)L"≆",
-	"~", "-=AINOUainou~",	(int32_t *)L"≃≅ÃĨÑÕŨãĩñõũ≈",
+	{" ", " i",	(int32_t *)L"␣ı"},
+	{"!~", "-=~",	(int32_t *)L"≄≇≉"},
+	{"!", "!<=>?bmp",	(int32_t *)L"¡≮≠≯‽⊄∉⊅"},
+	{"\"*", "IUiu",	(int32_t *)L"ΪΫϊϋ"},
+	{"\"", "\"AEIOUYaeiouy",	(int32_t *)L"¨ÄËÏÖÜŸäëïöüÿ"},
+	{"$*", "fhk",	(int32_t *)L"ϕϑϰ"},
+	{"$", "BEFHILMRVaefglopv",	(int32_t *)L"ℬℰℱℋℐℒℳℛƲɑℯƒℊℓℴ℘ʋ"},
+	{"\'\"", "Uu",	(int32_t *)L"Ǘǘ"},
+	{"\'", "\'ACEILNORSUYZacegilnorsuyz",	(int32_t *)L"´ÁĆÉÍĹŃÓŔŚÚÝŹáćéģíĺńóŕśúýź"},
+	{"*", "*ABCDEFGHIKLMNOPQRSTUWXYZabcdefghiklmnopqrstuwxyz",	(int32_t *)L"∗ΑΒΞΔΕΦΓΘΙΚΛΜΝΟΠΨΡΣΤΥΩΧΗΖαβξδεφγθικλμνοπψρστυωχηζ"},
+	{"+", "-O",	(int32_t *)L"±⊕"},
+	{",", ",ACEGIKLNORSTUacegiklnorstu",	(int32_t *)L"¸ĄÇĘĢĮĶĻŅǪŖŞŢŲąçęģįķļņǫŗşţų"},
+	{"-*", "l",	(int32_t *)L"ƛ"},
+	{"-", "+-2:>DGHILOTZbdghiltuz~",	(int32_t *)L"∓­ƻ÷→ÐǤĦƗŁ⊖ŦƵƀðǥℏɨłŧʉƶ≂"},
+	{".", ".CEGILOZceglz",	(int32_t *)L"·ĊĖĠİĿ⊙Żċėġŀż"},
+	{"/", "Oo",	(int32_t *)L"Øø"},
+	{"1", ".234568",	(int32_t *)L"․½⅓¼⅕⅙⅛"},
+	{"2", "-.35",	(int32_t *)L"ƻ‥⅔⅖"},
+	{"3", ".458",	(int32_t *)L"…¾⅗⅜"},
+	{"4", "5",	(int32_t *)L"⅘"},
+	{"5", "68",	(int32_t *)L"⅚⅝"},
+	{"7", "8",	(int32_t *)L"⅞"},
+	{":", "()-=",	(int32_t *)L"☹☺÷≔"},
+	{"<!", "=~",	(int32_t *)L"≨⋦"},
+	{"<", "-<=>~",	(int32_t *)L"←«≤≶≲"},
+	{"=", ":<=>OV",	(int32_t *)L"≕⋜≡⋝⊜⇒"},
+	{">!", "=~",	(int32_t *)L"≩⋧"},
+	{">", "<=>~",	(int32_t *)L"≷≥»≳"},
+	{"?", "!?",	(int32_t *)L"‽¿"},
+	{"@\'", "\'",	(int32_t *)L"ъ"},
+	{"@@", "\'EKSTYZekstyz",	(int32_t *)L"ьЕКСТЫЗекстыз"},
+	{"@C", "Hh",	(int32_t *)L"ЧЧ"},
+	{"@E", "Hh",	(int32_t *)L"ЭЭ"},
+	{"@K", "Hh",	(int32_t *)L"ХХ"},
+	{"@S", "CHch",	(int32_t *)L"ЩШЩШ"},
+	{"@T", "Ss",	(int32_t *)L"ЦЦ"},
+	{"@Y", "AEOUaeou",	(int32_t *)L"ЯЕЁЮЯЕЁЮ"},
+	{"@Z", "Hh",	(int32_t *)L"ЖЖ"},
+	{"@c", "h",	(int32_t *)L"ч"},
+	{"@e", "h",	(int32_t *)L"э"},
+	{"@k", "h",	(int32_t *)L"х"},
+	{"@s", "ch",	(int32_t *)L"щш"},
+	{"@t", "s",	(int32_t *)L"ц"},
+	{"@y", "aeou",	(int32_t *)L"яеёю"},
+	{"@z", "h",	(int32_t *)L"ж"},
+	{"@", "ABDFGIJLMNOPRUVXabdfgijlmnopruvx",	(int32_t *)L"АБДФГИЙЛМНОПРУВХабдфгийлмнопрувх"},
+	{"A", "E",	(int32_t *)L"Æ"},
+	{"C", "ACU",	(int32_t *)L"⋂ℂ⋃"},
+	{"Dv", "Zz",	(int32_t *)L"DŽDž"},
+	{"D", "-e",	(int32_t *)L"Ð∆"},
+	{"G", "-",	(int32_t *)L"Ǥ"},
+	{"H", "-H",	(int32_t *)L"Ħℍ"},
+	{"I", "-J",	(int32_t *)L"ƗIJ"},
+	{"L", "&-Jj|",	(int32_t *)L"⋀ŁLJLj⋁"},
+	{"M", "#48bs",	(int32_t *)L"♮♩♪♭♯"},
+	{"N", "JNj",	(int32_t *)L"NJℕNj"},
+	{"O", "*+-./=EIcoprx",	(int32_t *)L"⊛⊕⊖⊙⊘⊜ŒƢ©⊚℗®⊗"},
+	{"P", "P",	(int32_t *)L"ℙ"},
+	{"Q", "Q",	(int32_t *)L"ℚ"},
+	{"R", "R",	(int32_t *)L"ℝ"},
+	{"S", "123S",	(int32_t *)L"¹²³§"},
+	{"T", "-u",	(int32_t *)L"Ŧ⊨"},
+	{"V", "=",	(int32_t *)L"⇐"},
+	{"Y", "R",	(int32_t *)L"Ʀ"},
+	{"Z", "-ACSZ",	(int32_t *)L"Ƶℤ"},
+	{"^", "ACEGHIJOSUWYaceghijosuwy",	(int32_t *)L"ÂĈÊĜĤÎĴÔŜÛŴŶâĉêĝĥîĵôŝûŵŷ"},
+	{"_\"", "AUau",	(int32_t *)L"ǞǕǟǖ"},
+	{"_,", "Oo",	(int32_t *)L"Ǭǭ"},
+	{"_.", "Aa",	(int32_t *)L"Ǡǡ"},
+	{"_", "AEIOU_aeiou",	(int32_t *)L"ĀĒĪŌŪ¯āēīōū"},
+	{"`\"", "Uu",	(int32_t *)L"Ǜǜ"},
+	{"`", "AEIOUaeiou",	(int32_t *)L"ÀÈÌÒÙàèìòù"},
+	{"a", "ben",	(int32_t *)L"↔æ∠"},
+	{"b", "()+-0123456789=bknpqru",	(int32_t *)L"₍₎₊₋₀₁₂₃₄₅₆₇₈₉₌♝♚♞♟♛♜•"},
+	{"c", "$Oagu",	(int32_t *)L"¢©∩≅∪"},
+	{"dv", "z",	(int32_t *)L"dž"},
+	{"d", "-adegz",	(int32_t *)L"ð↓‡°†ʣ"},
+	{"e", "$lmns",	(int32_t *)L"€⋯—–∅"},
+	{"f", "a",	(int32_t *)L"∀"},
+	{"g", "$-r",	(int32_t *)L"¤ǥ∇"},
+	{"h", "-v",	(int32_t *)L"ℏƕ"},
+	{"i", "-bfjps",	(int32_t *)L"ɨ⊆∞ij⊇∫"},
+	{"l", "\"$&\'-jz|",	(int32_t *)L"“£∧‘łlj⋄∨"},
+	{"m", "iou",	(int32_t *)L"µ∈×"},
+	{"n", "jo",	(int32_t *)L"nj¬"},
+	{"o", "AOUaeiu",	(int32_t *)L"Å⊚Ůåœƣů"},
+	{"p", "Odgrt",	(int32_t *)L"℗∂¶∏∝"},
+	{"r", "\"\'O",	(int32_t *)L"”’®"},
+	{"s", "()+-0123456789=abnoprstu",	(int32_t *)L"⁽⁾⁺⁻⁰ⁱ⁲⁳⁴⁵⁶⁷⁸⁹⁼ª⊂ⁿº⊃√ß∍∑"},
+	{"t", "-efmsu",	(int32_t *)L"ŧ∃∴™ς⊢"},
+	{"u", "-AEGIOUaegiou",	(int32_t *)L"ʉĂĔĞĬŎŬ↑ĕğĭŏŭ"},
+	{"v\"", "Uu",	(int32_t *)L"Ǚǚ"},
+	{"v", "ACDEGIKLNORSTUZacdegijklnorstuz",	(int32_t *)L"ǍČĎĚǦǏǨĽŇǑŘŠŤǓŽǎčďěǧǐǰǩľňǒřšťǔž"},
+	{"w", "bknpqr",	(int32_t *)L"♗♔♘♙♕♖"},
+	{"x", "O",	(int32_t *)L"⊗"},
+	{"y", "$",	(int32_t *)L"¥"},
+	{"z", "-",	(int32_t *)L"ƶ"},
+	{"|", "Pp|",	(int32_t *)L"Þþ¦"},
+	{"~!", "=",	(int32_t *)L"≆"},
+	{"~", "-=AINOUainou~",	(int32_t *)L"≃≅ÃĨÑÕŨãĩñõũ≈"},

+ 0 - 1
sys/src/9/port/lib.h

@@ -162,7 +162,6 @@ extern	int	abs(int);
 extern	int	atoi(char*);
 extern	int	atoi(char*);
 extern	char*	cleanname(char*);
 extern	char*	cleanname(char*);
 extern	int	dec64(unsigned char*, int, char*, int);
 extern	int	dec64(unsigned char*, int, char*, int);
-extern	uintptr_t	getcallerpc(void*);
 extern	int	getfields(char*, char**, int, int, char*);
 extern	int	getfields(char*, char**, int, int, char*);
 extern	int	gettokens(char *, char **, int, char *);
 extern	int	gettokens(char *, char **, int, char *);
 extern	int32_t	strtol(char*, char**, int);
 extern	int32_t	strtol(char*, char**, int);

+ 3 - 3
sys/src/9/port/pgrp.c

@@ -200,7 +200,7 @@ dupfgrp(Fgrp *f)
 
 
 	new->maxfd = f->maxfd;
 	new->maxfd = f->maxfd;
 	for(i = 0; i <= f->maxfd; i++) {
 	for(i = 0; i <= f->maxfd; i++) {
-		if(c = f->fd[i]){
+		if((c = f->fd[i]) != nil){
 			incref(&c->r);
 			incref(&c->r);
 			new->fd[i] = c;
 			new->fd[i] = c;
 		}
 		}
@@ -229,7 +229,7 @@ closefgrp(Fgrp *f)
 	 */
 	 */
 	up->closingfgrp = f;
 	up->closingfgrp = f;
 	for(i = 0; i <= f->maxfd; i++){
 	for(i = 0; i <= f->maxfd; i++){
-		if(c = f->fd[i]){
+		if((c = f->fd[i]) != nil){
 			f->fd[i] = nil;
 			f->fd[i] = nil;
 			cclose(c);
 			cclose(c);
 		}
 		}
@@ -265,7 +265,7 @@ forceclosefgrp(void)
 
 
 	f = up->closingfgrp;
 	f = up->closingfgrp;
 	for(i = 0; i <= f->maxfd; i++){
 	for(i = 0; i <= f->maxfd; i++){
-		if(c = f->fd[i]){
+		if((c = f->fd[i]) != nil){
 			f->fd[i] = nil;
 			f->fd[i] = nil;
 			ccloseq(c);
 			ccloseq(c);
 		}
 		}

+ 5 - 5
sys/src/9/port/portclock.c

@@ -75,7 +75,7 @@ tadd(Timers *tt, Timer *nt)
 		break;
 		break;
 	}
 	}
 
 
-	for(last = &tt->head; t = *last; last = &t->tnext){
+	for(last = &tt->head; (t = *last) != nil; last = &t->tnext){
 		if(t->twhen > nt->twhen)
 		if(t->twhen > nt->twhen)
 			break;
 			break;
 	}
 	}
@@ -96,7 +96,7 @@ tdel(Timer *dt)
 	tt = dt->tt;
 	tt = dt->tt;
 	if(tt == nil)
 	if(tt == nil)
 		return 0;
 		return 0;
-	for(last = &tt->head; t = *last; last = &t->tnext){
+	for(last = &tt->head; (t = *last) != nil; last = &t->tnext){
 		if(t == dt){
 		if(t == dt){
 			assert(dt->tt);
 			assert(dt->tt);
 			dt->tt = nil;
 			dt->tt = nil;
@@ -118,7 +118,7 @@ timeradd(Timer *nt)
 
 
 	/* Must lock Timer struct before Timers struct */
 	/* Must lock Timer struct before Timers struct */
 	ilock(&nt->l);
 	ilock(&nt->l);
-	if(tt = nt->tt){
+	if((tt = nt->tt) != nil){
 		ilock(&tt->l);
 		ilock(&tt->l);
 		tdel(nt);
 		tdel(nt);
 		iunlock(&tt->l);
 		iunlock(&tt->l);
@@ -140,7 +140,7 @@ timerdel(Timer *dt)
 	int64_t when;
 	int64_t when;
 
 
 	ilock(&dt->l);
 	ilock(&dt->l);
-	if(tt = dt->tt){
+	if((tt = dt->tt) != nil){
 		ilock(&tt->l);
 		ilock(&tt->l);
 		when = tdel(dt);
 		when = tdel(dt);
 		if(when && tt == &timers[machp()->machno])
 		if(when && tt == &timers[machp()->machno])
@@ -204,7 +204,7 @@ timerintr(Ureg *u, int64_t j)
 	tt = &timers[machp()->machno];
 	tt = &timers[machp()->machno];
 	now = fastticks(nil);
 	now = fastticks(nil);
 	ilock(&tt->l);
 	ilock(&tt->l);
-	while(t = tt->head){
+	while((t = tt->head) != nil){
 		/*
 		/*
 		 * No need to ilock t here: any manipulation of t
 		 * No need to ilock t here: any manipulation of t
 		 * requires tdel(t) and this must be done with a
 		 * requires tdel(t) and this must be done with a

+ 1 - 1
sys/src/9/port/ps.c

@@ -101,7 +101,7 @@ psalloc(void)
 
 
 	lock(&procalloc.l);
 	lock(&procalloc.l);
 	for(;;) {
 	for(;;) {
-		if(p = procalloc.free)
+		if((p = procalloc.free) != nil)
 			break;
 			break;
 
 
 		unlock(&procalloc.l);
 		unlock(&procalloc.l);

+ 1 - 1
sys/src/9/port/qio.c

@@ -225,7 +225,7 @@ pullupblock(Block *bp, int n)
 	 *  copy bytes from the trailing blocks into the first
 	 *  copy bytes from the trailing blocks into the first
 	 */
 	 */
 	n -= BLEN(bp);
 	n -= BLEN(bp);
-	while(nbp = bp->next){
+	while((nbp = bp->next) != nil){
 		i = BLEN(nbp);
 		i = BLEN(nbp);
 		if(i > n) {
 		if(i > n) {
 			memmove(bp->wp, nbp->rp, n);
 			memmove(bp->wp, nbp->rp, n);

+ 1 - 1
sys/src/9/port/rmap.c

@@ -116,7 +116,7 @@ rmapalloc(RMap* rmap, uintptr_t addr, uint size, int align)
 			do{
 			do{
 				mp++;
 				mp++;
 				(mp-1)->addr = mp->addr;
 				(mp-1)->addr = mp->addr;
-			}while((mp-1)->size = mp->size);
+			}while(((mp-1)->size = mp->size) != 0);
 		}
 		}
 
 
 		unlock(&rmap->Lock);
 		unlock(&rmap->Lock);

+ 2 - 2
sys/src/9/port/segment.c

@@ -149,7 +149,7 @@ relocateseg(Segment *s, uintptr_t offset)
 			continue;
 			continue;
 		pte = *p;
 		pte = *p;
 		for(pg = pte->first; pg <= pte->last; pg++) {
 		for(pg = pte->first; pg <= pte->last; pg++) {
-			if(x = *pg)
+			if((x = *pg) != nil)
 				x->va += offset;
 				x->va += offset;
 		}
 		}
 	}
 	}
@@ -212,7 +212,7 @@ dupseg(Segment **seg, int segno, int share)
 	}
 	}
 	size = s->mapsize;
 	size = s->mapsize;
 	for(i = 0; i < size; i++)
 	for(i = 0; i < size; i++)
-		if(pte = s->map[i])
+		if((pte = s->map[i]) != nil)
 			n->map[i] = ptecpy(n, pte);
 			n->map[i] = ptecpy(n, pte);
 
 
 	n->flushme = s->flushme;
 	n->flushme = s->flushme;

Some files were not shown because too many files changed in this diff