@@ -303,7 +303,8 @@ impl State {
303303 ] ;
304304
305305 // Remove blacklist headers
306- let blacklist_prefix = vec ! [ "rte_acc_" ] ;
306+ let blacklist_prefix = vec ! [ "rte_acc_" , "rte_dmadev" , "power_" ] ;
307+ let blacklist_postfix = vec ! [ "_adaptor" , "_adapter" ] ;
307308 let mut name_set: Vec < String > = vec ! [ ] ;
308309 for file in & headers {
309310 let file_name = String :: from ( file. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ) ;
@@ -327,6 +328,12 @@ impl State {
327328 continue ' outer;
328329 }
329330 }
331+ for black in & blacklist_postfix {
332+ // println!("cargo:warning=header-name: {} {}", file_name, black);
333+ if file_name. ends_with ( black) {
334+ continue ' outer;
335+ }
336+ }
330337 // println!("cargo:warning=header-name: {}", file_name);
331338 new_vec. push ( file. clone ( ) ) ;
332339 }
@@ -404,6 +411,7 @@ impl State {
404411 let mut use_def_map = HashMap :: new ( ) ;
405412 let mut global_use_def_map = HashMap :: new ( ) ;
406413 let target_path = self . out_path . join ( "dpdk.h" ) ;
414+ let mut is_always_inline_fn: HashMap < String , bool > = HashMap :: new ( ) ;
407415 {
408416 let clang = clang:: Clang :: new ( ) . unwrap ( ) ;
409417 let index = clang:: Index :: new ( & clang, true , true ) ;
@@ -438,7 +446,61 @@ impl State {
438446 if clang:: StorageClass :: Static != storage || !( is_decl && is_inline_fn) {
439447 continue ;
440448 }
441- // println!("cargo:warning={} {} {} {:?}", name, is_decl, f.is_inline_function(), storage);
449+ // println!("cargo:warning={} {} {} {}", name, f.has_attributes(), f.is_inline_function(), f.is_const_method());
450+ let mut success = true ;
451+ let do_check;
452+ if let Some ( true ) = is_always_inline_fn. get ( & name) {
453+ do_check = false ;
454+ success = false ;
455+ } else {
456+ do_check = true ;
457+ }
458+ if do_check {
459+ success = false ;
460+ // Should check whether __always_inline is used.
461+ let test_template = self . project_path . join ( "gen/inline_test.c" ) ;
462+ let builder = cc:: Build :: new ( ) ;
463+ let compiler = builder. get_compiler ( ) ;
464+ let cc_name = compiler. path ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
465+
466+ let dpdk_include_path = self . include_path . as_ref ( ) . unwrap ( ) ;
467+ let dpdk_config_path = self . dpdk_config . as_ref ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
468+ let dpdk_include = dpdk_include_path. to_str ( ) . unwrap ( ) . to_string ( ) ;
469+ let output_include = self . out_path . to_str ( ) . unwrap ( ) . to_string ( ) ;
470+ let out_path = self . out_path . clone ( ) ;
471+
472+ let target_bin_path =
473+ out_path. join ( format ! ( "inline_test_{}" , name) ) ;
474+
475+ if target_bin_path. exists ( ) {
476+ fs:: remove_file ( target_bin_path. clone ( ) ) . unwrap ( ) ;
477+ }
478+ let ret = Command :: new ( cc_name. clone ( ) )
479+ . arg ( "-Wall" )
480+ . arg ( "-Wextra" )
481+ . arg ( "-std=c99" )
482+ . arg ( format ! ( "-I{}" , dpdk_include) )
483+ . arg ( format ! ( "-I{}" , output_include) )
484+ . arg ( "-imacros" )
485+ . arg ( dpdk_config_path)
486+ . arg ( "-march=native" )
487+ . arg ( format ! ( "-D__CHECK_FN={}" , name) )
488+ . arg ( "-o" )
489+ . arg ( target_bin_path. clone ( ) )
490+ . arg ( test_template. clone ( ) )
491+ . output ( ) ;
492+ if let Ok ( ret) = ret {
493+ if ret. status . success ( ) {
494+ success = true ;
495+ println ! ( "cargo:warning={} compile success {}" , name, success) ;
496+ }
497+ }
498+ is_always_inline_fn. insert ( name. clone ( ) , success) ;
499+ }
500+ if !success {
501+ println ! ( "cargo:warning={} compile failed" , name) ;
502+ continue ;
503+ }
442504
443505 // Extract type names in C and Rust.
444506 let c_return_type_string = return_type. get_display_name ( ) ;
0 commit comments