@@ -1699,22 +1699,27 @@ generate_BLOBAPPEND(cctx_T *cctx)
16991699 * "profile" indicates profiling is to be done.
17001700 */
17011701 int
1702- func_needs_compiling (ufunc_T * ufunc , int profile )
1702+ func_needs_compiling (ufunc_T * ufunc , int profile UNUSED )
17031703{
17041704 switch (ufunc -> uf_def_status )
17051705 {
1706- case UF_NOT_COMPILED : return FALSE ;
1706+ case UF_NOT_COMPILED : break ;
17071707 case UF_TO_BE_COMPILED : return TRUE;
17081708 case UF_COMPILED :
17091709 {
1710+ #ifdef FEAT_PROFILE
17101711 dfunc_T * dfunc = ((dfunc_T * )def_functions .ga_data )
17111712 + ufunc -> uf_dfunc_idx ;
17121713
17131714 return profile ? dfunc -> df_instr_prof == NULL
17141715 : dfunc -> df_instr == NULL ;
1716+ #else
1717+ break ;
1718+ #endif
17151719 }
1716- case UF_COMPILING : return FALSE ;
1720+ case UF_COMPILING : break ;
17171721 }
1722+ return FALSE;
17181723}
17191724
17201725/*
@@ -2088,6 +2093,7 @@ generate_undo_cmdmods(cctx_T *cctx)
20882093 return OK ;
20892094}
20902095
2096+ #ifdef FEAT_PROFILE
20912097 static void
20922098may_generate_prof_end (cctx_T * cctx , int prof_lnum )
20932099{
@@ -2100,6 +2106,7 @@ may_generate_prof_end(cctx_T *cctx, int prof_lnum)
21002106 cctx -> ctx_lnum = save_lnum ;
21012107 }
21022108}
2109+ #endif
21032110
21042111/*
21052112 * Reserve space for a local variable.
@@ -7143,9 +7150,11 @@ compile_while(char_u *arg, cctx_T *cctx)
71437150
71447151 // "endwhile" jumps back here, one before when profiling
71457152 scope -> se_u .se_while .ws_top_label = instr -> ga_len ;
7153+ #ifdef FEAT_PROFILE
71467154 if (cctx -> ctx_profiling && ((isn_T * )instr -> ga_data )[instr -> ga_len - 1 ]
71477155 .isn_type == ISN_PROF_START )
71487156 -- scope -> se_u .se_while .ws_top_label ;
7157+ #endif
71497158
71507159 // compile "expr"
71517160 if (compile_expr0 (& p , cctx ) == FAIL )
@@ -7178,8 +7187,10 @@ compile_endwhile(char_u *arg, cctx_T *cctx)
71787187 cctx -> ctx_scope = scope -> se_outer ;
71797188 unwind_locals (cctx , scope -> se_local_count );
71807189
7190+ #ifdef FEAT_PROFILE
71817191 // count the endwhile before jumping
71827192 may_generate_prof_end (cctx , cctx -> ctx_lnum );
7193+ #endif
71837194
71847195 // At end of ":for" scope jump back to the FOR instruction.
71857196 generate_JUMP (cctx , JUMP_ALWAYS , scope -> se_u .se_while .ws_top_label );
@@ -7851,7 +7862,7 @@ add_def_function(ufunc_T *ufunc)
78517862compile_def_function (
78527863 ufunc_T * ufunc ,
78537864 int check_return_type ,
7854- int profiling ,
7865+ int profiling UNUSED ,
78557866 cctx_T * outer_cctx )
78567867{
78577868 char_u * line = NULL ;
@@ -7865,7 +7876,9 @@ compile_def_function(
78657876 int save_estack_compiling = estack_compiling ;
78667877 int do_estack_push ;
78677878 int new_def_function = FALSE;
7879+ #ifdef FEAT_PROFILE
78687880 int prof_lnum = -1 ;
7881+ #endif
78697882
78707883 // When using a function that was compiled before: Free old instructions.
78717884 // The index is reused. Otherwise add a new entry in "def_functions".
@@ -7886,7 +7899,9 @@ compile_def_function(
78867899
78877900 CLEAR_FIELD (cctx );
78887901
7902+ #ifdef FEAT_PROFILE
78897903 cctx .ctx_profiling = profiling ;
7904+ #endif
78907905 cctx .ctx_ufunc = ufunc ;
78917906 cctx .ctx_lnum = -1 ;
78927907 cctx .ctx_outer = outer_cctx ;
@@ -7989,7 +8004,9 @@ compile_def_function(
79898004 if (cctx .ctx_lnum >= ufunc -> uf_lines .ga_len )
79908005 {
79918006 // beyond the last line
8007+ #ifdef FEAT_PROFILE
79928008 may_generate_prof_end (& cctx , prof_lnum );
8009+ #endif
79938010 break ;
79948011 }
79958012 }
@@ -8005,13 +8022,15 @@ compile_def_function(
80058022 continue ;
80068023 }
80078024
8025+ #ifdef FEAT_PROFILE
80088026 if (cctx .ctx_profiling && cctx .ctx_lnum != prof_lnum )
80098027 {
80108028 may_generate_prof_end (& cctx , prof_lnum );
80118029
80128030 prof_lnum = cctx .ctx_lnum ;
80138031 generate_instr (& cctx , ISN_PROF_START );
80148032 }
8033+ #endif
80158034
80168035 // Some things can be recognized by the first character.
80178036 switch (* ea .cmd )
@@ -8376,12 +8395,14 @@ compile_def_function(
83768395 + ufunc -> uf_dfunc_idx ;
83778396 dfunc -> df_deleted = FALSE;
83788397 dfunc -> df_script_seq = current_sctx .sc_seq ;
8398+ #ifdef FEAT_PROFILE
83798399 if (cctx .ctx_profiling )
83808400 {
83818401 dfunc -> df_instr_prof = instr -> ga_data ;
83828402 dfunc -> df_instr_prof_count = instr -> ga_len ;
83838403 }
83848404 else
8405+ #endif
83858406 {
83868407 dfunc -> df_instr = instr -> ga_data ;
83878408 dfunc -> df_instr_count = instr -> ga_len ;
0 commit comments