# [Zend PATCH] zend_modules.h invalid C vs GCC 4

- Thread: https://externals.io/message/15050
- Original archive: https://news-web.php.net/php.internals/15050
- Started by Joe Orton on 2005-02-17T16:36:06+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #15050 — Joe Orton — 2005-02-17T16:36:06+00:00

URL: https://externals.io/message/15050#15050

If struct _zend_arg_info is an incomplete type, the declarations in
zend_modules.h like:

extern struct _zend_arg_info first_arg_force_ref[2];

are not valid C code (it doesn't make sense to declare an array if the
compiler does not know what size each element is, so this is not hard to
understand).

I guess this is what the Netware guys already found and why they added
the conditional include of zend_compile.h to declare the zend_arg_info
struct.  GCC 4 will also reject this code.  Any reason why this include
cannot be done unconditionally?

FYI, there are about 3000 lines of warnings in HEAD with a current GCC 4
snapshot compiled at -Wall:

http://www.apache.org/~jorton/gcc4.php-Wall.log

--- Zend/zend_modules.h	30 Oct 2004 19:27:42 -0000	1.62
+++ Zend/zend_modules.h	17 Feb 2005 16:31:21 -0000
@@ -23,10 +23,8 @@
 #define MODULES_H
 
 #include "zend.h"
-
-#ifdef NETWARE
 #include "zend_compile.h"
-#endif
+
 #define INIT_FUNC_ARGS		int type, int module_number TSRMLS_DC
 #define INIT_FUNC_ARGS_PASSTHRU	type, module_number TSRMLS_CC
 #define SHUTDOWN_FUNC_ARGS	int type, int module_number TSRMLS_DC

---

## #15054 — Andi Gutmans — 2005-02-17T19:34:47+00:00

URL: https://externals.io/message/15050#15054 · In reply to: #15050

Will take a look at that struct thingy.
As far as the warnings, a lot of the are bogus and I wouldn't want to hide 
them with explicit casting. This might hide bugs which exist. It will 
definitely be good to go through them though and see if/what needs fixing.
Thanks,
Andi

At 04:36 PM 2/17/2005 +0000, Joe Orton wrote:
>If struct _zend_arg_info is an incomplete type, the declarations in
>zend_modules.h like:
>
>extern struct _zend_arg_info first_arg_force_ref[2];
>
>are not valid C code (it doesn't make sense to declare an array if the
>compiler does not know what size each element is, so this is not hard to
>understand).
>
>I guess this is what the Netware guys already found and why they added
>the conditional include of zend_compile.h to declare the zend_arg_info
>struct.  GCC 4 will also reject this code.  Any reason why this include
>cannot be done unconditionally?
>
>FYI, there are about 3000 lines of warnings in HEAD with a current GCC 4
>snapshot compiled at -Wall:
>
>http://www.apache.org/~jorton/gcc4.php-Wall.log
>
>--- Zend/zend_modules.h 30 Oct 2004 19:27:42 -0000      1.62
>+++ Zend/zend_modules.h 17 Feb 2005 16:31:21 -0000
>@@ -23,10 +23,8 @@
>  #define MODULES_H
>
>  #include "zend.h"
>-
>-#ifdef NETWARE
>  #include "zend_compile.h"
>-#endif
>+
>  #define INIT_FUNC_ARGS         int type, int module_number TSRMLS_DC
>  #define INIT_FUNC_ARGS_PASSTHRU        type, module_number TSRMLS_CC
>  #define SHUTDOWN_FUNC_ARGS     int type, int module_number TSRMLS_DC
