Skip to content

include cleanup part 6 #10410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
985f024
Zend/zend_iterators: add include guards
MaxKellermann Jan 22, 2023
9842ad1
main/php.h: add #include directives that some extensions rely on
MaxKellermann Jan 22, 2023
919dbb9
Zend/zend_portability: include php_config.h for HAVE_*
MaxKellermann Jan 4, 2023
c28faec
Zend/zend_globals_macros: add missing includes
MaxKellermann Jan 4, 2023
911225c
Zend/Optimizer/optimize_temp_vars_5: add missing include
MaxKellermann Jan 5, 2023
207dff8
Zend/Optimizer/compact_literals: add missing include
MaxKellermann Jan 5, 2023
ed251cb
Zend/Optimizer/block_pass: add missing include
MaxKellermann Jan 5, 2023
fbbd280
Zend/Optimizer/dfa_pass: add missing include
MaxKellermann Jan 5, 2023
891acc0
ext/opcache/ZendAccelerator.h: add missing include for "INIT_FUNC_ARGS"
MaxKellermann Jan 12, 2023
2f1fa76
main: add missing includes
MaxKellermann Jan 4, 2023
6029cdf
sapi/*: add missing includes
MaxKellermann Jan 4, 2023
6476bfd
Zend/zend_build.h: include zend_config.h
MaxKellermann Jan 10, 2023
99996a3
main/php_globals.h: add missing include for PHPAPI
MaxKellermann Jan 10, 2023
32fcd43
Zend/zend_multiply: add missing includes
MaxKellermann Jan 5, 2023
f2e7190
Zend/zend_long: include zend_config.h
MaxKellermann Jan 4, 2023
87b9004
Zend/Optimizer/dce: add missing include
MaxKellermann Jan 4, 2023
acae83f
Zend/Optimizer/sccp: add missing includes
MaxKellermann Jan 4, 2023
ef046e8
Zend/zend_types: add missing include
MaxKellermann Jan 4, 2023
2cc4811
Zend/zend_inheritance: add missing include
MaxKellermann Jan 5, 2023
84f3a53
ext/opcache/zend_accelerator_hash: add missing includes
MaxKellermann Jan 16, 2023
cc80ba3
ext/opcache/shared_alloc_mmap: add missing includes for MAXPATHLEN, g…
MaxKellermann Jan 16, 2023
6df70c2
ext/opcache/shared_alloc_win32: add missing include
MaxKellermann Jan 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Zend/Optimizer/block_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Optimizer/zend_optimizer.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_API.h"
#include "zend_arena.h"
#include "zend_constants.h"
#include "zend_execute.h"
#include "zend_vm.h"
Expand Down
1 change: 1 addition & 0 deletions Zend/Optimizer/compact_literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "Optimizer/zend_optimizer.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_arena.h"
#include "zend_API.h"
#include "zend_constants.h"
#include "zend_execute.h"
Expand Down
1 change: 1 addition & 0 deletions Zend/Optimizer/dce.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Optimizer/zend_ssa.h"
#include "Optimizer/zend_func_info.h"
#include "Optimizer/zend_call_graph.h"
#include "zend_arena.h"
#include "zend_bitset.h"

/* This pass implements a form of dead code elimination (DCE). The algorithm optimistically assumes
Expand Down
1 change: 1 addition & 0 deletions Zend/Optimizer/dfa_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Optimizer/zend_optimizer.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_API.h"
#include "zend_arena.h"
#include "zend_constants.h"
#include "zend_execute.h"
#include "zend_vm.h"
Expand Down
1 change: 1 addition & 0 deletions Zend/Optimizer/optimize_temp_vars_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "Optimizer/zend_optimizer.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_arena.h"
#include "zend_API.h"
#include "zend_constants.h"
#include "zend_execute.h"
Expand Down
3 changes: 3 additions & 0 deletions Zend/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
*/

