summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-09-14 07:47:19 -0400
committerGitHub <noreply@github.com>2021-09-14 07:47:19 -0400
commit646bae34c9962d308ea82c5d03f5862d20fcca02 (patch)
tree75371fcd6eccf6bda1266391246f87663b0b272c
parentb6735461d9148a91cfaf4633403843aa88db9001 (diff)
parent6c53d6ab393fec13e9af8a3d9df5b74959352f4b (diff)
downloadlibgit2-646bae34c9962d308ea82c5d03f5862d20fcca02.tar.gz
Merge pull request #6041 from Esri/duncan/typeof
Use __typeof__ GNUC keyword for ISO C compatibility
-rw-r--r--src/cc-compat.h8
-rw-r--r--src/util.h2
2 files changed, 2 insertions, 8 deletions
diff --git a/src/cc-compat.h b/src/cc-compat.h
index 6bdc65145..f701b2d93 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -29,12 +29,6 @@
# endif
#endif
-#ifdef __GNUC__
-# define GIT_TYPEOF(x) (__typeof__(x))
-#else
-# define GIT_TYPEOF(x)
-#endif
-
#if defined(__GNUC__)
# define GIT_ALIGN(x,size) x __attribute__ ((aligned(size)))
#elif defined(_MSC_VER)
@@ -46,7 +40,7 @@
#if defined(__GNUC__)
# define GIT_UNUSED(x) \
do { \
- typeof(x) _unused __attribute__((unused)); \
+ __typeof__(x) _unused __attribute__((unused)); \
_unused = (x); \
} while (0)
#else
diff --git a/src/util.h b/src/util.h
index 68c2b1804..e8074fcb9 100644
--- a/src/util.h
+++ b/src/util.h
@@ -34,7 +34,7 @@
# define GIT_CONTAINER_OF(ptr, type, member) \
__builtin_choose_expr( \
__builtin_offsetof(type, member) == 0 && \
- __builtin_types_compatible_p(typeof(&((type *) 0)->member), typeof(ptr)), \
+ __builtin_types_compatible_p(__typeof__(&((type *) 0)->member), __typeof__(ptr)), \
((type *) (ptr)), \
(void)0)
#else