On Tue, Aug 30, 2011 at 9:25 PM, Eric Wetzel <thewet...@gmail.com> wrote:
> On the discussion of style, I mentioned that the Linux coding standard > doesn't really like typedefs. Here is an article from Greg K-H that > partially addresses the subject: > http://www.linuxjournal.com/article/5780?page=0,2 > > I don't really like typedefs either, so I started writing a script > called 'detypedefifier' that will remove typedefs. So far, it only > finds them, but I found and removed a good portion of the typedefs. > The ones that remain are either function pointer typedefs, have > far-reaching consequences, or are generally in places I don't really > want to touch right now. Here is a list of the non-function pointer > typedefs that remain after my patches: > src/flash/mflash.h: > Simple typedef: mg_io_uint32 => unsigned long > Simple typedef: mg_io_uint16 => unsigned short > Simple typedef: mg_io_uint8 => unsigned char > These are probably supposed to be roll-your-own fixed-width types. If the mflash code depends on these actually being fixed-width, it is broken as it is. Unless someone who knows the mflash code objects, these should be replaced with standard uintX_t types. > > src/helper/types.h: > Simple typedef: _Bool => int > Simple typedef: _Bool => bool > Simple typedef: intptr_t => CYG_ADDRWORD > Simple typedef: intmax_t => int64_t > Simple typedef: uintmax_t => uint64_t > These are compatibility typedefs, don't touch them. > > src/jtag/drivers/OpenULINK/include/shorttypes.h: > Simple typedef: s8 => int8_t > Simple typedef: s16 => int16_t > Simple typedef: s32 => int32_t > Simple typedef: u8 => uint8_t > Simple typedef: u16 => uint16_t > Simple typedef: u32 => uint32_t > Ok, the standard types are unnecessarily long, but they're standard. I always disliked the idea of introducing new typedefs even if it saves 4 or 5 characters per declaration. Wouldn't mind getting rid of these even though there's an exception for them in the kernel style guide. src/jtag/jtag.h: > Simple typedef: jtag_callback_data_t => intptr_t > src/rtos/rtos.h: > Simple typedef: threadid_t => int64_t > Simple typedef: symbol_address_t => int64_t > Possibly these falls under the one of the kernel style guide exceptions, but I haven't checked their usage. Regarding the patches, the ELF types in replacements.h (and their usage in image.c) should be left as is, because they are replacements for a system header. /Andreas
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development