Skip to content

Commit 6f104da

Browse files
committed
Update to C11 coding standard
PHP 8.5 uses C11 coding standard.
1 parent c6fe385 commit 6f104da

File tree

5 files changed

+7
-44
lines changed

5 files changed

+7
-44
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PHP version](https://img.shields.io/badge/PHP-8.5-777BB4?logo=php&labelColor=17181B)](https://www.php.net/)
44
[![CMake version](https://img.shields.io/badge/CMake-3.25-064F8C?logo=cmake&labelColor=17181B)](https://cmake.org)
5-
[![C99](https://img.shields.io/badge/standard-C99-A8B9CC?logo=C&labelColor=17181B)](https://port70.net/~nsz/c/c99/n1256.html)
5+
[![C11](https://img.shields.io/badge/standard-C11-A8B9CC?logo=C&labelColor=17181B)](https://port70.net/~nsz/c/c11/n1570.html)
66
[![GNU](https://img.shields.io/badge/-GNU-A42E2B?logo=gnu&labelColor=17181B)](https://www.gnu.org/)
77
[![Ninja](https://img.shields.io/badge/%F0%9F%A5%B7-Ninja%20build-DD6620?labelColor=17181B)](https://ninja-build.org/)
88

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ project(
2222
LANGUAGES C CXX ASM
2323
)
2424

25-
set(CMAKE_C_STANDARD 99)
25+
set(CMAKE_C_STANDARD 11)
2626
set(CMAKE_C_STANDARD_REQUIRED TRUE)
2727

2828
# Configure project.

cmake/cmake/Flags.cmake

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -471,30 +471,6 @@ if(PHP_MEMORY_SANITIZER OR PHP_ADDRESS_SANITIZER OR PHP_UNDEFINED_SANITIZER)
471471
endif()
472472
endif()
473473

474-
# Check if compiler supports the -Wno-typedef-redefinition compile option. PHP
475-
# is written with C99 standard in mind, yet there is a possibility that typedef
476-
# redefinitions could happened in the source code. Since PHP CMake-based build
477-
# system also uses the CMAKE_C_STANDARD_REQUIRED (which adds the -std=...
478-
# compilation option), GCC recent versions usually ignore this and don't emit
479-
# the warnings, however Clang emits warnings that redeclaring typedef is a C11
480-
# feature. Clang has this option to turn off these warnings. As of C11, the
481-
# typedef redefinitions are valid programming, and this can be removed once a
482-
# required CMAKE_C_STANDARD 11 will be used.
483-
if(CMAKE_C_STANDARD EQUAL 99)
484-
php_check_compiler_flag(
485-
C
486-
-Wno-typedef-redefinition
487-
_HAVE_WNO_TYPEDEF_REDEFINITION
488-
)
489-
if(_HAVE_WNO_TYPEDEF_REDEFINITION)
490-
target_compile_options(
491-
php_configuration
492-
INTERFACE
493-
$<$<COMPILE_LANGUAGE:C>:-Wno-typedef-redefinition>
494-
)
495-
endif()
496-
endif()
497-
498474
################################################################################
499475
# Check linker flags.
500476
################################################################################

cmake/ext/opcache/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -260,23 +260,6 @@ if(EXT_OPCACHE_JIT)
260260
RUNTIME_OUTPUT_DIRECTORY jit/ir
261261
)
262262

263-
# Suppress typedef redefinition warnings on Clang. At time of writing, PHP is
264-
# using C99.
265-
if(CMAKE_C_STANDARD EQUAL 99)
266-
php_check_compiler_flag(
267-
C
268-
-Wno-typedef-redefinition
269-
_HAVE_WNO_TYPEDEF_REDEFINITION
270-
)
271-
if(_HAVE_WNO_TYPEDEF_REDEFINITION)
272-
target_compile_options(
273-
php_opcache_jit_generator
274-
PRIVATE
275-
$<$<COMPILE_LANGUAGE:C>:-Wno-typedef-redefinition>
276-
)
277-
endif()
278-
endif()
279-
280263
# Generate IR folding engine rules header.
281264
add_custom_command(
282265
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/jit/ir/ir_fold_hash.h

docs/evolution.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ including the removal of `aclocal.m4` in favor of the php related M4 macros in
128128

129129
## PHP 8.0 (2020)
130130

131-
PHP coding standard now use the C99 standard.
131+
PHP coding standards now use the C99 standard.
132132

133133
## 2021
134134

@@ -146,3 +146,7 @@ current Autoconf syntax for the current systems at the time. Cross-compiling was
146146
improved one step forward with cache variables synced enabling the manual
147147
overrides on many places. C preprocessor macros inconsistencies between Windows
148148
and Autotools configuration headers were synced to a nearly identical behavior.
149+
150+
## PHP 8.5 (2025)
151+
152+
PHP coding standards now use the C11 standard.

0 commit comments

Comments
 (0)