bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ppport.h warnings - cv_name - html_get_button_specification_list


From: Gavin Smith
Subject: ppport.h warnings - cv_name - html_get_button_specification_list
Date: Tue, 4 Jun 2024 18:15:16 +0100

When I run ppport.h to get warnings, as stated in README-hacking, I
get some warnings:

*** WARNING: Uses sv_ref, which may not be portable below perl 5.23.5, even 
with 'ppport.h'

This appears to be a false alarm due to local variables being called "sv_ref"
which is also the name of a function exposed in the Perl API.

*** WARNING: Uses cv_name, which may not be portable below perl 5.21.5, even 
with 'ppport.h'

This may be more serious.  cv_name is used in main/get_perl_info.c, in
html_get_button_specification_list.  The surrounding code looks like:

      if (SvTYPE (SvRV(*button_spec_info_type)) == SVt_PVCV) /* CODE */
        {
          int j;
          char *button_fun_name;
          enum button_function_type button_fun_type = 0;
          button_spec->type = BIT_function;
          button_spec->button_function.sv_reference
                              = *button_spec_info_type;
          button_fun_name
           = SvPV_nolen (cv_name ((CV *) SvRV (*button_spec_info_type),
                                  0, 0));
          for (j = 1; button_function_type_string[j]; j++)
            if (strstr (button_fun_name,
                        button_function_type_string[j]))
              {
                button_fun_type = j;
                break;
              }
          if (button_fun_type)
            button_spec->button_function.type = button_fun_type;
          else
            result->BIT_user_function_number++;
        }
      else
        {
          button_spec->type = BIT_string;
          button_spec->sv_string = *button_spec_info_type;
        }
    }

I only have the dimmest of ideas of what all this code is for so am at a loss
how this could be fixed not to use cv_name.  I am guessing it is something to
do with customization variables for "buttons" which may not be an important
feature.  The use of the CV type ("code value") makes me suspect it is
handling a subroutine reference, and some of the default values in HTML
do use subroutine references, e.g.

  'SECTION_BUTTONS' => [[ 'Next', \&_default_panel_button_dynamic_direction ],
                [ 'Prev', \&_default_panel_button_dynamic_direction ],
                [ 'Up', \&_default_panel_button_dynamic_direction ], ' ',
                'Contents', 'Index', 'About'],

This is something that would only be accessed internally or via the
texi2any customization API.

button_fun_name is only used to compare with the button_function_type_string
array:

/* should be consistent with enum button_function_type */
static const char *button_function_type_string[] = {
  0,
  "::_default_panel_button_dynamic_direction_section_footer",
  "::_default_panel_button_dynamic_direction_node_footer",
  "::_default_panel_button_dynamic_direction",
  0,
};

Is this a way of checking if it is set to the default subroutine?  Is there
another way of doing this without using the name?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]