On Tue, 30 Jan 2024, 15:03 Jonathan Wakely, <jwak...@redhat.com> wrote:

> OK for trunk?
>
> -- >8 --
>
> The mklog.py output for libstdc++-v3/include/bits/version.h is awful.
> Teaching mklog.py that it's generated makes it correctly use
> "Regenerate" for its changes. We can do the same for the other new
> generated headers as well.
>
> contrib/ChangeLog:
>
>         * mklog.py (libstdcxx_generated_files): New set.
>         (generate_changelog): Use libstdcxx_generated_files.
> ---
>  contrib/mklog.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/contrib/mklog.py b/contrib/mklog.py
> index d764fb41f99..67dfd88393b 100755
> --- a/contrib/mklog.py
> +++ b/contrib/mklog.py
> @@ -92,6 +92,10 @@ function_extensions = {'.c', '.cpp', '.C', '.cc', '.h',
> '.inc', '.def', '.md'}
>  # NB: Makefile.in isn't listed as it's not always generated.
>  generated_files = {'aclocal.m4', 'config.h.in', 'configure'}
>
> +libstdcxx_generated_files = { 'include/bits/version.h',
> +    'include/bits/text_encoding-data.h' 'include/bits/unicode-data.h',
> +}
> +
>  help_message = """\
>  Generate ChangeLog template for PATCH.
>  PATCH must be generated using diff(1)'s -up or -cp options
> @@ -284,6 +288,10 @@ def generate_changelog(data, no_functions=False,
> fill_pr_titles=False,
>              elif os.path.basename(file.path) in generated_files:
>                  out += '\t* %s: Regenerate.\n' % (relative_path)
>                  append_changelog_line(out, relative_path, 'Regenerate.')
> +            elif changelog == "libstdc++-v3" and \
> +                    relative_path in libstdcxx_generated_files:
> +                out += '\t* %s: Regenerate.\n' % (relative_path)
>

This check could be generalized by replacing the dict with:

additional_generated_files = {
  "libstdc++-v3" : { "include/bits/version.h", etc, etc }
}

Then doing:

  if relative_path in additional_generated_files.get(changelog, {}):

That way other subdirectories could add their own extra generated files to
it.



+                append_changelog_line(out, relative_path, 'Regenerate.')
>              else:
>                  if not no_functions:
>                      for hunk in file:
> --
> 2.43.0
>
>

Reply via email to