[13/25] libdw: typeof -> __typeof that can be recognized by both clang-cl and gcc

Message ID 20221020182603.815-14-luoyonggang@gmail.com
State Committed
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Oct. 20, 2022, 6:25 p.m. UTC
  Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 libdw/memory-access.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Mark Wielaard Dec. 12, 2022, 1:12 p.m. UTC | #1
Hi,

We seem to use __typeof everywhere except in memory-access.h. So this
seems like an OK change.

Added a ChangeLog entry and pushed as:

commit 78dd3b32edf55fc8bdc6268163d5d743a84b1075
Author: Yonggang Luo <luoyonggang@gmail.com>
Date:   Fri Oct 21 02:25:52 2022 +0800

    libdw: Change typeof -> __typeof in memory-access.h
    
    Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>

Thanks,

Mark
  

Patch

diff --git a/libdw/memory-access.h b/libdw/memory-access.h
index 16c8c851..fca4129a 100644
--- a/libdw/memory-access.h
+++ b/libdw/memory-access.h
@@ -64,7 +64,7 @@  __libdw_max_len_sleb128 (const unsigned char *addr, const unsigned char *end)
 #define get_uleb128_step(var, addr, nth)				      \
   do {									      \
     unsigned char __b = *(addr)++;					      \
-    (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7);		      \
+    (var) |= (__typeof (var)) (__b & 0x7f) << ((nth) * 7);		      \
     if (likely ((__b & 0x80) == 0))					      \
       return (var);							      \
   } while (0)
@@ -112,11 +112,11 @@  __libdw_get_uleb128_unchecked (const unsigned char **addrp)
 #define get_sleb128_step(var, addr, nth)				      \
   do {									      \
     unsigned char __b = *(addr)++;					      \
-    (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7);		      \
+    (var) |= (__typeof (var)) (__b & 0x7f) << ((nth) * 7);		      \
     if (likely ((__b & 0x80) == 0))					      \
       {									      \
 	if ((__b & 0x40) != 0)						      \
-	  (var) |= - ((typeof (var)) 1 << (((nth) + 1) * 7));		      \
+	  (var) |= - ((__typeof (var)) 1 << (((nth) + 1) * 7));		      \
 	return (var);							      \
       }									      \
   } while (0)
@@ -146,7 +146,7 @@  __libdw_get_sleb128 (const unsigned char **addrp, const unsigned char *end)
     {
       /* We only need the low bit of the final byte, and as it is the
 	 sign bit, we don't need to do anything else here.  */
-      acc |= ((typeof (acc)) b) << 7 * max;
+      acc |= ((__typeof (acc)) b) << 7 * max;
       return acc;
     }
 
@@ -179,7 +179,7 @@  __libdw_get_sleb128_unchecked (const unsigned char **addrp)
     {
       /* We only need the low bit of the final byte, and as it is the
 	 sign bit, we don't need to do anything else here.  */
-      acc |= ((typeof (acc)) b) << 7 * max;
+      acc |= ((__typeof (acc)) b) << 7 * max;
       return acc;
     }