Skip to content

Commit 8911536

Browse files
committed
Support C23 typeof operator
The 'typeof' operator, originally a GNU extension, is now part of the C23 standard. This change enables its use in list macros where supported. Change-Id: I6a6e4e0caa4b72f16d957e0bd87722fac1915e3d
1 parent 1302947 commit 8911536

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

list.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Linux-like doubly-linked list implementation */
1+
/* Linux-like circular doubly-linked list implementation */
22

33
#pragma once
44

@@ -8,10 +8,16 @@ extern "C" {
88

99
#include <stddef.h>
1010

11-
/* "typeof" is a GNU extension.
11+
/**
12+
* Feature detection for 'typeof':
13+
* - Supported as a GNU extension in GCC/Clang.
14+
* - Part of C23 standard (ISO/IEC 9899:2024).
15+
*
1216
* Reference: https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
1317
*/
14-
#if defined(__GNUC__) || defined(__clang__)
18+
#if defined(__GNUC__) || defined(__clang__) || \
19+
(defined(__STDC__) && defined(__STDC_VERSION__) && \
20+
(__STDC_VERSION__ >= 202311L)) /* C23 ?*/
1521
#define __LIST_HAVE_TYPEOF 1
1622
#endif
1723

scripts/checksums

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
db6784ff3917888db4d1dceaa0570d99ed40e762 queue.h
2-
bfb6df45d64356868c86a7173455d39970bd0270 list.h
2+
63d8b3bcc12c521926893e0b71f0ffdfd0bbc8ca list.h
33
3bb0192cee08d165fd597a9f6fbb404533e28fcf scripts/check-commitlog.sh

0 commit comments

Comments
 (0)