]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use enums instead static vars for debugging
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 15 May 2013 07:10:26 +0000 (11:10 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 15 May 2013 07:10:26 +0000 (11:10 +0400)
Compiler can detect and delete dead code with enums,
but can not with static vars.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/9377043

src/pkg/runtime/chan.c
src/pkg/runtime/slice.c

index fba36a4c345801c2b4663dceb25b48d20eb043d9..0a01a403d26970bb642d88970f1dd420c2cb4034 100644 (file)
@@ -11,8 +11,6 @@
 #define        MAXALIGN        7
 #define        NOSELGEN        1
 
-static int32   debug   = 0;
-
 typedef        struct  WaitQ   WaitQ;
 typedef        struct  SudoG   SudoG;
 typedef        struct  Select  Select;
@@ -58,6 +56,8 @@ uint32 runtime·Hchansize = sizeof(Hchan);
 
 enum
 {
+       debug = 0,
+
        // Scase.kind
        CaseRecv,
        CaseSend,
index 354c54c865fbe9c91c2419d92a8eecc1a48d3dcd..d46d60f24a353032d98f89e26fc6543a3d2ab30f 100644 (file)
@@ -9,7 +9,10 @@
 #include "malloc.h"
 #include "race.h"
 
-static bool    debug   = 0;
+enum
+{
+       debug = 0
+};
 
 static void    makeslice1(SliceType*, intgo, intgo, Slice*);
 static void    growslice1(SliceType*, Slice, intgo, Slice *);