#include "zend_API.h"
#include "zend_arena.h"
#include "zend_multiply.h"
#include "zend_exceptions.h"
#include "zend_ini.h"
#include "zend_optimizer.h"
#include "zend_type_info.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "Optimizer/zend_call_graph.h"
Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_build.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#ifndef ZEND_BUILD_H
#define ZEND_BUILD_H

#ifdef PHP_WIN32
#include "config.w32.h"
#else
#include "zend_config.h"
#endif

#define ZEND_TOSTR_(x) #x
#define ZEND_TOSTR(x) ZEND_TOSTR_(x)

Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_globals_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#ifndef ZEND_GLOBALS_MACROS_H
#define ZEND_GLOBALS_MACROS_H

#include "zend_portability.h"

#ifdef ZTS
# include "TSRM.h"
#endif

typedef struct _zend_compiler_globals zend_compiler_globals;
typedef struct _zend_executor_globals zend_executor_globals;
typedef struct _zend_php_scanner_globals zend_php_scanner_globals;
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "zend.h"
#include "zend_arena.h"
#include "zend_API.h"
#include "zend_compile.h"
#include "zend_execute.h"
Expand Down
5 changes: 5 additions & 0 deletions Zend/zend_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
+----------------------------------------------------------------------+
*/

#ifndef ZEND_ITERATORS_H
#define ZEND_ITERATORS_H

/* These iterators were designed to operate within the foreach()
* structures provided by the engine, but could be extended for use
* with other iterative engine opcodes.
Expand Down Expand Up @@ -89,3 +92,5 @@ ZEND_API void zend_iterator_dtor(zend_object_iterator *iter);

ZEND_API void zend_register_iterator_wrapper(void);
END_EXTERN_C()

#endif /* ZEND_ITERATORS_H */
6 changes: 6 additions & 0 deletions Zend/zend_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#ifndef ZEND_LONG_H
#define ZEND_LONG_H

#ifdef PHP_WIN32
#include "config.w32.h"
#else
#include "zend_config.h"
#endif

#include <inttypes.h>
#include <stdint.h>

Expand Down
8 changes: 6 additions & 2 deletions Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
+----------------------------------------------------------------------+
*/

#include "zend_portability.h"

#ifndef ZEND_MULTIPLY_H
#define ZEND_MULTIPLY_H

#include "zend_long.h"
#include "zend_portability.h"
#include "zend.h"

#include <stdbool.h>

#if PHP_HAVE_BUILTIN_SMULL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG

#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
#ifndef ZEND_PORTABILITY_H
#define ZEND_PORTABILITY_H

#ifdef PHP_WIN32
#include "config.w32.h"
#else
#include "zend_config.h"
#endif

#ifdef __cplusplus
#define BEGIN_EXTERN_C() extern "C" {
#define END_EXTERN_C() }
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "zend_refcounted.h"
#include "zend_result.h"
#include "zend_type_code.h"
#include "zend_type_info.h"

#include <stdbool.h>
#include <stdint.h>
Expand Down
1 change: 1 addition & 0 deletions ext/opcache/ZendAccelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#include "zend_extensions.h"
#include "zend_compile.h"
#include "zend_modules.h"

#include "Optimizer/zend_optimizer.h"
#include "zend_accelerator_hash.h"
Expand Down
8 changes: 8 additions & 0 deletions ext/opcache/shared_alloc_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

#ifdef USE_MMAP

#if defined(__linux__)
# include "ZendAccelerator.h"
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
Expand All @@ -38,6 +42,10 @@
#include <sys/procctl.h>
#endif

#if defined(__FreeBSD__) || (defined(HAVE_PROCCTL) && defined(PROC_WXMAP_CTL))
# include <unistd.h>
#endif

#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
# define MAP_ANONYMOUS MAP_ANON
#endif
Expand Down
1 change: 1 addition & 0 deletions ext/opcache/shared_alloc_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ZendAccelerator.h"
#include "zend_shared_alloc.h"
#include "zend_accelerator_util_funcs.h"
#include "zend_accelerator_debug.h"
#include "zend_execute.h"
#include "zend_system_id.h"
#include "SAPI.h"
Expand Down
4 changes: 3 additions & 1 deletion ext/opcache/zend_accelerator_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

