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:
@@ -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