]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
As a library, VEX should not export the offsetof and vg_alignof
authorFlorian Krohm <florian@eich-krohm.de>
Mon, 29 Dec 2014 22:18:58 +0000 (22:18 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Mon, 29 Dec 2014 22:18:58 +0000 (22:18 +0000)
macros. The latter isn't even used by VEX.
Move them to pub_tool_basics.h.
offsetof also goes to VEX's private header main_util.h.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3049

VEX/priv/main_util.h
VEX/pub/libvex_basictypes.h

index 8904173814e460f657b652354965a6e79b08e2c3..54c20ca29bff68cf0e128d020668bc9659e885b4 100644 (file)
 #define LIKELY(x)       __builtin_expect(!!(x), 1)
 #define UNLIKELY(x)     __builtin_expect(!!(x), 0)
 
+#if !defined(offsetof)
+#   define offsetof(type,memb) ((SizeT)(HWord)&((type*)0)->memb)
+#endif
+
 /* Stuff for panicking and assertion. */
 
 #define VG__STRING(__str)  #__str
index 0bef9bb251cef72dbad9ea0a1bea189cdab4ec92..68ba30aa3f508a32af650347216020282c6257dd 100644 (file)
@@ -139,36 +139,6 @@ typedef  ULong     Addr64;
 typedef  unsigned long HWord;
 
 
-/* This is so useful it should be visible absolutely everywhere. */
-#if !defined(offsetof)
-#   define offsetof(type,memb) ((SizeT)(HWord)&((type*)0)->memb)
-#endif
-/* Our definition of offsetof is giving the same result as
-   the standard/predefined offsetof. So, we use the same name.
-   We use a prefix vg_ for vg_alignof as its behaviour slightly
-   differs from the standard alignof/gcc defined __alignof__
-*/
-
-#define vg_alignof(_type) (sizeof(struct {char c;_type _t;})-sizeof(_type))
-/* vg_alignof returns a "safe" alignement.
-   "safe" is defined as the alignment chosen by the compiler in
-   a struct made of a char followed by this type.
-
-      Note that this is not necessarily the "preferred" alignment
-      for a platform. This preferred alignment is returned by the gcc
-       __alignof__ and by the standard (in recent standard) alignof.
-      Compared to __alignof__, vg_alignof gives on some platforms (e.g.
-      amd64, ppc32, ppc64) a bigger alignment for long double (16 bytes
-      instead of 8).
-      On some platforms (e.g. x86), vg_alignof gives a smaller alignment
-      than __alignof__ for long long and double (4 bytes instead of 8). 
-      If we want to have the "preferred" alignment for the basic types,
-      then either we need to depend on gcc __alignof__, or on a (too)
-      recent standard and compiler (implementing <stdalign.h>).
-*/
-
-
-
 /* We need to know the host word size in order to write Ptr_to_ULong
    and ULong_to_Ptr in a way that doesn't cause compilers to complain.
    These functions allow us to cast pointers to and from 64-bit