@@ -2294,30 +2294,37 @@ ucs_thread_mode_t ucp_worker_get_thread_mode(uint64_t worker_flags)
22942294 return UCS_THREAD_MODE_SINGLE ;
22952295}
22962296
2297- static void ucp_warn_unused_uct_config ( ucp_context_h context )
2297+ static void ucp_warn_unused_config_modifications ( const ucp_context_h context )
22982298{
2299- unsigned num_unused_cached_kv = 0 ;
2300- ucs_string_buffer_t unused_cached_uct_cfg ;
2301- ucs_config_cached_key_t * key_val ;
2299+ const ucs_config_cached_key_t * key ;
2300+ ucs_string_buffer_t unused_modifications ;
2301+ unsigned num_unused_modifications ;
23022302
2303- ucs_string_buffer_init (& unused_cached_uct_cfg );
2303+ if (!context -> config .ext .warn_unused_config_modifications ) {
2304+ return ;
2305+ }
2306+
2307+ ucs_string_buffer_init (& unused_modifications );
2308+ num_unused_modifications = 0 ;
23042309
2305- ucs_list_for_each (key_val , & context -> cached_key_list , list ) {
2306- if (!key_val -> used ) {
2307- ucs_string_buffer_appendf (& unused_cached_uct_cfg , "%s=%s," ,
2308- key_val -> key , key_val -> value );
2309- ++ num_unused_cached_kv ;
2310+ ucs_list_for_each (key , & context -> cached_key_list , list ) {
2311+ if (!key -> used ) {
2312+ ucs_string_buffer_appendf (& unused_modifications , "%s=%s," , key -> key ,
2313+ key -> value );
2314+ ++ num_unused_modifications ;
23102315 }
23112316 }
23122317
2313- if (num_unused_cached_kv > 0 ) {
2314- ucs_string_buffer_rtrim (& unused_cached_uct_cfg , "," );
2315- ucs_warn ("invalid configuration%s: %s" ,
2316- (num_unused_cached_kv > 1 ) ? "s" : "" ,
2317- ucs_string_buffer_cstr (& unused_cached_uct_cfg ));
2318+ if (num_unused_modifications > 0 ) {
2319+ ucs_string_buffer_rtrim (& unused_modifications , "," );
2320+ ucs_warn ("unused configuration%s: %s\n"
2321+ "(set %s%s=n to suppress this warning)" ,
2322+ (num_unused_modifications > 1 ) ? "s" : "" ,
2323+ ucs_string_buffer_cstr (& unused_modifications ),
2324+ UCS_DEFAULT_ENV_PREFIX , UCP_WARN_UNUSED_CONFIG_MODIFICATIONS );
23182325 }
23192326
2320- ucs_string_buffer_cleanup (& unused_cached_uct_cfg );
2327+ ucs_string_buffer_cleanup (& unused_modifications );
23212328}
23222329
23232330static void
@@ -2677,8 +2684,7 @@ ucs_status_t ucp_worker_create(ucp_context_h context,
26772684 */
26782685 ucs_config_parser_print_env_vars_once (context -> config .env_prefix );
26792686
2680- /* Warn unused cached uct configuration */
2681- ucp_warn_unused_uct_config (context );
2687+ ucp_warn_unused_config_modifications (context );
26822688
26832689 ucp_worker_set_max_am_header (worker );
26842690
0 commit comments