OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 | 8 |
9 /* | 9 /* |
10 * look for | 10 * look for |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 yes: | 88 yes: |
89 if(args->next != nil) | 89 if(args->next != nil) |
90 yyerror("extra arguments for %S", s); | 90 yyerror("extra arguments for %S", s); |
91 ret: | 91 ret: |
92 // any side effects disappear; ignore init | 92 // any side effects disappear; ignore init |
93 val.ctype = CTINT; | 93 val.ctype = CTINT; |
94 val.u.xval = mal(sizeof(*n->val.u.xval)); | 94 val.u.xval = mal(sizeof(*n->val.u.xval)); |
95 mpmovecfix(val.u.xval, v); | 95 mpmovecfix(val.u.xval, v); |
96 n = nod(OLITERAL, N, N); | 96 n = nod(OLITERAL, N, N); |
| 97 n->orig = nn; |
97 n->val = val; | 98 n->val = val; |
98 n->type = types[TUINTPTR]; | 99 n->type = types[TUINTPTR]; |
| 100 nn->type = types[TUINTPTR]; |
99 return n; | 101 return n; |
100 } | 102 } |
101 | 103 |
102 int | 104 int |
103 isunsafebuiltin(Node *n) | 105 isunsafebuiltin(Node *n) |
104 { | 106 { |
105 if(n == N || n->op != ONAME || n->sym == S || n->sym->pkg != unsafepkg) | 107 if(n == N || n->op != ONAME || n->sym == S || n->sym->pkg != unsafepkg) |
106 return 0; | 108 return 0; |
107 if(strcmp(n->sym->name, "Sizeof") == 0) | 109 if(strcmp(n->sym->name, "Sizeof") == 0) |
108 return 1; | 110 return 1; |
109 if(strcmp(n->sym->name, "Offsetof") == 0) | 111 if(strcmp(n->sym->name, "Offsetof") == 0) |
110 return 1; | 112 return 1; |
111 if(strcmp(n->sym->name, "Alignof") == 0) | 113 if(strcmp(n->sym->name, "Alignof") == 0) |
112 return 1; | 114 return 1; |
113 return 0; | 115 return 0; |
114 } | 116 } |
OLD | NEW |