Issue #3 resolved

Failed build ZTS / PHP 7.0

Remi Collet
created an issue
In file included from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:63:0:
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/eio_priv.h:31:0: warning: "TSRMLS_SET_CTX" redefined
 #    define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
 ^
In file included from /usr/include/php-zts/php/Zend/zend_portability.h:52:0,
                 from /usr/include/php-zts/php/Zend/zend_types.h:27,
                 from /usr/include/php-zts/php/Zend/zend.h:31,
                 from /usr/include/php-zts/php/main/php.h:35,
                 from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:49:
/usr/include/php-zts/php/Zend/../TSRM/TSRM.h:167:0: note: this is the location of the previous definition
 #define TSRMLS_SET_CTX(ctx)  ctx = (void ***) tsrm_get_ls_cache()
 ^
In file included from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:67:0:
./libeio/eio.c: In function 'eio__mtouch':
./libeio/eio.c:1324:8: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
     if (addr < end)
        ^
In file included from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:67:0:
./libeio/eio.c: In function 'eio__scandir':
./libeio/eio.c:1806:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
           else if (flags & EIO_READDIR_DIRS_FIRST)
                   ^
In file included from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:67:0:
./libeio/eio.c: In function 'etp_proc':
./libeio/eio.c:2197:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_new_eio_cb':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:377:34: error: 'tsrm_ls' undeclared (first use in this function)
  TSRMLS_SET_CTX(eio_cb->thread_ctx);
                                  ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:377:34: note: each undeclared identifier is reported only once for each function it appears in
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_new_eio_cb_custom':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:428:34: error: 'tsrm_ls' undeclared (first use in this function)
  TSRMLS_SET_CTX(eio_cb->thread_ctx);
                                  ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_custom_execute':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:443:10: warning: unused variable 'tsrm_ls' [-Wunused-variable]
  TSRMLS_FETCH_FROM_CTX(eio_cb ? eio_cb->thread_ctx : NULL);
          ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_res_cb_custom':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:499:10: warning: unused variable 'tsrm_ls' [-Wunused-variable]
  TSRMLS_FETCH_FROM_CTX(eio_cb ? eio_cb->thread_ctx : NULL);
          ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_res_cb':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:574:10: warning: unused variable 'tsrm_ls' [-Wunused-variable]
  TSRMLS_FETCH_FROM_CTX(eio_cb ? eio_cb->thread_ctx : NULL);
          ^
In file included from /builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:67:0:
./libeio/eio.c: In function 'eio__readahead':
./libeio/eio.c:1050:7: warning: ignoring return value of 'pread', declared with attribute warn_unused_result [-Wunused-result]
       pread (fd, eio_buf, len, offset);
       ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_done_poll_callback':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:774:2: warning: ignoring return value of 'read', declared with attribute warn_unused_result [-Wunused-result]
  read(php_eio_pipe.fd[0], buf, sizeof(buf));
  ^
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c: In function 'php_eio_want_poll_callback':
/builddir/build/BUILD/php-pecl-eio-2.0.0/ZTS/php7/php_eio.c:764:3: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
   write(php_eio_pipe.fd[1], &counter, (php_eio_pipe.len = 8));
   ^
Makefile:193: recipe for target 'php7/php_eio.lo' failed

Comments (5)

  1. Ruslan Osmanov repo owner

    I see that my own definitions of TSRMLS_FETCH_FROM_CTX and TSRMLS_SET_CTX should be removed, because they are defined in TSRM/TSRM.h But should I use the macros at all? TSRMLS_CC, TSRMLS_C etc. are empty strings, so where do I pass the tsrm_ls variable fetched by TSRMLS_FETCH_FROM_CTX?

    The only ext. bundled with PHP using TSRMLS_FETCH_FROM_CTX is interbase: https://github.com/php/php-src/blob/master/ext/interbase/ibase_events.c#L202 The macro expands to

    void ***tsrm_ls = (void ***) event->thread_ctx;
    

    Then nothing uses the tsrm_ls variable, as far as I can see.

    Maybe, just to hell tsrmls fetches and restores. Yes, the callbacks are called asynchronously. But it seems it has nothing to do with PHP TSRM, has it?

  2. Remi Collet reporter

    IIRC the macro were only used to save/restore tsrm_ls for perf (instead of TSRMS_FETCH). As this is not needed anymore, a big cleanup is possible ;)

    See PR #4

  3. Log in to comment