]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: catch notes on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Thu, 13 Feb 2014 15:35:51 +0000 (16:35 +0100)
committerDavid du Colombier <0intro@gmail.com>
Thu, 13 Feb 2014 15:35:51 +0000 (16:35 +0100)
LGTM=rsc
R=rsc, jas, gobot
CC=ality, golang-codereviews
https://golang.org/cl/51650051

src/cmd/gc/lex.c

index 738ac494e5f545d0c0a812b7562094f6bab4b10a..a607fabde0d18839dd1125519fa4cb5ff17c7d82 100644 (file)
@@ -164,6 +164,23 @@ fault(int s)
        fatal("fault");
 }
 
+void
+catcher(void *v, char *s)
+{
+       USED(v);
+
+       if(strncmp(s, "sys: fp: invalid operation", 26) == 0) {
+               noted(NCONT);
+               return;
+       }
+       if(strncmp(s, "sys: trap: fault read", 21) == 0) {
+               if(nsavederrors + nerrors > 0)
+                       errorexit();
+               fatal("fault");
+       }
+       noted(NDFLT);
+}
+
 void
 doversion(void)
 {
@@ -188,6 +205,10 @@ main(int argc, char *argv[])
        signal(SIGSEGV, fault);
 #endif
 
+#ifdef PLAN9
+       notify(catcher);
+#endif
+
        ctxt = linknew(thelinkarch);
        ctxt->diag = yyerror;
        ctxt->bso = &bstdout;