[Bug translation/93759] Invalid % in param

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 17 13:51:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93759

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jsm28 at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The --help translation looks very much broken.  The help string from the *.opt
files is stored in cl_options[???].help.
      help = option->help;
      if (help == NULL)
        {
          if (exclude_flags & CL_UNDOCUMENTED)
            continue;

          help = undocumented_msg;
        }

      if (option->alias_target < N_OPTS
          && cl_options [option->alias_target].help)
        {
          if (help == undocumented_msg)
            {
              /* For undocumented options that are aliases for other options
                 that are documented, point the reader to the other option in
                 preference of the former.  */
              snprintf (new_help, sizeof new_help,
                        _("Same as %s.  Use the latter option instead."),
                        cl_options [option->alias_target].opt_text);
            }
          else
            {
              /* For documented options with aliases, mention the aliased
                 option's name for reference.  */
              snprintf (new_help, sizeof new_help,
                        _("%s  Same as %s."),
                        help, cl_options [option->alias_target].opt_text);
            }

          help = new_help;
        }

      if (option->warn_message)
        {
          /* Mention that the use of the option will trigger a warning.  */
          if (help == new_help)
            snprintf (new_help + strlen (new_help),
                      sizeof new_help - strlen (new_help),
                      "  %s", _(use_diagnosed_msg));
          else
            snprintf (new_help, sizeof new_help,
                      "%s  %s", help, _(use_diagnosed_msg));

          help = new_help;
        }

      /* Get the translation.  */
      help = _(help);
So, yes, they are just passed to _() and thus shouldn't be marked ,c-format.
But in the alias case where the help is documented it will actually never find
the right translation, etc.


More information about the Gcc-bugs mailing list