#include "ZendAccelerator.h"
#include "zend_accelerator_hash.h"
#include "zend_hash.h"
#include "zend_accelerator_debug.h"
#include "zend_shared_alloc.h"
#include "ZendAccelerator.h"
#include "Zend/zend_string.h"

/* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */
static const uint32_t prime_numbers[] =
Expand Down
2 changes: 2 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
#include "rfc1867.h"

#include "ext/standard/html_tables.h"

#include <float.h>
#include "main_arginfo.h"
/* }}} */

Expand Down
15 changes: 15 additions & 0 deletions main/php.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,19 @@ typedef bool zend_bool;
typedef intptr_t zend_intptr_t;
typedef uintptr_t zend_uintptr_t;

/* the following headers used to be included indirectly, and we have
* them here only for backwards compatibility with thirdparty
* extensions */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this compromise.

#include "php_globals.h"
#include "php_ini.h"
#include "zend_alloc.h"
#include "zend_arena.h"
#include "zend_iterators.h"
#include "zend_multiply.h"
#include "zend_objects.h"
#include "zend_strtod.h"
#include <errno.h>
#include <float.h>
#include <string.h>

#endif
1 change: 1 addition & 0 deletions main/php_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef PHP_GLOBALS_H
#define PHP_GLOBALS_H

#include "php.h"
#include "zend_globals.h"

#include <stdint.h>
Expand Down
3 changes: 3 additions & 0 deletions main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
# include "win32/readdir.h"
#endif

#include <errno.h>
#include <string.h>

#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC)
#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC)
#define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC)
Expand Down
3 changes: 3 additions & 0 deletions main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include <fcntl.h>
#include "php_streams_int.h"

#include <errno.h>
#include <string.h>

/* {{{ resource and registration code */
/* Global wrapper hash, copied to FG(stream_wrappers) on registration of volatile wrapper */
static HashTable url_stream_wrappers_hash;
Expand Down
3 changes: 3 additions & 0 deletions main/streams/xp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@

#ifdef AF_UNIX
#include <sys/un.h>
#include <string.h>
#endif

#include <errno.h>

#ifndef MSG_DONTWAIT
# define MSG_DONTWAIT 0
#endif
Expand Down
2 changes: 2 additions & 0 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
# include "valgrind/callgrind.h"
#endif

#include <errno.h>

#ifndef PHP_WIN32
/* XXX this will need to change later when threaded fastcgi is implemented. shane */
struct sigaction act, old_term, old_quit, old_int;
Expand Down
2 changes: 2 additions & 0 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
# include "openssl/applink.c"
#endif

#include <errno.h>

PHPAPI extern char *php_ini_opened_path;
PHPAPI extern char *php_ini_scanned_path;
PHPAPI extern char *php_ini_scanned_files;
Expand Down
3 changes: 3 additions & 0 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
#include "php_cli_process_title.h"
#include "php_cli_process_title_arginfo.h"

#include <errno.h>
#include <string.h>

#define OUTPUT_NOT_CHECKED -1
#define OUTPUT_IS_TTY 1
#define OUTPUT_NOT_TTY 0
Expand Down
3 changes: 3 additions & 0 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
#include "fpm_log.h"
#include "zlog.h"

#include <errno.h>
#include <string.h>

/* XXX this will need to change later when threaded fastcgi is implemented. shane */
struct sigaction act, old_term, old_quit, old_int;

Expand Down
2 changes: 2 additions & 0 deletions sapi/phpdbg/phpdbg_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include "phpdbg_io.h"

#include <errno.h>

ZEND_EXTERN_MODULE_GLOBALS(phpdbg)

/* is easy to generalize ... but not needed for now */
Expand Down