Skip to content

Commit 3bc4c9c

Browse files
committed
Add include guard to php_config.h/config.w32.h
Header inclusion guard was added upstream in PHP 8.5. This syncs it with upstream except in CMake also PHP 8.3 and 8.4 are guarded for multiple inclusions.
1 parent 4c27b0d commit 3bc4c9c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cmake/main/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,11 @@ endfunction()
311311
# Configure main configuration header (php_config.h, config.w32.h).
312312
function(_php_main_configure_php_config)
313313
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
314+
set(PHP_CONFIG_HEADER_GUARD "CONFIG_W32_H")
314315
set(PHP_CONFIG_H_WINDOWS 1)
315316
set(file config.w32.h)
316317
else()
318+
set(PHP_CONFIG_HEADER_GUARD "PHP_CONFIG_H")
317319
set(PHP_CONFIG_H_WINDOWS 0)
318320
set(file php_config.h)
319321
set(HAVE_BUILD_DEFS_H TRUE)

cmake/main/cmake/php_config.h.in

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#if !defined(PHP_CONFIG_H) || @PHP_CONFIG_H_WINDOWS@
1+
#ifndef @PHP_CONFIG_HEADER_GUARD@
2+
#define @PHP_CONFIG_HEADER_GUARD@
23

34
#if @PHP_CONFIG_H_WINDOWS@
45
/* Define the minimum supported version */
@@ -28,8 +29,6 @@
2829
# define STDOUT_FILENO 1
2930
# define STDERR_FILENO 2
3031
#else
31-
# define PHP_CONFIG_H
32-
3332
# if defined(__GNUC__) && __GNUC__ >= 4
3433
# define ZEND_API __attribute__ ((visibility("default")))
3534
# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
@@ -730,4 +729,4 @@
730729
# include <string.h>
731730
#endif
732731

733-
#endif /* PHP_CONFIG_H */
732+
#endif /* @PHP_CONFIG_HEADER_GUARD@ */

0 commit comments

Comments
 (0)