laruence/taint

build errors with clang in OS X against php 7.0-rc7

christopherowen opened this issue · 2 comments

MacBook-Pro:php-taint ~$ make
/bin/sh /Users/chris/projects/php-taint/libtool --mode=compile cc  -I. -I/Users/chris/projects/php-taint -DPHP_ATOM_INC -I/Users/chris/projects/php-taint/include -I/Users/chris/projects/php-taint/main -I/Users/chris/projects/php-taint -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/main -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/ext -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/chris/projects/php-taint/taint.c -o taint.lo 
mkdir .libs
 cc -I. -I/Users/chris/projects/php-taint -DPHP_ATOM_INC -I/Users/chris/projects/php-taint/include -I/Users/chris/projects/php-taint/main -I/Users/chris/projects/php-taint -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/main -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/ext -I/usr/local/Cellar/php70/7.0.0-rc.7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/chris/projects/php-taint/taint.c  -fno-common -DPIC -o .libs/taint.o
/Users/chris/projects/php-taint/taint.c:125:58: error: too many arguments to function call, expected 2, have 3
                if (zend_hash_get_current_data_ex(ht, (void**)&ppzval, &pos) == FAILURE) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                      ^~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_hash.h:171:1: note: 'zend_hash_get_current_data_ex' declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
^
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/main/php_config.h:6:19: note: expanded from macro 'ZEND_API'
# define ZEND_API __attribute__ ((visibility("default")))
                  ^
/Users/chris/projects/php-taint/taint.c:128:13: warning: implicit declaration of function 'Z_TYPE_PP' is invalid in C99
      [-Wimplicit-function-declaration]
        if (Z_TYPE_PP(ppzval) == IS_ARRAY) {
            ^
/Users/chris/projects/php-taint/taint.c:131:4: warning: implicit declaration of function 'Z_STRVAL_PP' is invalid in C99
      [-Wimplicit-function-declaration]
                        Z_STRVAL_PP(ppzval) = erealloc(Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) + 1 + PHP_TAINT_MAGIC_LENGTH);
                        ^
/Users/chris/projects/php-taint/taint.c:131:56: warning: implicit declaration of function 'Z_STRLEN_PP' is invalid in C99
      [-Wimplicit-function-declaration]
                        Z_STRVAL_PP(ppzval) = erealloc(Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) + 1 + PHP_TAINT_MAGIC_LENGTH);
                                                                            ^
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_alloc.h:167:51: note: expanded from macro 'erealloc'
#define erealloc(ptr, size)                                     _erealloc((ptr), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
                                                                                  ^
/Users/chris/projects/php-taint/taint.c:131:26: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *'
      [-Wint-conversion]
                        Z_STRVAL_PP(ppzval) = erealloc(Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) + 1 + PHP_TAINT_MAGIC_LENGTH);
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_alloc.h:167:43: note: expanded from macro 'erealloc'
#define erealloc(ptr, size)                                     _erealloc((ptr), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
                                                                          ^~~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_alloc.h:80:47: note: passing argument to parameter 'ptr' here
ZEND_API void*  ZEND_FASTCALL _erealloc(void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2);
                                              ^
/Users/chris/projects/php-taint/taint.c:131:24: error: expression is not assignable
                        Z_STRVAL_PP(ppzval) = erealloc(Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) + 1 + PHP_TAINT_MAGIC_LENGTH);
                        ~~~~~~~~~~~~~~~~~~~ ^
/Users/chris/projects/php-taint/taint.c:140:9: warning: implicit declaration of function 'Z_UNSET_ISREF_P' is invalid in C99
      [-Wimplicit-function-declaration]
        Z_UNSET_ISREF_P(z);
        ^
/Users/chris/projects/php-taint/taint.c:154:9: warning: implicit declaration of function 'safe_free_zval_ptr' is invalid in C99
      [-Wimplicit-function-declaration]
        safe_free_zval_ptr(z);
        ^
/Users/chris/projects/php-taint/taint.c:162:4: warning: implicit declaration of function 'Z_SET_ISREF_P' is invalid in C99
      [-Wimplicit-function-declaration]
                        Z_SET_ISREF_P(z);
                        ^
/Users/chris/projects/php-taint/taint.c:167:38: error: unknown type name 'zend_compiled_variable'; did you mean 'zend_compiler_globals'?
static void php_taint_get_cv_address(zend_compiled_variable *cv, zval ***ptr, temp_variable *Ts TSRMLS_DC) /* {{{ */ {
                                     ^~~~~~~~~~~~~~~~~~~~~~
                                     zend_compiler_globals
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_globals_macros.h:25:39: note: 'zend_compiler_globals' declared here
typedef struct _zend_compiler_globals zend_compiler_globals;
                                      ^
/Users/chris/projects/php-taint/taint.c:167:79: error: unknown type name 'temp_variable'
static void php_taint_get_cv_address(zend_compiled_variable *cv, zval ***ptr, temp_variable *Ts TSRMLS_DC) /* {{{ */ {
                                                                              ^
/Users/chris/projects/php-taint/taint.c:171:2: warning: implicit declaration of function 'zend_hash_quick_update' is invalid in C99
      [-Wimplicit-function-declaration]
        zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr);
        ^
/Users/chris/projects/php-taint/taint.c:171:54: error: no member named 'name' in 'struct _zend_compiler_globals'
        zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr);
                                                        ~~  ^
