mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 23:08:46 +00:00
Fix warnings
This commit is contained in:
parent
612fe84e51
commit
94b31a70a4
2 changed files with 7 additions and 52 deletions
|
|
@ -617,7 +617,7 @@ aint inner_hash (aint depth, auint acc, void *p) {
|
||||||
|
|
||||||
extern void *LstringInt (char *b) {
|
extern void *LstringInt (char *b) {
|
||||||
aint n;
|
aint n;
|
||||||
sscanf(b, "%ld", &n);
|
sscanf(b, "%lld", &n);
|
||||||
return (void *)BOX(n);
|
return (void *)BOX(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1269,7 +1269,7 @@ extern aint Lread () {
|
||||||
|
|
||||||
printf("> ");
|
printf("> ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
scanf("%li", &result);
|
scanf("%lli", &result);
|
||||||
|
|
||||||
return BOX(result);
|
return BOX(result);
|
||||||
}
|
}
|
||||||
|
|
@ -1286,7 +1286,7 @@ extern int Lbinoperror2 (void) {
|
||||||
|
|
||||||
/* Lwrite is an implementation of the "write" construct */
|
/* Lwrite is an implementation of the "write" construct */
|
||||||
extern aint Lwrite (aint n) {
|
extern aint Lwrite (aint n) {
|
||||||
printf("%ld\n", UNBOX(n));
|
printf("%lld\n", UNBOX(n));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
53
src/X86.ml
53
src/X86.ml
|
|
@ -696,7 +696,7 @@ let compile cmd env imports code =
|
||||||
let x, env = env#pop in
|
let x, env = env#pop in
|
||||||
( env#set_stack l,
|
( env#set_stack l,
|
||||||
[ Sar1 x; (*!!!*) Binop ("cmp", L 0, x); CJmp (s, l) ] )
|
[ Sar1 x; (*!!!*) Binop ("cmp", L 0, x); CJmp (s, l) ] )
|
||||||
| BEGIN (f, nargs, nlocals, closure, args, scopes) ->
|
| BEGIN (f, nargs, nlocals, closure, _args, _scopes) ->
|
||||||
let _ =
|
let _ =
|
||||||
let is_safepoint = List.mem f safepoint_functions in
|
let is_safepoint = List.mem f safepoint_functions in
|
||||||
let is_vararg =
|
let is_vararg =
|
||||||
|
|
@ -708,55 +708,11 @@ let compile cmd env imports code =
|
||||||
(Printf.sprintf
|
(Printf.sprintf
|
||||||
"Function name %s is reserved for built-in" f))
|
"Function name %s is reserved for built-in" f))
|
||||||
in
|
in
|
||||||
let rec stabs_scope scope =
|
|
||||||
let names = []
|
|
||||||
(* List.map
|
|
||||||
(fun (name, index) ->
|
|
||||||
Meta
|
|
||||||
(Printf.sprintf "\t.stabs \"%s:1\",128,0,0,-%d" name
|
|
||||||
(stack_offset index)))
|
|
||||||
scope.names *)
|
|
||||||
in
|
|
||||||
names
|
|
||||||
@ (if names = [] then []
|
|
||||||
else
|
|
||||||
[
|
|
||||||
(* Meta
|
|
||||||
(Printf.sprintf "\t.stabn 192,0,0,%s-%s" scope.blab f); *)
|
|
||||||
])
|
|
||||||
@ (List.flatten @@ List.map stabs_scope scope.subs)
|
|
||||||
@
|
|
||||||
if names = [] then []
|
|
||||||
else
|
|
||||||
[
|
|
||||||
(* Meta
|
|
||||||
(Printf.sprintf "\t.stabn 224,0,0,%s-%s" scope.elab f); *)
|
|
||||||
]
|
|
||||||
in
|
|
||||||
let name =
|
|
||||||
if f.[0] = 'L' then String.sub f 1 (String.length f - 1)
|
|
||||||
else f
|
|
||||||
in
|
|
||||||
env#assert_empty_stack;
|
env#assert_empty_stack;
|
||||||
let has_closure = closure <> [] in
|
let has_closure = closure <> [] in
|
||||||
let env = env#enter f nargs nlocals has_closure in
|
let env = env#enter f nargs nlocals has_closure in
|
||||||
( env,
|
( env,
|
||||||
[ (* Meta (Printf.sprintf "\t.type %s, @function" name) *) ]
|
[ Meta "\t.cfi_startproc" ]
|
||||||
@ (if f = "_main" then []
|
|
||||||
else
|
|
||||||
[
|
|
||||||
(* Meta
|
|
||||||
(Printf.sprintf "\t.stabs \"%s:F1\",36,0,0,%s" name f); *)
|
|
||||||
]
|
|
||||||
(* @ List.mapi
|
|
||||||
(fun i a ->
|
|
||||||
Meta
|
|
||||||
(Printf.sprintf "\t.stabs \"%s:p1\",160,0,0,%d" a
|
|
||||||
((i * 4) + 8)))
|
|
||||||
args *)
|
|
||||||
@ List.flatten
|
|
||||||
@@ List.map stabs_scope scopes)
|
|
||||||
@ [ Meta "\t.cfi_startproc" ]
|
|
||||||
@ (if f = cmd#topname then
|
@ (if f = cmd#topname then
|
||||||
[
|
[
|
||||||
Mov (M (D, I, V, "_init"), rax);
|
Mov (M (D, I, V, "_init"), rax);
|
||||||
|
|
@ -842,7 +798,6 @@ let compile cmd env imports code =
|
||||||
Meta
|
Meta
|
||||||
(Printf.sprintf "\t.set\t%s,\t%d" env#allocated_size
|
(Printf.sprintf "\t.set\t%s,\t%d" env#allocated_size
|
||||||
env#allocated);
|
env#allocated);
|
||||||
(* Meta (Printf.sprintf "\t.size %s, .-%s" name name); *)
|
|
||||||
] )
|
] )
|
||||||
| RET ->
|
| RET ->
|
||||||
let x = env#peek in
|
let x = env#peek in
|
||||||
|
|
@ -887,7 +842,7 @@ let compile cmd env imports code =
|
||||||
(Printf.sprintf "Unexpected pattern: StrCmp %s: %d"
|
(Printf.sprintf "Unexpected pattern: StrCmp %s: %d"
|
||||||
__FILE__ __LINE__))
|
__FILE__ __LINE__))
|
||||||
1 false
|
1 false
|
||||||
| LINE line -> env#gen_line
|
| LINE _line -> env#gen_line
|
||||||
| FAIL ((line, col), value) ->
|
| FAIL ((line, col), value) ->
|
||||||
let v, env = if value then (env#peek, env) else env#pop in
|
let v, env = if value then (env#peek, env) else env#pop in
|
||||||
let msg_addr, env = env#string cmd#get_infile in
|
let msg_addr, env = env#string cmd#get_infile in
|
||||||
|
|
@ -1350,7 +1305,7 @@ let build cmd prog =
|
||||||
cmd#dump_file "i" (Interface.gen prog);
|
cmd#dump_file "i" (Interface.gen prog);
|
||||||
let inc = get_std_path () in
|
let inc = get_std_path () in
|
||||||
let compiler = "clang" in
|
let compiler = "clang" in
|
||||||
let flags = "-pie -arch x86_64" in
|
let flags = "-arch x86_64" in
|
||||||
match cmd#get_mode with
|
match cmd#get_mode with
|
||||||
| `Default ->
|
| `Default ->
|
||||||
let objs = find_objects (fst @@ fst prog) cmd#get_include_paths in
|
let objs = find_objects (fst @@ fst prog) cmd#get_include_paths in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue