manual: Convert errno @comments to new @errno macro.

errno.texi documents error macros, their values, and error strings in
Texinfo @comments, some of which are also used for @standards.  The
purpose of this commit is to separate the standards from the error
strings so that both the @standards conversion script picks up clean
@standards and the errno documentation framework is improved.

The error names, values, and messages are consolidated in a new custom
macro, @errno.  It is not clear that scripts within the sources rely
on the special Texinfo @comment-based format to generate files used
throughout the library, so the definition of @errno in macros.texi now
provides a comment indicating the dependency.  The dependent scripts
are updated to use @errno, which also simplifies them a bit.  The
files those scripts generate were verified to be unchanged.

The @errno macro is not visibly rendered in any way at this time, but
it does use an @cindex command to add the error string to the Concept
Index, to facilitate searching on error messages.

	* manual/errno.texi: Convert @comment-based errno
	documentation to @errno.
	* manual/macros.texi (@errno): New macro.  Consolidate errors,
	their values, and messages, adding the error string to the
	Concept Index.  Provide a warning in the comment about
	external (to the manual) dependencies.
	* sysdeps/gnu/errlist.awk: Use @errno instead of @comments.
	* sysdeps/mach/hurd/errnos.awk: Likewise.
This commit is contained in:
Rical Jasan 2017-05-19 22:44:25 -07:00
parent 0bcec5321f
commit a429d2ff07
5 changed files with 326 additions and 330 deletions

View File

@ -1,3 +1,14 @@
2017-05-19 Rical Jasan <ricaljasan@pacific.net>
* manual/errno.texi: Convert @comment-based errno documentation to
@errno.
* manual/macros.texi (@errno): New macro. Consolidate errors,
their values, and messages, adding the error string to the Concept
Index. Provide a warning in the comment about external (to the
manual) dependencies.
* sysdeps/gnu/errlist.awk: Use @errno instead of @comments.
* sysdeps/mach/hurd/errnos.awk: Likewise.
2017-05-19 Joseph Myers <joseph@codesourcery.com> 2017-05-19 Joseph Myers <joseph@codesourcery.com>
* bits/ss_flags.h: New file. * bits/ss_flags.h: New file.

File diff suppressed because it is too large Load Diff

View File

@ -267,4 +267,10 @@ cwd\comments\
@end macro @end macro
@end ifnottex @end ifnottex
@c Used by errlist.awk and errnos.awk to generate other files.
@c Note that error values have ABI implications for the Hurd.
@macro errno {err, val, str}
@cindex \str\
@end macro
@end ifclear @end ifclear

View File

@ -16,10 +16,8 @@
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# errno.texi contains lines like: # errno.texi contains lines like:
# @comment errno.h
# @comment POSIX.1: Function not implemented
# @deftypevr Macro int ENOSYS # @deftypevr Macro int ENOSYS
# @comment errno 78 # @errno{ENOSYS, 78, Function not implemented}
# Descriptive paragraph... # Descriptive paragraph...
# @end deftypevr # @end deftypevr
@ -61,22 +59,14 @@ BEGIN {
print " [0] = N_(\"Success\")," print " [0] = N_(\"Success\"),"
} }
$1 == "@comment" && $2 == "errno.h" { errnoh=1; next } /^@errno\{/ \
errnoh == 1 && $1 == "@comment" \
{ {
++errnoh;
etext = $3; etext = $3;
for (i = 4; i <= NF; ++i) for (i = 4; i <= NF; ++i)
etext = etext " " $i; etext = etext " " $i;
next; etext = substr(etext, 1, length(etext)-1)
} e = substr($1, 8, length($1)-8)
errnoh == 2 && $1 == "@deftypevr" && $2 == "Macro" && $3 == "int" \ errno = substr($2, 1, length($2)-1) + 0
{
e = $4; errnoh++; next;
}
errnoh == 3 && $1 == "@comment" && $2 == "errno" \
{
errno = $3 + 0;
if (alias[e]) if (alias[e])
printf "#if defined (%s) && %s != %s\n", e, e, alias[e]; printf "#if defined (%s) && %s != %s\n", e, e, alias[e];
else else
@ -102,7 +92,6 @@ errnoh == 4 \
# This magic tag in C comments gets them copied into libc.pot. # This magic tag in C comments gets them copied into libc.pot.
desc = desc "\nTRANS" ($0 != "" ? " " : "") $0; next desc = desc "\nTRANS" ($0 != "" ? " " : "") $0; next
} }
{ errnoh=0 }
END { END {
print " };"; print " };";
print ""; print "";

View File

@ -16,10 +16,7 @@
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# errno.texinfo contains lines like: # errno.texinfo contains lines like:
# @comment errno.h # @errno{ENOSYS, 123, Function not implemented}
# @comment POSIX.1: Function not implemented
# @deftypevr Macro int ENOSYS
# @comment errno 123
BEGIN { BEGIN {
print "/* This file generated by errnos.awk. */"; print "/* This file generated by errnos.awk. */";
@ -39,7 +36,6 @@ BEGIN {
print "\t value. */"; print "\t value. */";
print "\tESUCCESS = 0," print "\tESUCCESS = 0,"
print ""; print "";
errnoh = 0;
maxerrno = 0; maxerrno = 0;
in_mach_errors = ""; in_mach_errors = "";
in_math = 0; in_math = 0;
@ -48,26 +44,21 @@ BEGIN {
lno = 0; lno = 0;
} }
$1 == "@comment" && $2 == "errno.h" { errnoh=1; next } /^@errno\{/ \
$1 == "@comment" && errnoh == 1 \
{ {
++errnoh;
etext = ""; etext = "";
for (i = 3; i <= NF; ++i) for (i = 3; i <= NF; ++i)
etext = etext " " $i; etext = etext " " $i;
next; etext = substr(etext, 1, length(etext)-1)
}
errnoh == 2 && $1 == "@deftypevr" && $2 == "Macro" && $3 == "int" \ e = substr($1, 8, length($1)-8)
{ ++errnoh; e = $4; next; }
errnoh == 3 && $1 == "@comment" && $2 == "errno" {
if (e == "EWOULDBLOCK") if (e == "EWOULDBLOCK")
{ {
lines[lno++]="#define EWOULDBLOCK EAGAIN /* Operation would block */"; lines[lno++]="#define EWOULDBLOCK EAGAIN /* Operation would block */";
next; next;
} }
errno = $3 + 0;
errno = substr($2, 1, length($2)-1) + 0
if (errno == 0) if (errno == 0)
next; next;
if (errno > maxerrno) maxerrno = errno; if (errno > maxerrno) maxerrno = errno;
@ -83,7 +74,6 @@ errnoh == 3 && $1 == "@comment" && $2 == "errno" {
lines[lno++] = x; lines[lno++] = x;
next; next;
} }
{ errnoh=0 }
NF == 3 && $1 == "#define" && $2 == "MACH_SEND_IN_PROGRESS" \ NF == 3 && $1 == "#define" && $2 == "MACH_SEND_IN_PROGRESS" \
{ {