11use bindgen:: callbacks:: IntKind ;
2- use rustc_version:: version_meta;
32use std:: collections:: HashSet ;
43use std:: path:: Path ;
54use std:: path:: PathBuf ;
@@ -301,18 +300,8 @@ fn generate_bindings(php_config_includes: &str, fibers: bool, zend_error_observe
301300 . expect ( "bindings to be written successfully" ) ;
302301}
303302
304- // See https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
305- // We can remove this when we're on Rust 1.80+.
306- fn has_check_cfg ( ) -> bool {
307- let meta = version_meta ( ) . unwrap ( ) ;
308- assert_eq ! ( 1 , meta. semver. major) ;
309- meta. semver . minor >= 80
310- }
311-
312303fn cfg_post_startup_cb ( vernum : u64 ) -> bool {
313- if has_check_cfg ( ) {
314- println ! ( "cargo::rustc-check-cfg=cfg(php_post_startup_cb)" ) ;
315- }
304+ println ! ( "cargo::rustc-check-cfg=cfg(php_post_startup_cb)" ) ;
316305 if vernum >= 70300 {
317306 println ! ( "cargo:rustc-cfg=php_post_startup_cb" ) ;
318307 true
@@ -322,9 +311,7 @@ fn cfg_post_startup_cb(vernum: u64) -> bool {
322311}
323312
324313fn cfg_preload ( vernum : u64 ) -> bool {
325- if has_check_cfg ( ) {
326- println ! ( "cargo::rustc-check-cfg=cfg(php_preload)" ) ;
327- }
314+ println ! ( "cargo::rustc-check-cfg=cfg(php_preload)" ) ;
328315 if vernum >= 70400 {
329316 println ! ( "cargo:rustc-cfg=php_preload" ) ;
330317 true
@@ -334,9 +321,7 @@ fn cfg_preload(vernum: u64) -> bool {
334321}
335322
336323fn cfg_run_time_cache ( vernum : u64 ) -> bool {
337- if has_check_cfg ( ) {
338- println ! ( "cargo::rustc-check-cfg=cfg(php_run_time_cache)" ) ;
339- }
324+ println ! ( "cargo::rustc-check-cfg=cfg(php_run_time_cache)" ) ;
340325 if vernum >= 80000 {
341326 println ! ( "cargo:rustc-cfg=php_run_time_cache" ) ;
342327 true
@@ -350,9 +335,7 @@ fn cfg_trigger_time_sample() -> bool {
350335}
351336
352337fn cfg_zend_error_observer ( vernum : u64 ) -> bool {
353- if has_check_cfg ( ) {
354- println ! ( "cargo::rustc-check-cfg=cfg(zend_error_observer, zend_error_observer_80)" ) ;
355- }
338+ println ! ( "cargo::rustc-check-cfg=cfg(zend_error_observer, zend_error_observer_80)" ) ;
356339 if vernum >= 80000 {
357340 println ! ( "cargo:rustc-cfg=zend_error_observer" ) ;
358341 if vernum < 80100 {
@@ -365,9 +348,7 @@ fn cfg_zend_error_observer(vernum: u64) -> bool {
365348}
366349
367350fn cfg_php_major_version ( vernum : u64 ) {
368- if has_check_cfg ( ) {
369- println ! ( "cargo::rustc-check-cfg=cfg(php7, php8)" ) ;
370- }
351+ println ! ( "cargo::rustc-check-cfg=cfg(php7, php8)" ) ;
371352
372353 let major_version = match vernum {
373354 70000 ..=79999 => 7 ,
@@ -383,9 +364,7 @@ fn cfg_php_major_version(vernum: u64) {
383364}
384365
385366fn cfg_fibers ( vernum : u64 ) -> bool {
386- if has_check_cfg ( ) {
387- println ! ( "cargo::rustc-check-cfg=cfg(php_has_fibers)" ) ;
388- }
367+ println ! ( "cargo::rustc-check-cfg=cfg(php_has_fibers)" ) ;
389368 if vernum >= 80100 {
390369 println ! ( "cargo:rustc-cfg=php_has_fibers" ) ;
391370 true
@@ -395,9 +374,7 @@ fn cfg_fibers(vernum: u64) -> bool {
395374}
396375
397376fn cfg_php_feature_flags ( vernum : u64 ) {
398- if has_check_cfg ( ) {
399- println ! ( "cargo::rustc-check-cfg=cfg(php_gc_status, php_zend_compile_string_has_position, php_gc_status_extended, php_frameless, php_opcache_restart_hook, php_zend_mm_set_custom_handlers_ex)" ) ;
400- }
377+ println ! ( "cargo::rustc-check-cfg=cfg(php_gc_status, php_zend_compile_string_has_position, php_gc_status_extended, php_frameless, php_opcache_restart_hook, php_zend_mm_set_custom_handlers_ex)" ) ;
401378
402379 if vernum >= 70300 {
403380 println ! ( "cargo:rustc-cfg=php_gc_status" ) ;
@@ -416,9 +393,7 @@ fn cfg_php_feature_flags(vernum: u64) {
416393}
417394
418395fn cfg_zts ( ) {
419- if has_check_cfg ( ) {
420- println ! ( "cargo::rustc-check-cfg=cfg(php_zts)" ) ;
421- }
396+ println ! ( "cargo::rustc-check-cfg=cfg(php_zts)" ) ;
422397
423398 let output = Command :: new ( "php-config" )
424399 . arg ( "--include-dir" )
0 commit comments