From: zwelch Date: Mon, 11 May 2009 04:56:37 +0000 (+0000) Subject: Audit and eliminate redundant #include directives in other target files. X-Git-Tag: v0.2.0~791 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=56504fdd7353732525e34f1e3fbd44346588f979 Audit and eliminate redundant #include directives in other target files. git-svn-id: svn://svn.berlios.de/openocd/trunk@1715 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/target/algorithm.c b/src/target/algorithm.c index c4450ac12c..a3672b201b 100644 --- a/src/target/algorithm.c +++ b/src/target/algorithm.c @@ -22,13 +22,9 @@ #endif #include "algorithm.h" - -#include "log.h" -#include "configuration.h" +#include "replacements.h" #include "binarybuffer.h" -#include - void init_mem_param(mem_param_t *param, u32 address, u32 size, enum param_direction direction) { diff --git a/src/target/avrt.c b/src/target/avrt.c index e438fcc463..d0c866b66e 100644 --- a/src/target/avrt.c +++ b/src/target/avrt.c @@ -21,26 +21,11 @@ #include "config.h" #endif -#include "replacements.h" - #include "avrt.h" - -#include "register.h" #include "target.h" -#include "log.h" -#include "jtag.h" -#include "binarybuffer.h" -#include "time_support.h" -#include "breakpoints.h" -#include "fileio.h" - -#include -#include -#include -#include -#define AVR_JTAG_INS_LEN 4 +#define AVR_JTAG_INS_LEN 4 /* cli handling */ int avr_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/avrt.h b/src/target/avrt.h index e840aaf96c..02bb00545e 100644 --- a/src/target/avrt.h +++ b/src/target/avrt.h @@ -20,6 +20,8 @@ #ifndef AVRT_H #define AVRT_H +#include "jtag.h" + typedef struct mcu_jtag_s { jtag_tap_t *tap; diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 6320d2ea83..106095cd8c 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -21,15 +21,11 @@ #include "config.h" #endif -#include - -#include "binarybuffer.h" #include "target.h" #include "log.h" -#include "types.h" - #include "breakpoints.h" + static char *breakpoint_type_strings[] = { "hardware", diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index d94e679ed6..1e36f336bb 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -33,20 +33,9 @@ #include "config.h" #endif -#include "replacements.h" - #include "cortex_a8.h" -#include "armv7m.h" - -#include "register.h" -#include "target.h" #include "target_request.h" -#include "log.h" -#include "jtag.h" -#include "arm_jtag.h" -#include -#include /* cli handling */ int cortex_a8_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 86bb07f444..4a032ee0c1 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -31,20 +31,9 @@ #include "config.h" #endif -#include "replacements.h" - #include "cortex_m3.h" -#include "armv7m.h" - -#include "register.h" -#include "target.h" #include "target_request.h" -#include "log.h" -#include "jtag.h" -#include "arm_jtag.h" -#include -#include /* cli handling */ int cortex_m3_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index 892e82641e..28f14d7a69 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -29,18 +29,6 @@ #include "embeddedice.h" -#include "armv4_5.h" -#include "arm7_9_common.h" - -#include "log.h" -#include "arm_jtag.h" -#include "types.h" -#include "binarybuffer.h" -#include "target.h" -#include "register.h" -#include "jtag.h" - -#include #if 0 static bitfield_desc_t embeddedice_comms_ctrl_bitfield_desc[] = diff --git a/src/target/embeddedice.h b/src/target/embeddedice.h index 8c4bc6f2d1..0c8329ee2a 100644 --- a/src/target/embeddedice.h +++ b/src/target/embeddedice.h @@ -26,9 +26,6 @@ #ifndef EMBEDDED_ICE_H #define EMBEDDED_ICE_H -#include "target.h" -#include "register.h" -#include "arm_jtag.h" #include "arm7_9_common.h" enum diff --git a/src/target/etb.c b/src/target/etb.c index 71514a5e17..6ad283c65b 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -21,20 +21,9 @@ #include "config.h" #endif -#include - #include "arm7_9_common.h" #include "etb.h" -#include "etm.h" - -#include "log.h" -#include "types.h" -#include "binarybuffer.h" -#include "target.h" -#include "register.h" -#include "jtag.h" -#include static char* etb_reg_list[] = { diff --git a/src/target/etb.h b/src/target/etb.h index 9c0504f5ef..e0f7dbe355 100644 --- a/src/target/etb.h +++ b/src/target/etb.h @@ -20,12 +20,6 @@ #ifndef ETB_H #define ETB_H -#include "command.h" -#include "target.h" -#include "register.h" -#include "arm_jtag.h" - -#include "etb.h" #include "etm.h" /* ETB registers */ diff --git a/src/target/etm.c b/src/target/etm.c index e8581220d5..ef21511d9c 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -21,26 +21,12 @@ #include "config.h" #endif -#include - #include "etm.h" #include "etb.h" - -#include "armv4_5.h" +#include "image.h" #include "arm7_9_common.h" #include "arm_disassembler.h" -#include "arm_simulator.h" - -#include "log.h" -#include "arm_jtag.h" -#include "types.h" -#include "binarybuffer.h" -#include "target.h" -#include "register.h" -#include "jtag.h" -#include "fileio.h" - -#include + /* ETM register access functionality * diff --git a/src/target/etm.h b/src/target/etm.h index 26e0d764dc..df31600bed 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -23,14 +23,12 @@ #ifndef ETM_H #define ETM_H -#include "image.h" #include "trace.h" -#include "target.h" -#include "register.h" #include "arm_jtag.h" - #include "armv4_5.h" +struct image_s; + /* ETM registers (V1.3 protocol) */ enum { @@ -152,7 +150,7 @@ typedef struct etm_context_s etm_portmode_t portmode; /* normal, multiplexed or demultiplexed */ etmv1_tracemode_t tracemode; /* type of information the trace contains (data, addres, contextID, ...) */ armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */ - image_t *image; /* source for target opcodes */ + struct image_s *image; /* source for target opcodes */ u32 pipe_index; /* current trace cycle */ u32 data_index; /* cycle holding next data packet */ int data_half; /* port half on a 16 bit port */ diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index ee83f172d9..ee4c3e691a 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -21,20 +21,9 @@ #include "config.h" #endif -#include - #include "etm_dummy.h" -#include "etm.h" - #include "arm7_9_common.h" -#include "log.h" -#include "types.h" -#include "binarybuffer.h" -#include "target.h" -#include "register.h" -#include "jtag.h" - -#include + static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { diff --git a/src/target/etm_dummy.h b/src/target/etm_dummy.h index a271fd4601..0e712e34e3 100644 --- a/src/target/etm_dummy.h +++ b/src/target/etm_dummy.h @@ -20,11 +20,6 @@ #ifndef ETM_DUMMY_H #define ETM_DUMMY_H -#include "command.h" -#include "target.h" -#include "register.h" -#include "arm_jtag.h" - #include "etm.h" extern etm_capture_driver_t etm_dummy_capture_driver; diff --git a/src/target/feroceon.c b/src/target/feroceon.c index ccf32d8c68..2bd2824ec8 100644 --- a/src/target/feroceon.c +++ b/src/target/feroceon.c @@ -50,11 +50,7 @@ #endif #include "arm926ejs.h" -#include "jtag.h" -#include "log.h" -#include -#include int feroceon_examine(struct target_s *target); int feroceon_target_create(struct target_s *target, Jim_Interp *interp); diff --git a/src/target/image.c b/src/target/image.c index 8a166d68f9..71939e79b9 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -27,20 +27,10 @@ #include "config.h" #endif -#include -#include -#ifdef HAVE_ELF_H -#include -#endif - #include "image.h" - -#include "types.h" -#include "replacements.h" +#include "target.h" #include "log.h" -#include "fileio.h" -#include "target.h" /* convert ELF header field to host endianness */ #define field16(elf,field)\ diff --git a/src/target/image.h b/src/target/image.h index c23cdf58aa..855cb215e7 100644 --- a/src/target/image.h +++ b/src/target/image.h @@ -26,16 +26,11 @@ #ifndef IMAGE_H #define IMAGE_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "fileio.h" #ifdef HAVE_ELF_H #include #endif -#include "replacements.h" -#include "fileio.h" -#include "target.h" #define IMAGE_MAX_ERROR_STRING (256) #define IMAGE_MAX_SECTIONS (128) @@ -85,7 +80,7 @@ typedef struct image_ihex_s typedef struct image_memory_s { - target_t *target; + struct target_s *target; u8 *cache; u32 cache_address; } image_memory_t; diff --git a/src/target/mips32.c b/src/target/mips32.c index 48e2b3427c..c109ed20ff 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -27,11 +27,7 @@ #endif #include "mips32.h" -#include "jtag.h" -#include "log.h" -#include -#include char* mips32_core_reg_list[] = { diff --git a/src/target/mips32.h b/src/target/mips32.h index 049ce8f50e..56c33faa9b 100644 --- a/src/target/mips32.h +++ b/src/target/mips32.h @@ -25,9 +25,9 @@ #include "target.h" #include "register.h" -#include "mips_ejtag.h" #include "mips32_pracc.h" + #define MIPS32_COMMON_MAGIC 0xB320B320 /* offsets into mips32 core register cache */ @@ -69,7 +69,7 @@ typedef struct mips32_common_s typedef struct mips32_core_reg_s { u32 num; - target_t *target; + struct target_s *target; mips32_common_t *mips32_common; } mips32_core_reg_t; diff --git a/src/target/mips32_dmaacc.c b/src/target/mips32_dmaacc.c index ae95dd08e0..94fcf190b8 100644 --- a/src/target/mips32_dmaacc.c +++ b/src/target/mips32_dmaacc.c @@ -26,11 +26,9 @@ #include "config.h" #endif -#include -#include "log.h" -#include "mips32.h" #include "mips32_dmaacc.h" + /* * The following logic shamelessly cloned from HairyDairyMaid's wrt54g_debrick * to support the Broadcom BCM5352 SoC in the Linksys WRT54GL wireless router diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index a5f36a9334..ff7bd86bf2 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -74,8 +74,6 @@ Nico Coesel #include "config.h" #endif -#include -#include "log.h" #include "mips32.h" #include "mips32_pracc.h" diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 0a4219f7cd..09c3aaf062 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -26,11 +26,6 @@ #include "mips32.h" #include "mips_ejtag.h" -#include "binarybuffer.h" -#include "log.h" -#include "jtag.h" - -#include int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, int new_instr, void *delete_me_and_submit_patch) { diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h index a7d5c5d788..e9d076820a 100644 --- a/src/target/mips_ejtag.h +++ b/src/target/mips_ejtag.h @@ -23,7 +23,6 @@ #ifndef MIPS_EJTAG #define MIPS_EJTAG -#include "types.h" #include "jtag.h" /* tap instructions */ diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 41b974ce5f..f29d8ec7bb 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -26,11 +26,7 @@ #include "mips32.h" #include "mips_m4k.h" #include "mips32_dmaacc.h" -#include "jtag.h" -#include "log.h" -#include -#include /* cli handling */ diff --git a/src/target/mips_m4k.h b/src/target/mips_m4k.h index ccc8e6e781..3ecb7f4feb 100644 --- a/src/target/mips_m4k.h +++ b/src/target/mips_m4k.h @@ -23,8 +23,9 @@ #ifndef MIPS_M4K_H #define MIPS_M4K_H -#include "register.h" -#include "target.h" +#include "types.h" + +struct target_s; #define MIPSM4K_COMMON_MAGIC 0xB321B321 @@ -34,7 +35,7 @@ typedef struct mips_m4k_common_s mips32_common_t mips32_common; } mips_m4k_common_t; -extern int mips_m4k_bulk_write_memory(target_t *target, u32 address, u32 count, u8 *buffer); +extern int mips_m4k_bulk_write_memory(struct target_s *target, u32 address, u32 count, u8 *buffer); extern void mips_m4k_enable_breakpoints(struct target_s *target); extern int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint); diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index 14197becee..dc96d13fc4 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -21,25 +21,14 @@ #include "config.h" #endif +// we must define _GNU_SOURCE to get strndup #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif -#include -#include #include "oocd_trace.h" -#include "etm.h" - -#include "log.h" -#include "types.h" -#include "binarybuffer.h" -#include "target.h" -#include "register.h" -#include "jtag.h" #include "arm7_9_common.h" -#include "replacements.h" -#include static int oocd_trace_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/oocd_trace.h b/src/target/oocd_trace.h index dfa6449e4e..6c3f7f922d 100644 --- a/src/target/oocd_trace.h +++ b/src/target/oocd_trace.h @@ -20,12 +20,9 @@ #ifndef OOCD_TRACE_H #define OOCD_TRACE_H -#include "command.h" - #include "etm.h" #include -#include /* registers */ enum diff --git a/src/target/register.c b/src/target/register.c index 37915eb494..f68fb69eb2 100644 --- a/src/target/register.c +++ b/src/target/register.c @@ -25,12 +25,8 @@ #endif #include "register.h" - #include "log.h" -#include "command.h" -#include -#include reg_arch_type_t *reg_arch_types = NULL; diff --git a/src/target/register.h b/src/target/register.h index e6ea09c6e5..0fcdb918d3 100644 --- a/src/target/register.h +++ b/src/target/register.h @@ -24,7 +24,6 @@ #define REGISTER_H #include "types.h" -#include "target.h" struct target_s; diff --git a/src/target/target_request.c b/src/target/target_request.c index 8d44a111ce..5618405d5f 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -27,16 +27,11 @@ #include "config.h" #endif -#include "replacements.h" -#include "log.h" -#include "target.h" #include "target_request.h" #include "binarybuffer.h" -#include "command.h" #include "trace.h" +#include "log.h" -#include -#include static command_t *target_request_cmd = NULL; static int charmsg_mode = 0; diff --git a/src/target/trace.c b/src/target/trace.c index 50f526a949..2e7d45804b 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -21,14 +21,10 @@ #include "config.h" #endif -#include "replacements.h" #include "log.h" #include "trace.h" #include "target.h" -#include "command.h" -#include -#include #include int trace_point(target_t *target, u32 number) diff --git a/src/target/trace.h b/src/target/trace.h index f0e92f94b0..92613161aa 100644 --- a/src/target/trace.h +++ b/src/target/trace.h @@ -20,10 +20,11 @@ #ifndef TRACE_H #define TRACE_H -#include "target.h" -#include "command.h" #include "types.h" +struct target_s; +struct command_context_s; + typedef struct trace_point_s { u32 address; diff --git a/src/target/xscale.c b/src/target/xscale.c index a18fe9af8d..0497a47853 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -24,29 +24,12 @@ #include "config.h" #endif -#include "replacements.h" - #include "xscale.h" - #include "arm7_9_common.h" -#include "register.h" -#include "target.h" -#include "armv4_5.h" #include "arm_simulator.h" #include "arm_disassembler.h" -#include "log.h" -#include "jtag.h" -#include "binarybuffer.h" #include "time_support.h" -#include "breakpoints.h" -#include "fileio.h" - -#include -#include - -#include -#include - +#include "image.h" /* cli handling */ int xscale_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/xscale.h b/src/target/xscale.h index 2eacb0609b..96e3fe2237 100644 --- a/src/target/xscale.h +++ b/src/target/xscale.h @@ -23,12 +23,9 @@ #ifndef XSCALE_H #define XSCALE_H -#include "target.h" -#include "register.h" #include "armv4_5.h" #include "armv4_5_mmu.h" #include "trace.h" -#include "image.h" #define XSCALE_COMMON_MAGIC 0x58534341 @@ -77,7 +74,7 @@ typedef struct xscale_trace_data_s typedef struct xscale_trace_s { trace_status_t capture_status; /* current state of capture run */ - image_t *image; /* source for target opcodes */ + struct image_s *image; /* source for target opcodes */ xscale_trace_data_t *data; /* linked list of collected trace data */ int buffer_enabled; /* whether trace buffer is enabled */ int buffer_fill; /* maximum number of trace runs to read (-1 for wrap-around) */