Skip to content

Commit 363e8dd

Browse files
committed
Support for __restrict and few GCC attributes
1 parent 984d05f commit 363e8dd

File tree

3 files changed

+53
-45
lines changed

3 files changed

+53
-45
lines changed

ext/ffi/ffi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5946,6 +5946,12 @@ void zend_ffi_add_attribute(zend_ffi_dcl *dcl, const char *name, size_t name_len
59465946
/* ignore */
59475947
} else if (name_len == sizeof("deprecated")-1 && memcmp(name, "deprecated", sizeof("deprecated")-1) == 0) {
59485948
/* ignore */
5949+
} else if (name_len == sizeof("__nothrow__")-1 && memcmp(name, "__nothrow__", sizeof("__nothrow__")-1) == 0) {
5950+
/* ignore */
5951+
} else if (name_len == sizeof("__leaf__")-1 && memcmp(name, "__leaf__", sizeof("__leaf__")-1) == 0) {
5952+
/* ignore */
5953+
} else if (name_len == sizeof("__malloc__")-1 && memcmp(name, "__malloc__", sizeof("__malloc__")-1) == 0) {
5954+
/* ignore */
59495955
} else {
59505956
zend_ffi_parser_error("unsupported attribute '%.*s' at line %d", name_len, name, FFI_G(line));
59515957
}

ext/ffi/ffi.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ type_qualifier(zend_ffi_dcl *dcl):
158158
("const"|"__const"|"__const__")
159159
{dcl->flags |= ZEND_FFI_DCL_CONST;}
160160
{dcl->attr |= ZEND_FFI_ATTR_CONST;}
161-
| ("restrict"|"__restict"|"__restrict__")
161+
| ("restrict"|"__restrict"|"__restrict__")
162162
{dcl->flags |= ZEND_FFI_DCL_RESTRICT;}
163163
| ("volatile"|"__volatile"|"__volatile__")
164164
{dcl->flags |= ZEND_FFI_DCL_VOLATILE;}

0 commit comments

Comments
 (0)