]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
xen/public: replace typeof() with __typeof__()
authorElliott Mitchell <ehem+xen@m5p.com>
Mon, 8 Mar 2021 13:36:18 +0000 (05:36 -0800)
committerJulien Grall <jgrall@amazon.com>
Thu, 11 Mar 2021 09:51:07 +0000 (09:51 +0000)
typeof() is available in Xen's build environment, which uses Xen's
compiler.  As these headers are public, they need strict standards
conformance.  Only __typeof__() is officially standardized.

A compiler in standards conformance mode should report:

warning: implicit declaration of function 'typeof' is invalid in C99
[-Wimplicit-function-declaration]

(this has been observed with FreeBSD's kernel build environment)

Based-on-patch-by: Julien Grall <julien@xen.org>, Sun Oct 4 20:33:04 2015 +0100
Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
xen/include/public/arch-arm.h
xen/include/public/hvm/save.h
xen/include/public/io/ring.h

index c365b1b39eaa6238188aed4b3f4dd526ac482ece..713fd65317b7a8f964344adf06a9a9885926a9bf 100644 (file)
 #define XEN_GUEST_HANDLE_PARAM(name)    __guest_handle_ ## name
 #define set_xen_guest_handle_raw(hnd, val)                  \
     do {                                                    \
-        typeof(&(hnd)) _sxghr_tmp = &(hnd);                 \
+        __typeof__(&(hnd)) _sxghr_tmp = &(hnd);             \
         _sxghr_tmp->q = 0;                                  \
         _sxghr_tmp->p = val;                                \
     } while ( 0 )
index f72e3a9bc48ceb74c54fec5a1d5779c14cd0cb0e..bea5e9f50f8d5a7a8c05e7cd9f1c03dcb7db4a98 100644 (file)
@@ -82,12 +82,12 @@ struct hvm_save_descriptor {
     struct __HVM_SAVE_TYPE_##_x { _type t; char c[_code]; char cpt[1];}
 #endif
 
-#define HVM_SAVE_TYPE(_x) typeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->t)
+#define HVM_SAVE_TYPE(_x) __typeof__ (((struct __HVM_SAVE_TYPE_##_x *)(0))->t)
 #define HVM_SAVE_LENGTH(_x) (sizeof (HVM_SAVE_TYPE(_x)))
 #define HVM_SAVE_CODE(_x) (sizeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->c))
 
 #ifdef __XEN__
-# define HVM_SAVE_TYPE_COMPAT(_x) typeof (((struct __HVM_SAVE_TYPE_COMPAT_##_x *)(0))->t)
+# define HVM_SAVE_TYPE_COMPAT(_x) __typeof__ (((struct __HVM_SAVE_TYPE_COMPAT_##_x *)(0))->t)
 # define HVM_SAVE_LENGTH_COMPAT(_x) (sizeof (HVM_SAVE_TYPE_COMPAT(_x)))
 
 # define HVM_SAVE_HAS_COMPAT(_x) (sizeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->cpt)-1)
index d68615ae2f6739eecf8e0bc02519152ad9fe1f3c..6a94a9fe4b00ac1e39008811b75b16d92d84a437 100644 (file)
@@ -242,7 +242,7 @@ typedef struct __name##_back_ring __name##_back_ring_t
  */
 #define RING_COPY_REQUEST(_r, _idx, _req) do {                         \
        /* Use volatile to force the copy into _req. */                 \
-       *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx);   \
+       *(_req) = *(volatile __typeof__(_req))RING_GET_REQUEST(_r, _idx);       \
 } while (0)
 
 #define RING_GET_RESPONSE(_r, _idx)                                     \