binutils-gdb/gnulib/import/extra/update-copyright
Christian Biesinger 698be2d8e5 Update gnulib to current trunk
This fixes two issues on Windows: Update.
https://sourceware.org/pipermail/gdb-patches/2020-June/169978.html

gnulib/ChangeLog:

2020-08-26  Christian Biesinger  <cbiesinger@google.com>
	    Pedro Alves  <palves@redhat.com>
	    Joel Brobecker  <brobecker@adacore.com>

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* import/Makefile.am: Update.
	* import/Makefile.in: Regenerate.
	* import/alloca.in.h (if): Update.
	* import/assure.h (affirm): Update.
	* import/at-func.c: Update.
	* import/attribute.h: New file.
	* import/btowc.c: New file.
	* import/canonicalize-lgpl.c: Update.
	* import/count-one-bits.h (COUNT_ONE_BITS_GENERIC): Update.
	(COUNT_ONE_BITS): Update.
	(intrinsic): Update.
	(__popcnt64): Update.
	(popcount_supported): Update.
	* import/ctype.in.h: New file.
	* import/dirent-private.h (WIN32_FIND_DATA): Update.
	* import/dirent.in.h (_GL_ATTRIBUTE_PURE): Update.
	* import/dirname.h: Update.
	* import/dosname.h: Remove.
	* import/error.h (_GL_ATTRIBUTE_FORMAT): Update.
	* import/extra/update-copyright: Update.
	* import/fchdir.c: Update.
	* import/fcntl.in.h (GNULIB_defined_rpl_fcntl): Update.
	(GNULIB_defined_fcntl): Update.
	* import/filename.h (HAS_DEVICE): Update.
	(IS_ABSOLUTE_PATH): Update.
	(IS_PATH_WITH_DIR): Update.
	(FILE_SYSTEM_PREFIX_LEN): Update.
	(_IS_DRIVE_LETTER): Update.
	(FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): Update.
	(IS_ABSOLUTE_FILE_NAME): Update.
	(IS_RELATIVE_FILE_NAME): Update.
	(IS_FILE_NAME_WITH_DIR): Update.
	* import/filenamecat-lgpl.c (mfile_name_concat): Update.
	* import/fnmatch.c (WIDE_CHAR_SUPPORT): Update.
	(btowc): Update.
	(iswctype): Update.
	(mempcpy): Update.
	(strnlen): Update.
	(towlower): Update.
	(wcscat): Update.
	(wcslen): Update.
	(wctype): Update.
	(wmemchr): Update.
	(wmempcpy): Update.
	(SIZE_MAX): Update.
	(isblank): Update.
	(__libc_use_alloca): Update.
	(alloca): Update.
	(alloca_account): Update.
	(STREQ): Update.
	(CHAR_CLASS_MAX_LENGTH): Update.
	(IS_CHAR_CLASS): Update.
	(ISWCTYPE): Update.
	(if): Update.
	(HANDLE_MULTIBYTE): Update.
	(internal_function): Update.
	(FOLD): Update.
	(CHAR): Update.
	(UCHAR): Update.
	(INT): Update.
	(FCT): Update.
	(EXT): Update.
	(END): Update.
	(L_): Update.
	(BTOWC): Update.
	(STRLEN): Update.
	(STRCAT): Update.
	(MEMPCPY): Update.
	(MEMCHR): Update.
	(WIDE_CHAR_VERSION): Update.
	(STRUCT): Update.
	(FINDIDX): Update.
	(findidx): Update.
	(ALLOCA_LIMIT): Update.
	(SHLIB_COMPAT): Update.
	* import/fnmatch_loop.c (struct STRUCT): Update.
	(FCT): Update.
	(EXT): Update.
	(END): Update.
	(str): Update.
	(NEW_PATTERN): Update.
	* import/getcwd.c: Update.
	* import/getlogin_r.c (GetUserName): Update.
	* import/getprogname.c (getprogname): Update.
	* import/getrandom.c: New file.
	* import/gettimeofday.c: Remove.
	* import/glob.in.h (_Restrict_): Update.
	* import/inttypes.in.h (_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	* import/isblank.c: New file.
	* import/isnanl-nolibm.h (__has_builtin): Update.
	* import/libc-config.h (versioned_symbol): Update.
	(compat_symbol): Update.
	* import/limits.in.h (_GL_ALREADY_INCLUDING_LIMITS_H): Update.
	* import/m4/btowc.m4: New file.
	* import/m4/ctype.m4: New file.
	* import/m4/exponentl.m4: Update.
	* import/m4/fnmatch.m4: Update.
	* import/m4/getrandom.m4: New file.
	* import/m4/glob.m4: Update.
	* import/m4/gnulib-cache.m4: Update.
	* import/m4/gnulib-common.m4: Update.
	* import/m4/gnulib-comp.m4: Update.
	* import/m4/inttypes.m4: Update.
	* import/m4/isblank.m4: New file.
	* import/m4/isnanl.m4: Update.
	* import/m4/largefile.m4: Update.
	* import/m4/mbtowc.m4: New file.
	* import/m4/memmem.m4: Update.
	* import/m4/minmax.m4: New file.
	* import/m4/signal_h.m4: Update.
	* import/m4/stdio_h.m4: Update.
	* import/m4/stdlib_h.m4: Update.
	* import/m4/string_h.m4: Update.
	* import/m4/strnlen.m4: New file.
	* import/m4/sys_random_h.m4: New file.
	* import/m4/sys_socket_h.m4: Update.
	* import/m4/sys_stat_h.m4: Update.
	* import/m4/time_h.m4: Update.
	* import/m4/unistd_h.m4: Update.
	* import/m4/wchar_h.m4: Update.
	* import/m4/wint_t.m4: Update.
	* import/m4/wmemchr.m4: New file.
	* import/m4/wmempcpy.m4: New file.
	* import/math.in.h (__has_builtin): Update.
	* import/mbrtowc.c (FALLTHROUGH): Update.
	* import/mbtowc-impl.h: New file.
	* import/mbtowc.c: New file.
	* import/minmax.h: New file.
	* import/open.c (open): Update.
	* import/openat-proc.c (openat_proc_name): Update.
	* import/openat.c (rpl_openat): Update.
	(openat_needs_fchdir): Update.
	* import/openat.h (FCHOWNAT_INLINE): Update.
	(CHOWNAT_INLINE): Update.
	(FCHMODAT_INLINE): Update.
	(CHMODAT_INLINE): Update.
	* import/opendir.c (WIN32_FIND_DATA): Update.
	(GetFullPathName): Update.
	(FindFirstFile): Update.
	* import/readdir.c (FindNextFile): Update.
	* import/rename.c (MoveFileEx): Update.
	* import/rewinddir.c (FindFirstFile): Update.
	* import/rmdir.c: Update.
	* import/signal.in.h (_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	* import/stat-w32.c (_WIN32_WINNT): Update.
	(LoadLibrary): Update.
	(GetFinalPathNameByHandle): Update.
	(GetProcAddress): Update.
	(DWORD): Update.
	(GetFileInformationByHandleExFunc): Update.
	(GetFinalPathNameByHandleFunc): Update.
	* import/stat.c (WIN32_FIND_DATA): Update.
	(CreateFile): Update.
	(FindFirstFile): Update.
	* import/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	(_GL_FUNCDECL_RPL_1): Update.
	(_GL_CXXALIAS_RPL_1): Update.
	(_GL_CXXALIAS_SYS_CAST): Update.
	* import/stdlib.in.h (_GL_ATTRIBUTE_PURE): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	* import/string.in.h (_GL_ATTRIBUTE_PURE): Update.
	(_GL_WARN_ON_USE): Update.
	(_GL_WARN_ON_USE_CXX): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_CXXALIAS_SYS): Update.
	(mbstok_r): Update.
	* import/strnlen.c: New file.
	* import/sys_random.in.h: New file.
	* import/sys_socket.in.h (GNULIB_defined_socklen_t): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_CXXALIAS_SYS_CAST): Update.
	* import/sys_stat.in.h (_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	(lchmod): Update.
	(_GL_CXXALIAS_RPL_1): Update.
	(stat): Update.
	* import/tempname.c (__set_errno): Update.
	(__secure_getenv): Update.
	(__try_tempname): Update.
	(__getpid): Update.
	(__gettimeofday): Update.
	(RANDOM_BITS): Update.
	(uint64_t): Update.
	(RANDOM_VALUE_MAX): Update.
	(BASE_62_DIGITS): Update.
	(BASE_62_POWER): Update.
	(try_tempname_len): Update.
	(try_file): Update.
	(try_dir): Update.
	(try_nocreate): Update.
	(gen_tempname_len): Update.
	(__gen_tempname): Update.
	(try_tempname): Update.
	* import/tempname.h (gen_tempname_len): Update.
	(try_tempname_len): Update.
	* import/time.in.h (_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_CXXALIAS_SYS): Update.
	* import/unistd.in.h (if): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	(_GL_CXXALIASWARN): Update.
	(_GL_WARN_ON_USE): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	* import/verify.h: Update.
	* import/warn-on-use.h (_GL_WARN_ON_USE_CXX): Update.
	* import/wchar.in.h (_GL_ATTRIBUTE_PURE): Update.
	(_GL_FUNCDECL_RPL): Update.
	(_GL_CXXALIAS_RPL): Update.
	(_GL_FUNCDECL_SYS): Update.
	(_GL_CXXALIAS_SYS): Update.
	(_GL_CXXALIASWARN): Update.
	(_GL_WARN_ON_USE): Update.
	(_GL_CXXALIAS_SYS_CAST2): Update.
	(_GL_CXXALIASWARN1): Update.
	* import/windows-rwlock.c (CreateEvent): Update.
	* import/wmemchr-impl.h: New file.
	* import/wmemchr.c: New file.
	* import/wmempcpy.c: New file.
	* update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gettimeofday.
	(GNULIB_COMMIT_SHA1): Update gnulib revision.
2020-08-26 15:37:28 -07:00

303 lines
11 KiB
Perl
Executable File

#!/bin/sh
#! -*-perl-*-
# Update an FSF copyright year list to include the current year.
# Copyright (C) 2009-2020 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Written by Jim Meyering and Joel E. Denny
# This script updates an FSF copyright year list to include the current year.
# Usage: update-copyright [FILE...]
#
# The arguments to this script should be names of files that contain
# copyright statements to be updated. The copyright holder's name
# defaults to "Free Software Foundation, Inc." but may be changed to
# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
# variable.
#
# For example, you might wish to use the update-copyright target rule
# in maint.mk from gnulib's maintainer-makefile module.
#
# Iff a copyright statement is recognized in a file and the final
# year is not the current year, then the statement is updated for the
# new year and it is reformatted to:
#
# 1. Fit within 72 columns.
# 2. Convert 2-digit years to 4-digit years by prepending "19".
# 3. Expand copyright year intervals. (See "Environment variables"
# below.)
#
# A warning is printed for every file for which no copyright
# statement is recognized.
#
# Each file's copyright statement must be formatted correctly in
# order to be recognized. For example, each of these is fine:
#
# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
# Foundation, Inc.
#
# # Copyright (C) 1990-2005, 2007-2009 Free Software
# # Foundation, Inc.
#
# /*
# * Copyright &copy; 90,2005,2007-2009
# * Free Software Foundation, Inc.
# */
#
# However, the following format is not recognized because the line
# prefix changes after the first line:
#
# ## Copyright (C) 1990-2005, 2007-2009 Free Software
# # Foundation, Inc.
#
# However, any correctly formatted copyright statement following
# a non-matching copyright statements would be recognized.
#
# The exact conditions that a file's copyright statement must meet
# to be recognized are:
#
# 1. It is the first copyright statement that meets all of the
# following conditions. Subsequent copyright statements are
# ignored.
# 2. Its format is "Copyright (C)", then a list of copyright years,
# and then the name of the copyright holder.
# 3. The "(C)" takes one of the following forms or is omitted
# entirely:
#
# A. (C)
# B. (c)
# C. @copyright{}
# D. &copy;
# E. ©
#
# 4. The "Copyright" appears at the beginning of a line, except that it
# may be prefixed by any sequence (e.g., a comment) of no more than
# 5 characters -- including white space.
# 5. Iff such a prefix is present, the same prefix appears at the
# beginning of each remaining line within the FSF copyright
# statement. There is one exception in order to support C-style
# comments: if the first line's prefix contains nothing but
# whitespace surrounding a "/*", then the prefix for all subsequent
# lines is the same as the first line's prefix except with each of
# "/" and possibly "*" replaced by a " ". The replacement of "*"
# by " " is consistent throughout all subsequent lines.
# 6. Blank lines, even if preceded by the prefix, do not appear
# within the FSF copyright statement.
# 7. Each copyright year is 2 or 4 digits, and years are separated by
# commas, "-", or "--". Whitespace may appear after commas.
#
# Environment variables:
#
# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
# is reformatted even if it does not need updating for the new
# year. If unset or set to 0, only updated FSF copyright
# statements are reformatted.
# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
# copyright years (such as 90, 1991, 1992-2007, 2008) in a
# reformatted FSF copyright statement is collapsed to a single
# interval (such as 1990-2008). If unset or set to 0, all existing
# copyright year intervals in a reformatted FSF copyright statement
# are expanded instead.
# If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
# to the minimal containing range. For example, convert
# 2000, 2004-2007, 2009 to 2000-2009.
# 3. For testing purposes, you can set the assumed current year in
# UPDATE_COPYRIGHT_YEAR.
# 4. The default maximum line length for a copyright line is 72.
# Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
# 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
# than "Free Software Foundation, Inc.".
# This is a prologue that allows to run a perl script as an executable
# on systems that are compliant to a POSIX version before POSIX:2017.
# On such systems, the usual invocation of an executable through execlp()
# or execvp() fails with ENOEXEC if it is a script that does not start
# with a #! line. The script interpreter mentioned in the #! line has
# to be /bin/sh, because on GuixSD systems that is the only program that
# has a fixed file name. The second line is essential for perl and is
# also useful for editing this file in Emacs. The next two lines below
# are valid code in both sh and perl. When executed by sh, they re-execute
# the script through the perl program found in $PATH. The '-x' option
# is essential as well; without it, perl would re-execute the script
# through /bin/sh. When executed by perl, the next two lines are a no-op.
eval 'exec perl -wSx -0777 -pi "$0" "$@"'
if 0;
my $VERSION = '2020-04-04.15:07'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
use strict;
use warnings;
my $copyright_re = 'Copyright';
my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|&copy;|©)';
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
$holder ||= 'Free Software Foundation, Inc.';
my $prefix_max = 5;
my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
!$margin || $margin !~ m/^\d+$/
and $margin = 72;
my $tab_width = 8;
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
if (!$this_year || $this_year !~ m/^\d{4}$/)
{
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
$this_year = $year + 1900;
}
# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
my $leading;
my $prefix;
my $ws_re;
my $stmt_re;
while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
{
$leading = "$1$2";
$prefix = $2;
if ($prefix =~ /^(\s*\/)\*(\s*)$/)
{
$prefix =~ s,/, ,;
my $prefix_ws = $prefix;
$prefix_ws =~ s/\*/ /; # Only whitespace.
if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
{
$prefix = $prefix_ws;
}
}
$ws_re = '[ \t\r\f]'; # \s without \n
$ws_re =
"(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
my $holder_re = $holder;
$holder_re =~ s/\s/$ws_re/g;
my $stmt_remainder_re =
"(?:$ws_re$circle_c_re)?"
. "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*"
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
if (/\G$stmt_remainder_re/)
{
$stmt_re =
quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
last;
}
}
if (defined $stmt_re)
{
/$stmt_re/ or die; # Should never die.
my $stmt = $1;
my $final_year_orig = $2;
# Handle two-digit year numbers like "98" and "99".
my $final_year = $final_year_orig;
$final_year <= 99
and $final_year += 1900;
if ($final_year != $this_year)
{
# Update the year.
$stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/;
}
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
{
# Normalize all whitespace including newline-prefix sequences.
$stmt =~ s/$ws_re/ /g;
# Put spaces after commas.
$stmt =~ s/, ?/, /g;
# Convert 2-digit to 4-digit years.
$stmt =~ s/(\b\d\d\b)/19$1/g;
# Make the use of intervals consistent.
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
{
$stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg;
}
else
{
my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-";
$stmt =~
s/
(\d{4})
(?:
(,\ |--?)
((??{
if ($2 ne ', ') { '\d{4}'; }
elsif (!$3) { $1 + 1; }
else { $3 + 1; }
}))
)+
/$1$ndash$3/gx;
# When it's 2, emit a single range encompassing all year numbers.
$ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/;
}
# Format within margin.
my $stmt_wrapped;
my $text_margin = $margin - length($prefix);
if ($prefix =~ /^(\t+)/)
{
$text_margin -= length($1) * ($tab_width - 1);
}
while (length $stmt)
{
if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
|| ($stmt =~ s/^([\S]+)(?: |$)//))
{
my $line = $1;
$stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
$stmt_wrapped .= $line;
}
else
{
# Should be unreachable, but we don't want an infinite
# loop if it can be reached.
die;
}
}
# Replace the old copyright statement.
s/$stmt_re/$stmt_wrapped/;
}
}
else
{
print STDERR "$ARGV: warning: copyright statement not found\n";
}
# Hey Emacs!
# Local variables:
# coding: utf-8
# mode: perl
# indent-tabs-mode: nil
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-line-limit: 200
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "'; # UTC"
# End: