1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Exclude unused functions from compilation units (GH-17686)

This avoids Clang complaining with `-Wunused-function`.

We also introduce the macro `PRELOAD_SUPPORT` for clarification.
This commit is contained in:
Christoph M. Becker
2025-02-10 18:00:19 +01:00
committed by GitHub
parent 6deaaf609f
commit 650086f3e6
4 changed files with 21 additions and 1 deletions

View File

@@ -136,9 +136,15 @@ static zend_result (*orig_post_startup_cb)(void);
static zend_result accel_post_startup(void);
static zend_result accel_finish_startup(void);
#ifndef ZEND_WIN32
# define PRELOAD_SUPPORT
#endif
#ifdef PRELOAD_SUPPORT
static void preload_shutdown(void);
static void preload_activate(void);
static void preload_restart(void);
#endif
#ifdef ZEND_WIN32
# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
@@ -2713,9 +2719,11 @@ zend_result accel_activate(INIT_FUNC_ARGS)
}
zend_shared_alloc_restore_state();
#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_restart();
}
#endif
#ifdef HAVE_JIT
zend_jit_restart();
@@ -2757,9 +2765,11 @@ zend_result accel_activate(INIT_FUNC_ARGS)
zend_jit_activate();
#endif
#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_activate();
}
#endif
return SUCCESS;
}
@@ -3455,9 +3465,11 @@ void accel_shutdown(void)
return;
}
#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_shutdown();
}
#endif
_file_cache_only = file_cache_only;
@@ -3566,6 +3578,7 @@ void accelerator_shm_read_unlock(void)
}
/* Preloading */
#ifdef PRELOAD_SUPPORT
static HashTable *preload_scripts = NULL;
static zend_op_array *(*preload_orig_compile_file)(zend_file_handle *file_handle, int type);
@@ -4665,7 +4678,6 @@ static void preload_send_header(sapi_header_struct *sapi_header, void *server_co
{
}
#ifndef ZEND_WIN32
static zend_result accel_finish_startup_preload(bool in_child)
{
zend_result ret = SUCCESS;

View File

@@ -776,6 +776,7 @@ static zend_result convert_command_to_use_shell(wchar_t **cmdw, size_t cmdw_len)
}
#endif
#ifndef PHP_WIN32
/* Convert command parameter array passed as first argument to `proc_open` into command string */
static zend_string* get_command_from_array(HashTable *array, char ***argv, int num_elems)
{
@@ -807,6 +808,7 @@ static zend_string* get_command_from_array(HashTable *array, char ***argv, int n
(*argv)[i] = NULL;
return command;
}
#endif
static descriptorspec_item* alloc_descriptor_array(HashTable *descriptorspec)
{
@@ -1177,6 +1179,7 @@ static void close_all_descriptors(descriptorspec_item *descriptors, int ndesc)
}
}
#ifndef PHP_WIN32
static void efree_argv(char **argv)
{
if (argv) {
@@ -1188,6 +1191,7 @@ static void efree_argv(char **argv)
efree(argv);
}
}
#endif
/* {{{ Execute a command, with specified files used for input/output */
PHP_FUNCTION(proc_open)

View File

@@ -221,6 +221,7 @@ static void print_extensions(void) /* {{{ */
#define STDERR_FILENO 2
#endif
#ifdef PHP_WRITE_STDOUT
static inline bool sapi_cli_select(php_socket_t fd)
{
fd_set wfd;
@@ -238,6 +239,7 @@ static inline bool sapi_cli_select(php_socket_t fd)
return ret != -1;
}
#endif
PHP_CLI_API ssize_t sapi_cli_single_write(const char *str, size_t str_length) /* {{{ */
{

View File

@@ -851,6 +851,7 @@ typedef struct {
int fd;
} php_stdio_stream_data;
#ifndef _WIN32
static ssize_t phpdbg_stdiop_write(php_stream *stream, const char *buf, size_t count) {
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
@@ -877,6 +878,7 @@ static ssize_t phpdbg_stdiop_write(php_stream *stream, const char *buf, size_t c
return PHPDBG_G(php_stdiop_write)(stream, buf, count);
}
#endif
/* copied from sapi/cli/php_cli.c cli_register_file_handles */
void phpdbg_register_file_handles(void) /* {{{ */