[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/types: Correct the definition of uintptr_t



commit 2eee1c746af6f683247700642786b7c21c991234
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Aug 1 13:36:44 2016 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 2 10:33:06 2016 +0100

    xen/types: Correct the definition of uintptr_t
    
    uintptr_t is specified as unsigned int in 32bit, not unsigned long.  This is
    why, when copying inttypes.h from GCC, the use of PRIxPTR and similar is
    broken for 32bit builds.
    
    Use __attribute__((__mode__(__pointer__))) to get the compilers default
    pointer type, which matches the pre-existing inttypes.h
    
    Fix the identified breakage with ELF_PRPTRVAL
    
    Compile tested on all architectures, with a manual printk() to trigger any
    potential -Wformat issues.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/xen/libelf.h | 10 +---------
 xen/include/xen/types.h  |  2 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h
index 95b5370..d430c83 100644
--- a/xen/include/xen/libelf.h
+++ b/xen/include/xen/libelf.h
@@ -83,15 +83,7 @@ typedef uintptr_t elf_ptrval;
 #define ELF_HANDLE_DECL(structname)          structname##_handle
   /* Provides a type declaration for a HANDLE. */
 
-#ifdef __XEN__
-# define ELF_PRPTRVAL "lx"
-  /*
-   * PRIxPTR is misdefined in xen/include/xen/inttypes.h, on 32-bit,
-   * to "x", when in fact uintptr_t is an unsigned long.
-   */
-#else
-# define ELF_PRPTRVAL PRIxPTR
-#endif
+#define ELF_PRPTRVAL PRIxPTR
   /* printf format a la PRId... for a PTRVAL */
 
 #define ELF_DEFINE_HANDLE(structname)                                   \
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index c8092d0..7bdc83b 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -59,7 +59,7 @@ typedef __u32 __be32;
 typedef __u64 __le64;
 typedef __u64 __be64;
 
-typedef unsigned long uintptr_t;
+typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
 
 typedef bool bool_t;
 #define test_and_set_bool(b)   xchg(&(b), true)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.