Bug #79576 [Opn->Fbk]: "const TYPE *" is not parsed properly when type is not defined

From: Date: Fri, 08 May 2020 19:11:45 +0000
Subject: Bug #79576 [Opn->Fbk]: "const TYPE *" is not parsed properly when type is not defined
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226968@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79576&edit=1 ID: 79576 Updated by: nikic@php.net Reported by: grzegorz129 at gmail dot com Summary: "const TYPE *" is not parsed properly when type is not defined -Status: Open +Status: Feedback Type: Bug Package: *Extensibility Functions Operating System: macOS 10.15.4 PHP Version: 7.4.5 Block user comment: N Private report: N New Comment: Is the "bug" here that the error message should be improved? GCC reports this as: > test.c:4:29: error: unknown type name ‘oid’ which is more obvious. Previous Comments: ------------------------------------------------------------------------ [2020-05-08 18:52:12] grzegorz129 at gmail dot com Description: ------------ When parsing function declarations containing "const CUSTOM_TYPE *" the FFI modules wrongly states that unsupported specifier combination was used. When type is properly defined the FFI module is able to parse them without a problem. Test script: --------------- <?php //Result: no error \FFI::cdef(' typedef unsigned long u_long; typedef u_long oid; struct tree *get_tree(const oid *, size_t, struct tree *); '); //vs. //Result: FFI\ParserException: unsupported type specifier combination at line 1 \FFI::cdef('struct tree *get_tree(const oid *, size_t, struct tree *);'); Expected result: ---------------- FFI\ParserException: undefined C type 'oid' Actual result: -------------- FFI\ParserException: unsupported type specifier combination ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79576&edit=1

« previous php.bugs (#226968) next »