GNU Binutils with patches for OS216
Revisão | 269e9c185f67d477a99574f53ead904d50fddfda (tree) |
---|---|
Hora | 2015-04-01 15:22:58 |
Autor | Mike Frysinger <vapier@gent...> |
Commiter | Mike Frysinger |
sim: m32c: enable warnings & clean up a bunch
This doesn't clean up all the warnings, just most of them.
The ones that are left will require some care to unravel.
@@ -1,3 +1,39 @@ | ||
1 | +2015-04-01 Mike Frysinger <vapier@gentoo.org> | |
2 | + | |
3 | + * configure.ac: Call SIM_AC_OPTION_WARNINGS. | |
4 | + * configure: Regenerate. | |
5 | + * cpu.h (decode_opcode, decode_r8c, decode_m32c, | |
6 | + trace_register_changes): Convert old style prototypes. | |
7 | + (m32c_dump_all_registers): New prototype. | |
8 | + * gdb-if.c: Include stdlib.h. | |
9 | + (sim_info): Delete. | |
10 | + (siggnal, handle_step): Mark static. | |
11 | + (sim_resume): Move rc decl to top of scope. | |
12 | + * load.c: Include load.h. | |
13 | + (decode_opcode); Convert old style prototype. | |
14 | + (m32c_load): Move base decl to top of scope. | |
15 | + * load.h (m32c_set_mach): Change mach type to unsigned long. | |
16 | + * m32c.opc (getbyte, decode_m32c): Convert old style prototypes. | |
17 | + (prefix): Convert old style prototype and mark static. | |
18 | + * mem.c (mem_ptr, mem_usage_stats, e, mem_get_pc, stdin_ready, | |
19 | + m32c_sim_restore_console, update_timer_a): Convert old style | |
20 | + prototypes. | |
21 | + (mem_put_byte): Mark static. | |
22 | + * mem.h (mem_get_pc, m32c_sim_restore_console): Convert old style | |
23 | + prototypes. | |
24 | + * r8c.opc (getbyte, IMM, decode_r8c): Convert old style prototypes. | |
25 | + * reg.c (stack_heap_stats, trace_register_changes, | |
26 | + m32c_dump_all_registers): Convert old style prototypes. | |
27 | + (put_reg): Move b decl to top of scope. | |
28 | + * sample2.c (start): Convert old style prototype. | |
29 | + * srcdest.c (disp8, disp16, disp24, disp20): Convert old style | |
30 | + prototypes. | |
31 | + (decode_srcdest4, decode_jumpdest): Move sd init below decls. | |
32 | + * timer_a.h (update_timer_a): Convert old style prototype. | |
33 | + * trace.c: Include trace.h. | |
34 | + (load_file_and_line): Move file decl to top of scope. | |
35 | + (sim_disasm_one): Convert old style prototype. | |
36 | + | |
1 | 37 | 2015-03-31 Mike Frysinger <vapier@gentoo.org> |
2 | 38 | |
3 | 39 | * config.in, configure: Regenerate. |
@@ -761,6 +761,9 @@ enable_sim_trace | ||
761 | 761 | enable_sim_profile |
762 | 762 | with_pkgversion |
763 | 763 | with_bugurl |
764 | +enable_werror | |
765 | +enable_build_warnings | |
766 | +enable_sim_build_warnings | |
764 | 767 | ' |
765 | 768 | ac_precious_vars='build_alias |
766 | 769 | host_alias |
@@ -1403,6 +1406,11 @@ Optional Features: | ||
1403 | 1406 | --enable-sim-stdio Specify whether to use stdio for console input/output. |
1404 | 1407 | --enable-sim-trace=opts Enable tracing flags |
1405 | 1408 | --enable-sim-profile=opts Enable profiling flags |
1409 | + --enable-werror treat compile warnings as errors | |
1410 | + --enable-build-warnings enable build-time compiler warnings if gcc is used | |
1411 | + --enable-sim-build-warnings | |
1412 | + enable SIM specific build-time compiler warnings if | |
1413 | + gcc is used | |
1406 | 1414 | |
1407 | 1415 | Optional Packages: |
1408 | 1416 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
@@ -12286,7 +12294,7 @@ else | ||
12286 | 12294 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
12287 | 12295 | lt_status=$lt_dlunknown |
12288 | 12296 | cat > conftest.$ac_ext <<_LT_EOF |
12289 | -#line 12289 "configure" | |
12297 | +#line 12297 "configure" | |
12290 | 12298 | #include "confdefs.h" |
12291 | 12299 | |
12292 | 12300 | #if HAVE_DLFCN_H |
@@ -12392,7 +12400,7 @@ else | ||
12392 | 12400 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
12393 | 12401 | lt_status=$lt_dlunknown |
12394 | 12402 | cat > conftest.$ac_ext <<_LT_EOF |
12395 | -#line 12395 "configure" | |
12403 | +#line 12403 "configure" | |
12396 | 12404 | #include "confdefs.h" |
12397 | 12405 | |
12398 | 12406 | #if HAVE_DLFCN_H |
@@ -12882,6 +12890,109 @@ sim_link_links="${sim_link_links} targ-vals.def" | ||
12882 | 12890 | |
12883 | 12891 | |
12884 | 12892 | |
12893 | + | |
12894 | +# Check whether --enable-werror was given. | |
12895 | +if test "${enable_werror+set}" = set; then : | |
12896 | + enableval=$enable_werror; case "${enableval}" in | |
12897 | + yes | y) ERROR_ON_WARNING="yes" ;; | |
12898 | + no | n) ERROR_ON_WARNING="no" ;; | |
12899 | + *) as_fn_error "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;; | |
12900 | + esac | |
12901 | +fi | |
12902 | + | |
12903 | + | |
12904 | +# Enable -Werror by default when using gcc | |
12905 | +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then | |
12906 | + ERROR_ON_WARNING=yes | |
12907 | +fi | |
12908 | + | |
12909 | +WERROR_CFLAGS="" | |
12910 | +if test "${ERROR_ON_WARNING}" = yes ; then | |
12911 | +# NOTE: Disabled in the sim dir due to most sims generating warnings. | |
12912 | +# WERROR_CFLAGS="-Werror" | |
12913 | + true | |
12914 | +fi | |
12915 | + | |
12916 | +build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ | |
12917 | +-Wpointer-sign \ | |
12918 | +-Wno-unused -Wunused-value -Wunused-function \ | |
12919 | +-Wno-switch -Wno-char-subscripts -Wmissing-prototypes | |
12920 | +-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \ | |
12921 | +-Wold-style-declaration -Wold-style-definition" | |
12922 | + | |
12923 | +# Enable -Wno-format by default when using gcc on mingw since many | |
12924 | +# GCC versions complain about %I64. | |
12925 | +case "${host}" in | |
12926 | + *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;; | |
12927 | + *) build_warnings="$build_warnings -Wformat-nonliteral" ;; | |
12928 | +esac | |
12929 | + | |
12930 | +# Check whether --enable-build-warnings was given. | |
12931 | +if test "${enable_build_warnings+set}" = set; then : | |
12932 | + enableval=$enable_build_warnings; case "${enableval}" in | |
12933 | + yes) ;; | |
12934 | + no) build_warnings="-w";; | |
12935 | + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
12936 | + build_warnings="${build_warnings} ${t}";; | |
12937 | + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
12938 | + build_warnings="${t} ${build_warnings}";; | |
12939 | + *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
12940 | +esac | |
12941 | +if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
12942 | + echo "Setting compiler warning flags = $build_warnings" 6>&1 | |
12943 | +fi | |
12944 | +fi | |
12945 | +# Check whether --enable-sim-build-warnings was given. | |
12946 | +if test "${enable_sim_build_warnings+set}" = set; then : | |
12947 | + enableval=$enable_sim_build_warnings; case "${enableval}" in | |
12948 | + yes) ;; | |
12949 | + no) build_warnings="-w";; | |
12950 | + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
12951 | + build_warnings="${build_warnings} ${t}";; | |
12952 | + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
12953 | + build_warnings="${t} ${build_warnings}";; | |
12954 | + *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
12955 | +esac | |
12956 | +if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
12957 | + echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 | |
12958 | +fi | |
12959 | +fi | |
12960 | +WARN_CFLAGS="" | |
12961 | +if test "x${build_warnings}" != x -a "x$GCC" = xyes | |
12962 | +then | |
12963 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5 | |
12964 | +$as_echo_n "checking compiler warning flags... " >&6; } | |
12965 | + # Separate out the -Werror flag as some files just cannot be | |
12966 | + # compiled with it enabled. | |
12967 | + for w in ${build_warnings}; do | |
12968 | + case $w in | |
12969 | + -Werr*) WERROR_CFLAGS=-Werror ;; | |
12970 | + *) # Check that GCC accepts it | |
12971 | + saved_CFLAGS="$CFLAGS" | |
12972 | + CFLAGS="$CFLAGS $w" | |
12973 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
12974 | +/* end confdefs.h. */ | |
12975 | + | |
12976 | +int | |
12977 | +main () | |
12978 | +{ | |
12979 | + | |
12980 | + ; | |
12981 | + return 0; | |
12982 | +} | |
12983 | +_ACEOF | |
12984 | +if ac_fn_c_try_compile "$LINENO"; then : | |
12985 | + WARN_CFLAGS="${WARN_CFLAGS} $w" | |
12986 | +fi | |
12987 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
12988 | + CFLAGS="$saved_CFLAGS" | |
12989 | + esac | |
12990 | + done | |
12991 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5 | |
12992 | +$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; } | |
12993 | +fi | |
12994 | + | |
12995 | + | |
12885 | 12996 | for ac_header in sys/select.h termios.h sys/socket.h netinet/in.h netinet/tcp.h |
12886 | 12997 | do : |
12887 | 12998 | as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` |
@@ -24,6 +24,8 @@ sinclude(../common/acinclude.m4) | ||
24 | 24 | |
25 | 25 | SIM_AC_COMMON |
26 | 26 | |
27 | +SIM_AC_OPTION_WARNINGS | |
28 | + | |
27 | 29 | AC_CHECK_HEADERS(sys/select.h termios.h sys/socket.h netinet/in.h netinet/tcp.h) |
28 | 30 | |
29 | 31 | SIM_AC_OUTPUT |
@@ -220,9 +220,11 @@ extern unsigned int heaptop; | ||
220 | 220 | extern unsigned int heapbottom; |
221 | 221 | |
222 | 222 | /* Points to one of the below functions, set by m32c_load(). */ |
223 | -extern int (*decode_opcode) (); | |
223 | +extern int (*decode_opcode) (void); | |
224 | 224 | |
225 | -extern int decode_r8c (); | |
226 | -extern int decode_m32c (); | |
225 | +extern int decode_r8c (void); | |
226 | +extern int decode_m32c (void); | |
227 | 227 | |
228 | -extern void trace_register_changes (); | |
228 | +extern void trace_register_changes (void); | |
229 | + | |
230 | +extern void m32c_dump_all_registers (void); |
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
22 | 22 | #include <stdio.h> |
23 | 23 | #include <assert.h> |
24 | 24 | #include <signal.h> |
25 | +#include <stdlib.h> | |
25 | 26 | #include <string.h> |
26 | 27 | #include <ctype.h> |
27 | 28 |
@@ -509,22 +510,14 @@ sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length) | ||
509 | 510 | return size; |
510 | 511 | } |
511 | 512 | |
512 | -void | |
513 | -sim_info (SIM_DESC sd, int verbose) | |
514 | -{ | |
515 | - check_desc (sd); | |
516 | - | |
517 | - printf ("The m32c minisim doesn't collect any statistics.\n"); | |
518 | -} | |
519 | - | |
520 | 513 | static volatile int stop; |
521 | 514 | static enum sim_stop reason; |
522 | -int siggnal; | |
515 | +static int siggnal; | |
523 | 516 | |
524 | 517 | |
525 | 518 | /* Given a signal number used by the M32C bsp (that is, newlib), |
526 | 519 | return a target signal number used by GDB. */ |
527 | -int | |
520 | +static int | |
528 | 521 | m32c_signal_to_target (int m32c) |
529 | 522 | { |
530 | 523 | switch (m32c) |
@@ -560,7 +553,7 @@ m32c_signal_to_target (int m32c) | ||
560 | 553 | |
561 | 554 | /* Take a step return code RC and set up the variables consulted by |
562 | 555 | sim_stop_reason appropriately. */ |
563 | -void | |
556 | +static void | |
564 | 557 | handle_step (int rc) |
565 | 558 | { |
566 | 559 | if (M32C_STEPPED (rc) || M32C_HIT_BREAK (rc)) |
@@ -609,6 +602,8 @@ sim_resume (SIM_DESC sd, int step, int sig_to_deliver) | ||
609 | 602 | interrupt signal handler. */ |
610 | 603 | for (;;) |
611 | 604 | { |
605 | + int rc; | |
606 | + | |
612 | 607 | if (stop) |
613 | 608 | { |
614 | 609 | stop = 0; |
@@ -617,7 +612,7 @@ sim_resume (SIM_DESC sd, int step, int sig_to_deliver) | ||
617 | 612 | break; |
618 | 613 | } |
619 | 614 | |
620 | - int rc = decode_opcode (); | |
615 | + rc = decode_opcode (); | |
621 | 616 | #ifdef TIMER_A |
622 | 617 | update_timer_a (); |
623 | 618 | #endif |
@@ -27,8 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
27 | 27 | |
28 | 28 | #include "cpu.h" |
29 | 29 | #include "mem.h" |
30 | +#include "load.h" | |
30 | 31 | |
31 | -int (*decode_opcode) () = 0; | |
32 | +int (*decode_opcode) (void) = 0; | |
32 | 33 | int default_machine = 0; |
33 | 34 | |
34 | 35 | void |
@@ -88,12 +89,13 @@ m32c_load (bfd * prog) | ||
88 | 89 | { |
89 | 90 | char *buf; |
90 | 91 | bfd_size_type size; |
92 | + bfd_vma base; | |
91 | 93 | |
92 | 94 | size = bfd_get_section_size (s); |
93 | 95 | if (size <= 0) |
94 | 96 | continue; |
95 | 97 | |
96 | - bfd_vma base = bfd_section_lma (prog, s); | |
98 | + base = bfd_section_lma (prog, s); | |
97 | 99 | if (verbose) |
98 | 100 | fprintf (stderr, "[load a=%08x s=%08x %s]\n", |
99 | 101 | (int) base, (int) size, bfd_get_section_name (prog, s)); |
@@ -23,5 +23,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
23 | 23 | |
24 | 24 | extern int default_machine; |
25 | 25 | |
26 | -void m32c_set_mach (int mach); | |
26 | +void m32c_set_mach (unsigned long mach); | |
27 | 27 | void m32c_load (bfd *); |
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
32 | 32 | #define tprintf if (trace) printf |
33 | 33 | |
34 | 34 | static unsigned char |
35 | -getbyte () | |
35 | +getbyte (void) | |
36 | 36 | { |
37 | 37 | int tsave = trace; |
38 | 38 | unsigned char b; |
@@ -105,8 +105,8 @@ IMM(int bytes) | ||
105 | 105 | |
106 | 106 | /* Indicate which sorts of prefixes are allowed for the current |
107 | 107 | opcode. */ |
108 | -void | |
109 | -prefix (src_allowed, dest_allowed, index_bytewidth) | |
108 | +static void | |
109 | +prefix (int src_allowed, int dest_allowed, int index_bytewidth) | |
110 | 110 | { |
111 | 111 | /* At the moment, we don't do anything with this information. We |
112 | 112 | just wanted to get the information entered in some |
@@ -394,7 +394,7 @@ static int pcs[16]; | ||
394 | 394 | static int ipcs = 0; |
395 | 395 | |
396 | 396 | int |
397 | -decode_m32c() | |
397 | +decode_m32c (void) | |
398 | 398 | { |
399 | 399 | unsigned char op[40]; |
400 | 400 | int opi; |
@@ -89,7 +89,7 @@ init_mem (void) | ||
89 | 89 | } |
90 | 90 | |
91 | 91 | static unsigned char * |
92 | -mem_ptr (address) | |
92 | +mem_ptr (int address) | |
93 | 93 | { |
94 | 94 | static int recursing = 0; |
95 | 95 | int pt1 = (address >> (L2_BITS + OFF_BITS)) & ((1 << L1_BITS) - 1); |
@@ -139,7 +139,7 @@ mcs (int isput, int bytes) | ||
139 | 139 | } |
140 | 140 | |
141 | 141 | void |
142 | -mem_usage_stats () | |
142 | +mem_usage_stats (void) | |
143 | 143 | { |
144 | 144 | int i, j; |
145 | 145 | int rstart = 0; |
@@ -192,7 +192,7 @@ s (int address, char *dir) | ||
192 | 192 | |
193 | 193 | #define S(d) if (trace) s(address, d) |
194 | 194 | static void |
195 | -e () | |
195 | +e (void) | |
196 | 196 | { |
197 | 197 | if (!trace) |
198 | 198 | return; |
@@ -205,7 +205,7 @@ e () | ||
205 | 205 | |
206 | 206 | extern int m32c_disassemble; |
207 | 207 | |
208 | -void | |
208 | +static void | |
209 | 209 | mem_put_byte (int address, unsigned char value) |
210 | 210 | { |
211 | 211 | unsigned char *m; |
@@ -376,7 +376,7 @@ mem_put_blk (int address, const void *bufptr, int nbytes) | ||
376 | 376 | } |
377 | 377 | |
378 | 378 | unsigned char |
379 | -mem_get_pc () | |
379 | +mem_get_pc (void) | |
380 | 380 | { |
381 | 381 | unsigned char *m = mem_ptr (regs.r_pc & membus_mask); |
382 | 382 | COUNT (0, 0); |
@@ -388,7 +388,7 @@ static int console_raw = 0; | ||
388 | 388 | static struct termios oattr; |
389 | 389 | |
390 | 390 | static int |
391 | -stdin_ready () | |
391 | +stdin_ready (void) | |
392 | 392 | { |
393 | 393 | fd_set ifd; |
394 | 394 | int n; |
@@ -403,7 +403,7 @@ stdin_ready () | ||
403 | 403 | } |
404 | 404 | |
405 | 405 | void |
406 | -m32c_sim_restore_console () | |
406 | +m32c_sim_restore_console (void) | |
407 | 407 | { |
408 | 408 | if (console_raw) |
409 | 409 | tcsetattr (m32c_console_ifd, TCSANOW, &oattr); |
@@ -557,7 +557,7 @@ sign_ext (int v, int bits) | ||
557 | 557 | |
558 | 558 | #if TIMER_A |
559 | 559 | void |
560 | -update_timer_a () | |
560 | +update_timer_a (void) | |
561 | 561 | { |
562 | 562 | if (timer_a.bsr & 1) |
563 | 563 | { |
@@ -29,7 +29,7 @@ void mem_put_si (int address, unsigned long value); | ||
29 | 29 | |
30 | 30 | void mem_put_blk (int address, const void *bufptr, int nbytes); |
31 | 31 | |
32 | -unsigned char mem_get_pc (); | |
32 | +unsigned char mem_get_pc (void); | |
33 | 33 | |
34 | 34 | unsigned char mem_get_qi (int address); |
35 | 35 | unsigned short mem_get_hi (int address); |
@@ -40,6 +40,6 @@ void mem_get_blk (int address, void *bufptr, int nbytes); | ||
40 | 40 | |
41 | 41 | int sign_ext (int v, int bits); |
42 | 42 | |
43 | -void m32c_sim_restore_console (); | |
43 | +void m32c_sim_restore_console (void); | |
44 | 44 | |
45 | 45 | extern int m32c_use_raw_console; |
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
32 | 32 | #define tprintf if (trace) printf |
33 | 33 | |
34 | 34 | static unsigned char |
35 | -getbyte () | |
35 | +getbyte (void) | |
36 | 36 | { |
37 | 37 | int tsave = trace; |
38 | 38 | unsigned char b; |
@@ -77,7 +77,7 @@ unsupported (char *tag, int orig_pc) | ||
77 | 77 | } |
78 | 78 | |
79 | 79 | static int |
80 | -IMM(bw) | |
80 | +IMM (int bw) | |
81 | 81 | { |
82 | 82 | int rv = getbyte (); |
83 | 83 | if (bw) |
@@ -306,7 +306,7 @@ static int bmcnd_cond_map[] = { | ||
306 | 306 | }; |
307 | 307 | |
308 | 308 | int |
309 | -decode_r8c() | |
309 | +decode_r8c (void) | |
310 | 310 | { |
311 | 311 | unsigned char op[40]; |
312 | 312 | int opi = 0; |
@@ -219,7 +219,7 @@ get_reg_ll (reg_id id) | ||
219 | 219 | static int highest_sp = 0, lowest_sp = 0xffffff; |
220 | 220 | |
221 | 221 | void |
222 | -stack_heap_stats () | |
222 | +stack_heap_stats (void) | |
223 | 223 | { |
224 | 224 | printf ("heap: %08x - %08x (%d bytes)\n", heapbottom, heaptop, |
225 | 225 | heaptop - heapbottom); |
@@ -230,10 +230,11 @@ stack_heap_stats () | ||
230 | 230 | void |
231 | 231 | put_reg (reg_id id, unsigned int v) |
232 | 232 | { |
233 | + reg_bank_type *b = regs.r + (FLAG_B ? 1 : 0); | |
234 | + | |
233 | 235 | if (trace > ((id != pc) ? 0 : 1)) |
234 | 236 | printf ("put_reg (%s) = %0*x\n", reg_names[id], reg_bytes[id] * 2, v); |
235 | 237 | |
236 | - reg_bank_type *b = regs.r + (FLAG_B ? 1 : 0); | |
237 | 238 | switch (id) |
238 | 239 | { |
239 | 240 | case r0: |
@@ -605,7 +606,7 @@ print_flags (int f) | ||
605 | 606 | } |
606 | 607 | |
607 | 608 | void |
608 | -trace_register_changes () | |
609 | +trace_register_changes (void) | |
609 | 610 | { |
610 | 611 | if (!trace) |
611 | 612 | return; |
@@ -646,7 +647,7 @@ trace_register_changes () | ||
646 | 647 | reg_bytes[id]*2, (unsigned int)regs.f); \ |
647 | 648 | |
648 | 649 | void |
649 | -m32c_dump_all_registers () | |
650 | +m32c_dump_all_registers (void) | |
650 | 651 | { |
651 | 652 | printf ("\033[36mREGS:"); |
652 | 653 | DRC (r[0].r_r0, "r0", r0); |
@@ -21,7 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 21 | /* See the 'sample2.x' target in Makefile.in. */ |
22 | 22 | void exit (int); |
23 | 23 | |
24 | -start () | |
24 | +void | |
25 | +start (void) | |
25 | 26 | { |
26 | 27 | foo (1, 2, 3, 4); |
27 | 28 | exit (5); |
@@ -31,7 +31,7 @@ static int src_addend = 0; | ||
31 | 31 | static int dest_addend = 0; |
32 | 32 | |
33 | 33 | static int |
34 | -disp8 () | |
34 | +disp8 (void) | |
35 | 35 | { |
36 | 36 | int rv; |
37 | 37 | int tsave = trace; |
@@ -45,7 +45,7 @@ disp8 () | ||
45 | 45 | } |
46 | 46 | |
47 | 47 | static int |
48 | -disp16 () | |
48 | +disp16 (void) | |
49 | 49 | { |
50 | 50 | int rv; |
51 | 51 | int tsave = trace; |
@@ -59,7 +59,7 @@ disp16 () | ||
59 | 59 | } |
60 | 60 | |
61 | 61 | static int |
62 | -disp24 () | |
62 | +disp24 (void) | |
63 | 63 | { |
64 | 64 | int rv; |
65 | 65 | int tsave = trace; |
@@ -73,7 +73,7 @@ disp24 () | ||
73 | 73 | } |
74 | 74 | |
75 | 75 | static int |
76 | -disp20 () | |
76 | +disp20 (void) | |
77 | 77 | { |
78 | 78 | return disp24 () & 0x000fffff; |
79 | 79 | } |
@@ -117,8 +117,6 @@ srcdest | ||
117 | 117 | decode_srcdest4 (int destcode, int bw) |
118 | 118 | { |
119 | 119 | srcdest sd; |
120 | - sd.bytes = bw ? 2 : 1; | |
121 | - sd.mem = (destcode >= 6) ? 1 : 0; | |
122 | 120 | static const char *dc_wnames[16] = { "r0", "r1", "r2", "r3", |
123 | 121 | "a0", "a1", "[a0]", "[a1]", |
124 | 122 | "disp8[a0]", "disp8[a1]", "disp8[sb]", "disp8[fb]", |
@@ -126,6 +124,9 @@ decode_srcdest4 (int destcode, int bw) | ||
126 | 124 | }; |
127 | 125 | static const char *dc_bnames[4] = { "r0l", "r0h", "r1l", "r1h" };; |
128 | 126 | |
127 | + sd.bytes = bw ? 2 : 1; | |
128 | + sd.mem = (destcode >= 6) ? 1 : 0; | |
129 | + | |
129 | 130 | if (trace) |
130 | 131 | { |
131 | 132 | const char *n = dc_wnames[destcode]; |
@@ -199,8 +200,6 @@ srcdest | ||
199 | 200 | decode_jumpdest (int destcode, int w) |
200 | 201 | { |
201 | 202 | srcdest sd; |
202 | - sd.bytes = w ? 2 : 3; | |
203 | - sd.mem = (destcode >= 6) ? 1 : 0; | |
204 | 203 | static const char *dc_wnames[16] = { "r0", "r1", "r2", "r3", |
205 | 204 | "a0", "a1", "[a0]", "[a1]", |
206 | 205 | "disp8[a0]", "disp8[a1]", "disp8[sb]", "disp8[fb]", |
@@ -208,6 +207,9 @@ decode_jumpdest (int destcode, int w) | ||
208 | 207 | }; |
209 | 208 | static const char *dc_anames[4] = { "r0l", "r0h", "r1l", "r1h" }; |
210 | 209 | |
210 | + sd.bytes = w ? 2 : 3; | |
211 | + sd.mem = (destcode >= 6) ? 1 : 0; | |
212 | + | |
211 | 213 | if (trace) |
212 | 214 | { |
213 | 215 | const char *n = dc_wnames[destcode]; |
@@ -11,4 +11,4 @@ typedef struct | ||
11 | 11 | |
12 | 12 | extern Timer_A timer_a; |
13 | 13 | |
14 | -extern void update_timer_a (); | |
14 | +extern void update_timer_a (void); |
@@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
34 | 34 | #include "cpu.h" |
35 | 35 | #include "mem.h" |
36 | 36 | #include "load.h" |
37 | +#include "trace.h" | |
37 | 38 | |
38 | 39 | static int |
39 | 40 | sim_dis_read (bfd_vma memaddr, bfd_byte * ptr, unsigned int length, |
@@ -128,6 +129,7 @@ load_file_and_line (const char *filename, int lineno) | ||
128 | 129 | int i; |
129 | 130 | struct stat s; |
130 | 131 | const char *found_filename, *slash; |
132 | + FILE *file; | |
131 | 133 | |
132 | 134 | found_filename = filename; |
133 | 135 | while (1) |
@@ -145,7 +147,7 @@ load_file_and_line (const char *filename, int lineno) | ||
145 | 147 | files = f; |
146 | 148 | f->filename = strdup (filename); |
147 | 149 | f->data = (char *) malloc (s.st_size + 2); |
148 | - FILE *file = fopen (found_filename, "rb"); | |
150 | + file = fopen (found_filename, "rb"); | |
149 | 151 | fread (f->data, 1, s.st_size, file); |
150 | 152 | f->data[s.st_size] = 0; |
151 | 153 | fclose (file); |
@@ -174,7 +176,7 @@ load_file_and_line (const char *filename, int lineno) | ||
174 | 176 | } |
175 | 177 | |
176 | 178 | void |
177 | -sim_disasm_one () | |
179 | +sim_disasm_one (void) | |
178 | 180 | { |
179 | 181 | static int initted = 0; |
180 | 182 | static asymbol **symtab = 0; |