]> Cypherpunks repositories - gostls13.git/commitdiff
8a: fixes for Plan 9 build
authorLucio De Re <lucio.dere@gmail.com>
Mon, 27 Jun 2011 18:42:18 +0000 (14:42 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 27 Jun 2011 18:42:18 +0000 (14:42 -0400)
8a/a.h:
. Removed <u.h> and <libc.h> includes as they work better in "a.y".
. Made definition of EOF conditional as it's defined in the Plan 9
  header files, but not elsewhere.

8a/a.y:
. Added <u.h> and <libc.h> because <stdio.h> in Plan 9 needs them.
  Sequence <u.h>, <stdio.h>, <libc.h> recommended by RSC.

8a/lex.c:
. Added <u.h> and <libc.h> as now needed by "a.h".
. Dropped <ctype.h>.

cc/lexbody:
. exit() -> exits().
. Dropped unwanted incrementation.

cc/macbody:
. Adjusted a few format specifications.

R=rsc
CC=golang-dev
https://golang.org/cl/4644047

src/cmd/8a/a.h
src/cmd/8a/a.y
src/cmd/8a/lex.c
src/cmd/cc/lexbody
src/cmd/cc/macbody

index 3cb30f4c27a676a49294e973af189ec43d802c00..c5c22d7baa30beadc6d9bd19c5675f24b0f3a346 100644 (file)
@@ -28,8 +28,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#include <u.h>
-#include <libc.h>
 #include <bio.h>
 #include "../8l/8.out.h"
 
@@ -57,7 +55,9 @@ typedef       struct  Gen2    Gen2;
 #define        NSYMB           500
 #define        BUFSIZ          8192
 #define        HISTSZ          20
+#ifndef        EOF
 #define        EOF             (-1)
+#endif
 #define        IGN             (-2)
 #define        GETC()          ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
 #define        NHASH           503
index 04662f83d0ce96f391eaaec9f8a5f9b12836a9ca..a8ac773daa594c5cf7d68ac14a66acec276abd49 100644 (file)
@@ -29,7 +29,9 @@
 // THE SOFTWARE.
 
 %{
+#include <u.h>
 #include <stdio.h>     /* if we don't, bison will, and a.h re-#defines getc */
+#include <libc.h>
 #include "a.h"
 %}
 %union {
index 0788618777f385b77846368f7ef8b341c0e2b883..ab4de417a506c52e5c156e99555326b1db0fca78 100644 (file)
 // THE SOFTWARE.
 
 #define        EXTERN
+#include <u.h>
+#include <libc.h>
 #include "a.h"
 #include "y.tab.h"
-#include <ctype.h>
 
 enum
 {
index 24f9bdc85591c8e76cb695b138b1e6ce2a779d78..f4cc19c2ea4cae79e3a5acf41dfe41d801ab9fe9 100644 (file)
@@ -96,7 +96,7 @@ alloc(int32 n)
        p = malloc(n);
        if(p == nil) {
                print("alloc out of mem\n");
-               exit(1);
+               exits("alloc: out of mem");
        }
        memset(p, 0, n);
        return p;
@@ -110,7 +110,7 @@ allocn(void *p, int32 n, int32 d)
        p = realloc(p, n+d);
        if(p == nil) {
                print("allocn out of mem\n");
-               exit(1);
+               exits("allocn: out of mem");
        }
        if(d > 0)
                memset((char*)p+n, 0, d);
@@ -245,7 +245,7 @@ lookup(void)
                }else
                        *w++ = *r;
        }
-       *w++ = '\0';
+       *w = '\0';
 
        h = 0;
        for(p=symb; c = *p; p++)
index ca8a54c0bce90e81d6ec81823516f581807bd7a0..ed66361f1a281f9359b16d218b706c7d2f69d4b5 100644 (file)
@@ -830,11 +830,11 @@ linehist(char *f, int offset)
        if(debug['f'])
                if(f) {
                        if(offset)
-                               print("%4ld: %s (#line %d)\n", lineno, f, offset);
+                               print("%4d: %s (#line %d)\n", lineno, f, offset);
                        else
-                               print("%4ld: %s\n", lineno, f);
+                               print("%4d: %s\n", lineno, f);
                } else
-                       print("%4ld: <pop>\n", lineno);
+                       print("%4d: <pop>\n", lineno);
        newflag = 0;
 
        h = alloc(sizeof(Hist));