Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a offset_of_member() macro to util/khash.h because that's what it's used for in our cases. * Change the signature of add_debugger_command()/remove_debugger_command() on GCC > 2 to avoid the depricated conversion from string constants to char *. * Adding some "suggested" parenthesis. I know that not everyone likes that, but it pointed out at least one bug that is fixed here as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29113 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -174,9 +174,16 @@ extern void panic(const char *format, ...) _PRINTFLIKE(1, 2);
|
||||
extern void kernel_debugger(const char *message);
|
||||
extern uint64 parse_expression(const char *string);
|
||||
|
||||
#if __GNUC__ > 2
|
||||
extern int add_debugger_command(const char *name,
|
||||
debugger_command_hook hook, const char *help);
|
||||
extern int remove_debugger_command(const char *name,
|
||||
debugger_command_hook hook);
|
||||
#else
|
||||
extern int add_debugger_command(char *name, debugger_command_hook hook, char *help);
|
||||
extern int remove_debugger_command(char *name,
|
||||
debugger_command_hook hook);
|
||||
#endif
|
||||
|
||||
/* Miscellaneous */
|
||||
extern void spin(bigtime_t microseconds);
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// The use of offsetof() on non-PODs is invalid. Since many structs use
|
||||
// templated members (i.e. DoublyLinkedList) which makes them non-PODs we
|
||||
// can't use offsetof() anymore. This macro does the same, but requires an
|
||||
// instance of the object in question.
|
||||
#define offset_of_member(OBJECT, MEMBER) \
|
||||
((size_t)((char*)&OBJECT.MEMBER - (char*)&OBJECT))
|
||||
|
||||
// can be allocated on the stack
|
||||
typedef struct hash_iterator {
|
||||
|
||||
Reference in New Issue
Block a user