From 26d0824defdcacffa354b38c09a45b7ec409bf08 Mon Sep 17 00:00:00 2001 From: "e.gavrin" Date: Tue, 8 Jul 2014 13:47:33 +0400 Subject: [PATCH] fix warnings --- src/libcoreint/interpreter.h | 4 +- src/libcoreint/opcode-structures.h | 132 ++++++++++++++--------------- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/libcoreint/interpreter.h b/src/libcoreint/interpreter.h index 01916337f..f01bf69cc 100644 --- a/src/libcoreint/interpreter.h +++ b/src/libcoreint/interpreter.h @@ -34,8 +34,8 @@ struct __int_data int *root_op_addr; }; -void gen_bytecode (); -void run_int (); +void gen_bytecode (void); +void run_int (void); void run_int_from_pos (struct __int_data *); #endif /* INTERPRETER_H */ diff --git a/src/libcoreint/opcode-structures.h b/src/libcoreint/opcode-structures.h index 3416e012f..4d42f6286 100644 --- a/src/libcoreint/opcode-structures.h +++ b/src/libcoreint/opcode-structures.h @@ -21,11 +21,11 @@ #define OP_CODE_DECL_VOID(name) \ - struct __op_##name { }; \ - OPCODE getop_##name (); + struct __op_##name { T_IDX __do_not_use; }; \ + OPCODE getop_##name ( void ); #define OP_CODE_DECL(name, type, ... ) \ - OP_DEF (name, type##_DECL( __VA_ARGS__ ) ); \ + OP_DEF (name, type##_DECL( __VA_ARGS__ ) ) \ OPCODE getop_##name ( type ); #define T_IDX_IDX T_IDX, T_IDX @@ -49,112 +49,112 @@ /** L < R */ OP_CODE_DECL (is_less_than, T_IDX_IDX, value_left, - value_right); + value_right) /** L <= R */ OP_CODE_DECL (is_less_or_equal, T_IDX_IDX, value_left, - value_right); + value_right) /** L > R */ OP_CODE_DECL (is_greater_than, T_IDX_IDX, value_left, - value_right); + value_right) /** L >= R */ OP_CODE_DECL (is_greater_or_equal, T_IDX_IDX, value_left, - value_right); + value_right) /** L == R */ OP_CODE_DECL (is_equal_value, T_IDX_IDX, value_left, - value_right); + value_right) /** L != R */ OP_CODE_DECL (is_not_equal_value, T_IDX_IDX, value_left, - value_right); + value_right) /** L === R */ OP_CODE_DECL (is_equal_value_type, T_IDX_IDX, value_left, - value_right); + value_right) /** L !== R */ OP_CODE_DECL (is_not_equal_value_type, T_IDX_IDX, value_left, - value_right); + value_right) /** Instruction tests if BOOLEAN value is TRUE and JMP to DST */ OP_CODE_DECL (is_true_jmp, T_IDX_IDX, value, - opcode); + opcode) /** Instruction tests if BOOLEAN value is FALSE and JMP to DST */ OP_CODE_DECL (is_false_jmp, T_IDX_IDX, value, - opcode); + opcode) /** Unconditional JMP to the specified opcode index */ OP_CODE_DECL (jmp, T_IDX, - opcode_idx); + opcode_idx) /** Unconditional JMP on opcode_count up */ OP_CODE_DECL (jmp_up, T_IDX, - opcode_count); + opcode_count) /** Unconditional JMP on opcode_count down */ OP_CODE_DECL (jmp_down, T_IDX, - opcode_count); + opcode_count) /** dst = L + R */ OP_CODE_DECL (addition, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L - R */ OP_CODE_DECL (substraction, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L / R */ OP_CODE_DECL (division, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L * R */ OP_CODE_DECL (multiplication, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L % R */ OP_CODE_DECL (remainder, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L << R */ OP_CODE_DECL (b_shift_left, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L >> R */ OP_CODE_DECL (b_shift_right, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L >>> R */ OP_CODE_DECL (b_shift_uright, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) // Binary bitwise operators. // Operands is a set of 32 bits @@ -164,19 +164,19 @@ OP_CODE_DECL (b_shift_uright, T_IDX_IDX_IDX, OP_CODE_DECL (b_and, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L | R */ OP_CODE_DECL (b_or, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L ^ R */ OP_CODE_DECL (b_xor, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) // Binary logical operators. // Operands are booleans. @@ -186,13 +186,13 @@ OP_CODE_DECL (b_xor, T_IDX_IDX_IDX, OP_CODE_DECL (logical_and, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) /** dst = L || R */ OP_CODE_DECL (logical_or, T_IDX_IDX_IDX, dst, var_left, - var_right); + var_right) // Assignment operators. // Assign value to LEFT operand based on value of RIGHT operand. @@ -200,133 +200,133 @@ OP_CODE_DECL (logical_or, T_IDX_IDX_IDX, /** L = R */ OP_CODE_DECL (assignment, T_IDX_IDX, value_left, - value_right); + value_right) /** L *= R */ OP_CODE_DECL (assignment_multiplication, T_IDX_IDX, value_left, - value_right); + value_right) /** L /= R */ OP_CODE_DECL (assignment_devision, T_IDX_IDX, value_left, - value_right); + value_right) /** L %= R */ OP_CODE_DECL (assignment_remainder, T_IDX_IDX, value_left, - value_right); + value_right) /** L += R */ OP_CODE_DECL (assignment_addition, T_IDX_IDX, value_left, - value_right); + value_right) /** L -= R */ OP_CODE_DECL (assignment_substruction, T_IDX_IDX, value_left, - value_right); + value_right) /** L <<= R */ OP_CODE_DECL (assignment_shift_left, T_IDX_IDX, value_left, - value_right); + value_right) /** L >>= R */ OP_CODE_DECL (assignment_shift_right, T_IDX_IDX, value_left, - value_right); + value_right) /** L >>>= R */ OP_CODE_DECL (assignment_shift_uright, T_IDX_IDX, value_left, - value_right); + value_right) /** L &= R */ OP_CODE_DECL (assignment_b_and, T_IDX_IDX, value_left, - value_right); + value_right) /** L ^= R */ OP_CODE_DECL (assignment_b_xor, T_IDX_IDX, value_left, - value_right); + value_right) /** L |= R */ OP_CODE_DECL (assignment_b_or, T_IDX_IDX, value_left, - value_right); + value_right) // Functions calls, declarations and argument handling /** name(arg1); */ OP_CODE_DECL (call_1, T_IDX_IDX, name_lit_idx, - arg1_lit_idx); + arg1_lit_idx) /** name(arg1, arg2); */ OP_CODE_DECL (call_2, T_IDX_IDX_IDX, name_lit_idx, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** name(arg1, arg2, ... */ OP_CODE_DECL (call_n, T_IDX_IDX_IDX, name_lit_idx, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** name(arg1); */ OP_CODE_DECL (func_decl_1, T_IDX_IDX, name_lit_idx, - arg1_lit_idx); + arg1_lit_idx) /** name(arg1, arg2); */ OP_CODE_DECL (func_decl_2, T_IDX_IDX_IDX, name_lit_idx, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** name(arg1, arg2, ... */ OP_CODE_DECL (func_decl_n, T_IDX_IDX_IDX, name_lit_idx, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** ..., arg1, ... */ OP_CODE_DECL (varg_1, T_IDX, - arg1_lit_idx); + arg1_lit_idx) /** ..., arg1); */ OP_CODE_DECL (varg_1_end, T_IDX, - arg1_lit_idx); + arg1_lit_idx) /** ..., arg1, arg2, ... */ OP_CODE_DECL (varg_2, T_IDX_IDX, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** ..., arg1, arg2); */ OP_CODE_DECL (varg_2_end, T_IDX_IDX, arg1_lit_idx, - arg2_lit_idx); + arg2_lit_idx) /** arg1, arg2, arg3, ... */ OP_CODE_DECL (varg_3, T_IDX_IDX_IDX, arg1_lit_idx, arg2_lit_idx, - arg3_lit_idx); + arg3_lit_idx) /** arg1, arg2, arg3); */ OP_CODE_DECL (varg_3_end, T_IDX_IDX_IDX, arg1_lit_idx, arg2_lit_idx, - arg3_lit_idx); + arg3_lit_idx) /** return value; */ OP_CODE_DECL (retval, T_IDX, - ret_value); -OP_CODE_DECL_VOID (ret); + ret_value) +OP_CODE_DECL_VOID (ret) // LOOPS // Lately, all loops should be translated into different JMPs in an optimizer. @@ -334,7 +334,7 @@ OP_CODE_DECL_VOID (ret); /** End of body of infinite loop should be ended with unconditional JMP * to loop_root (ie. next op after loop condition) */ OP_CODE_DECL (loop_inf, T_IDX, - loop_root); + loop_root) /** Numeric loop initialization. * for (start,stop,step) @@ -342,7 +342,7 @@ OP_CODE_DECL (loop_inf, T_IDX, OP_CODE_DECL (loop_init_num, T_IDX_IDX_IDX, start, stop, - step); + step) /** Check loop (condition). * if (loop cond is true) @@ -352,7 +352,7 @@ OP_CODE_DECL (loop_init_num, T_IDX_IDX_IDX, */ OP_CODE_DECL (loop_precond_begin_num, T_IDX_IDX, condition, - after_loop_op); + after_loop_op) /** i++; * Increment iterator on step and JMP to PRECOND @@ -360,33 +360,33 @@ OP_CODE_DECL (loop_precond_begin_num, T_IDX_IDX, OP_CODE_DECL (loop_precond_end_num, T_IDX_IDX_IDX, iterator, step, - precond_begin); + precond_begin) /** do {...} while (cond); * If condition is true, JMP to BODY_ROOT */ OP_CODE_DECL (loop_postcond, T_IDX_IDX, condition, - body_root); + body_root) ///** for vars...in iter, state, ctl */ //OP_CODE_DECL (loop_init, T_IDX_IDX_IDX, -// start_idx, stop_idx, step_idx); +// start_idx, stop_idx, step_idx) ///** loop (condition) */ //OP_CODE_DECL (loop_cond_pre_begin, T_IDX_IDX, -// condition, body_root); +// condition, body_root) ///** i++;*/ //OP_CODE_DECL (loop_cond_pre_end, T_IDX, -// iterator, body_root); +// iterator, body_root) // Property accessors (array, objects, strings) /** Array ops for ILMIR*/ //OP_CODE_DECL (array_copy, T_IDX_IDX, /** L = R */ -// var_left, var_right); +// var_left, var_right) //OP_CODE_DECL (array_set, T_IDX_IDX_IDX, /** array[index] = src */ -// dst, var_left, var_right); +// dst, var_left, var_right) //OP_CODE_DECL (array_get, T_IDX_IDX_IDX, /** dst = array[index] */ -// dst, array, index); +// dst, array, index) //// TODO