multipath-tools: replace 64bit archs macros by __LP64__
PATCH 1/1 multipath-tools: replace 64bit archs macros by __LP64__
Rationale: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
__LP64___LP64
These macros are defined, with value 1, if (and only if) the compilation is for a target where long int and pointer both use 64-bits and int uses 32-bit.
--- kpartx/lopart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kpartx/lopart.c +3 -4
@@ -38,11 +38,10 @@#define LOOP_CTL_GET_FREE 0x4C82#endif -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \ - && !defined (__s390x__) -#define int2ptr (x) ((void *) ((int) x)) -#else +#if defined (__LP64__)#define int2ptr (x) ((void *) ((long) x)) +#else +#define int2ptr (x) ((void *) ((int) x))#endif static char *
Signature · 1 line
2.13.0
Quoted 24 lines · Xose Vazquez Perez
Rationale: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
__LP64___LP64
These macros are defined, with value 1, if (and only if) the compilation is for a target where long int and pointer both use 64-bits and int uses 32-bit.Cc Christophe Varoqui <[email protected]>Cc device-mapper development <[email protected]>Signed-off-by Xose Vazquez Perez <[email protected]>--- kpartx/lopart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)kpartx/lopart.c +0
-1@@ -38,11 +38,10 @@#define LOOP_CTL_GET_FREE 0x4C82#endif -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \
kpartx/lopart.c line 47
Quoted 10 lines
kpartx/lopart.c +3
-3- && !defined (__s390x__) -#define int2ptr (x) ((void *) ((int) x)) -#else +#if defined (__LP64__)#define int2ptr (x) ((void *) ((long) x)) +#else +#define int2ptr (x) ((void *) ((int) x))#endif static char *
Hello Xose,
Since there is only one user of int2ptr(), please remove the macro definitions and use the following construct: (void *)(uintptr_t)(...).
Thanks,
Bart.
Quoted 34 lines · Bart Van Assche
Quoted 33 lines · Xose Vazquez Perez
Rationale: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
__LP64___LP64
These macros are defined, with value 1, if (and only if) the compilation is for a target where long int and pointer both use 64-bits and int uses 32-bit.Cc Christophe Varoqui <[email protected]>Cc device-mapper development <[email protected]>Signed-off-by Xose Vazquez Perez <[email protected]>--- kpartx/lopart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)kpartx/lopart.c +3
-4@@ -38,11 +38,10 @@#define LOOP_CTL_GET_FREE 0x4C82#endif -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \ - && !defined (__s390x__) -#define int2ptr (x) ((void *) ((int) x)) -#else +#if defined (__LP64__)#define int2ptr (x) ((void *) ((long) x)) +#else +#define int2ptr (x) ((void *) ((int) x))#endif
Quoted 6 lines
kpartx/lopart.c line 47
Quoted 1 line
kpartx/lopart.c +0
-0static char *Hello Xose,
Since there is only one user of
int2ptr(), please remove the macro definitions and use the following construct: (void *)(uintptr_t)(...).
No time for a proper patch, use it as an interim fix.
Quoted 5 lines · Xose Vazquez Perez
Quoted 2 lines · Bart Van Assche
Since there is only one user of
int2ptr(), please remove the macro definitions and use the following construct: (void *)(uintptr_t)(...).No time for a proper patch, use it as an interim fix.
Hello Jose,
I will post a patch to remove int2ptr().
Bart.