On Sun, 2009-05-31 at 16:37 -0700, Zach Welch wrote:
> Hi all,
>
> The following things nagged at me when I did the target_type clean-up:
>
> 1) Remove redundant structure typedefs:
> a) Entails the following steps (for each named struct "type"):
> i) s/^typedef struct type_s/struct type_s/
> ii) s/^} type_t;/};/
> iii) s/type_t/struct type_s/
> iv) Fix any messes that these commands miss or make. ;)
> b) Eliminates what are essentially duplicated symbols:
> - simplifies the Doxygen documentation tremendously.
> - eliminates style ambiguity and forward referencing.
[snip]
> I will post patches to clean-up and removal of jtag_tap_t in reply to
> this thread, to provide better foundation for concrete discussion about
> issue #1. While I think this would help the code and documentation a
> lot, I would even go further to suggest "s/_s//" from all struct names.
Here is the first patch to remove the forward declaration. I can't
figure out why I am not getting warnings with this, without adding
forward declarations for the struct in various places.
I found some problems with the other patch and have been too distracted
to fix it, but I wanted to get this one out to the list for review and
feedback about the expected-but-strangely-absent warnings.
Cheers,
Zach
Index: src/helper/types.h
===================================================================
--- src/helper/types.h (revision 1970)
+++ src/helper/types.h (working copy)
@@ -46,8 +46,6 @@
typedef unsigned long long u64;
#endif
-typedef struct jtag_tap_s jtag_tap_t;
-
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#else /* HAVE_STDBOOL_H */
Index: src/jtag/jtag.h
===================================================================
--- src/jtag/jtag.h (revision 1970)
+++ src/jtag/jtag.h (working copy)
@@ -263,7 +263,7 @@
typedef struct scan_field_s
{
- jtag_tap_t* tap; /* tap pointer this instruction refers to */
+ struct jtag_tap_s *tap; /* tap pointer this instruction refers to */
int num_bits; /* number of bits this field specifies (up to 32) */
u8* out_value; /* value to be scanned into the device */
u8* in_value; /* pointer to a 32-bit memory location to take data scanned out */
@@ -368,7 +368,7 @@
/* this is really: typedef jtag_tap_t */
/* But - the typedef is done in "types.h" */
/* due to "forward decloration reasons" */
-struct jtag_tap_s
+typedef struct jtag_tap_s
{
const char* chip;
const char* tapname;
@@ -388,8 +388,8 @@
jtag_tap_event_action_t* event_action;
- jtag_tap_t* next_tap;
-};
+ struct jtag_tap_s *next_tap;
+} jtag_tap_t;
extern jtag_tap_t* jtag_AllTaps(void);
extern jtag_tap_t* jtag_TapByPosition(int n);
extern jtag_tap_t* jtag_TapByString(const char* dotted_name);
Index: src/target/xscale.h
===================================================================
--- src/target/xscale.h (revision 1970)
+++ src/target/xscale.h (working copy)
@@ -32,7 +32,7 @@
typedef struct xscale_jtag_s
{
/* position in JTAG scan chain */
- jtag_tap_t *tap;
+ struct jtag_tap_s *tap;
/* IR length and instructions */
int ir_length;
Index: src/target/target.h
===================================================================
--- src/target/target.h (revision 1971)
+++ src/target/target.h (working copy)
@@ -117,7 +117,7 @@
target_type_t *type; /* target type definition (name, access functions) */
const char *cmd_name; /* tcl Name of target */
int target_number; /* generaly, target index but may not be in order */
- jtag_tap_t *tap; /* where on the jtag chain is this */
+ struct jtag_tap_s *tap; /* where on the jtag chain is this */
const char *variant; /* what varient of this chip is it? */
target_event_action_t *event_action;
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development