/Users/chris/projects/php-taint/taint.c:171:64: error: no member named 'name_len' in 'struct _zend_compiler_globals'
        zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr);
                                                                  ~~  ^
/Users/chris/projects/php-taint/taint.c:171:80: error: no member named 'hash_value' in 'struct _zend_compiler_globals'
        zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr);
                                                                                  ~~  ^
/Users/chris/projects/php-taint/taint.c:171:28: error: no member named 'active_symbol_table' in 'struct _zend_executor_globals'; did you mean
      'valid_symbol_table'?
        zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr);
                                  ^~~~~~~~~~~~~~~~~~~
                                  valid_symbol_table
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_globals_macros.h:46:34: note: expanded from macro 'EG'
# define EG(v) (executor_globals.v)
                                 ^
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_globals.h:212:12: note: 'valid_symbol_table' declared here
        zend_bool valid_symbol_table;
                  ^
/Users/chris/projects/php-taint/taint.c:176:9: error: no member named 'This' in 'struct _zend_executor_globals'
        if (EG(This)) {
            ~~~^~~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_globals_macros.h:46:34: note: expanded from macro 'EG'
# define EG(v) (executor_globals.v)
                                 ^
/Users/chris/projects/php-taint/taint.c:177:14: error: no member named 'This' in 'struct _zend_executor_globals'
                return &EG(This);
                        ~~~^~~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_globals_macros.h:46:34: note: expanded from macro 'EG'
# define EG(v) (executor_globals.v)
                                 ^
/Users/chris/projects/php-taint/taint.c:186:32: error: use of undeclared identifier 'IS_BOOL'
                || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
                                             ^
/Users/chris/projects/php-taint/taint.c:186:43: warning: implicit declaration of function 'Z_LVAL_PP' is invalid in C99
      [-Wimplicit-function-declaration]
                || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
                                                        ^
/Users/chris/projects/php-taint/taint.c:191:3: warning: incompatible pointer types initializing 'zval *' (aka 'struct _zval_struct *') with an
      expression of type 'zval **' (aka 'struct _zval_struct **'); dereference with * [-Wincompatible-pointer-types]
                SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/php70/7.0.0-rc.7/include/php/Zend/zend_types.h:967:9: note: expanded from macro 'SEPARATE_ZVAL_IF_NOT_REF'
                zval *_zv = (zv);                                                               \
                      ^     ~~~~
/Users/chris/projects/php-taint/taint.c:487:42: error: unknown type name 'zend_uint'
static zval * php_taint_get_zval_ptr_var(zend_uint var, const temp_variable *Ts, taint_free_op *should_free TSRMLS_DC) /* {{{ */ {
                                         ^
/Users/chris/projects/php-taint/taint.c:487:63: error: unknown type name 'temp_variable'
static zval * php_taint_get_zval_ptr_var(zend_uint var, const temp_variable *Ts, taint_free_op *should_free TSRMLS_DC) /* {{{ */ {
                                                              ^
/Users/chris/projects/php-taint/taint.c:488:14: error: expected expression
        zval *ptr = TAINT_TS(var).var.ptr;
                    ^
./php_taint.h:124:44: note: expanded from macro 'TAINT_TS'
#define TAINT_TS(offset) (*(temp_variable *)((char *)Ts + offset))
                                           ^
/Users/chris/projects/php-taint/taint.c:488:14: error: use of undeclared identifier 'temp_variable'
./php_taint.h:124:29: note: expanded from macro 'TAINT_TS'
#define TAINT_TS(offset) (*(temp_variable *)((char *)Ts + offset))
                            ^
/Users/chris/projects/php-taint/taint.c:493:41: error: unknown type name 'zend_uint'
static zval * php_taint_get_zval_ptr_cv(zend_uint var, int type TSRMLS_DC) /* {{{ */ {
                                        ^
/Users/chris/projects/php-taint/taint.c:494:17: error: no member named 'CVs' in 'struct _zend_execute_data'
        zval ***ptr = &TAINT_CV_OF(var);
                       ^~~~~~~~~~~~~~~~
./php_taint.h:120:55: note: expanded from macro 'TAINT_CV_OF'
#define TAINT_CV_OF(i)     (EG(current_execute_data)->CVs[i])
                            ~~~~~~~~~~~~~~~~~~~~~~~~  ^
/Users/chris/projects/php-taint/taint.c:497:3: error: use of undeclared identifier 'zend_compiled_variable'
                zend_compiled_variable *cv = &TAINT_CV_DEF_OF(var);
                ^
/Users/chris/projects/php-taint/taint.c:497:27: error: use of undeclared identifier 'cv'
                zend_compiled_variable *cv = &TAINT_CV_DEF_OF(var);
                                        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
10 warnings and 20 errors generated.
make: *** [taint.lo] Error 1
MacBook-Pro:php-taint chris$ cc --version
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

and then I found the php7 branch.