Skip to content

Commit

Permalink
2004-10-20 Roland McGrath <roland@redhat.com>
Browse files Browse the repository at this point in the history
	* sysdeps/gnu/errlist-compat.awk: Don't bail if Versions gives a count
	higher than ERR_MAX reports.  Instead, emit a #define ERR_MAX.
	* sysdeps/gnu/Makefile ($(objpfx)errlist-compat.h): New target.
	(generated): Add errlist-compat.h.
	* sysdeps/gnu/errlist.awk: Make output #include <errlist-compat.h> to
	define ERR_MAX and use that for table size.
  • Loading branch information
Roland McGrath committed Oct 20, 2004
1 parent 1377221 commit 4b359a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 6 additions & 2 deletions sysdeps/gnu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ endif
# Make it unwritable so noone will edit it by mistake.
-chmod a-w $@T
mv -f $@T $@
generated += errlist-compat.c
$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
sed -n '1p;/ERR_MAX/p' $< > $@T
-chmod a-w $@T
mv -f $@T $@
generated += errlist-compat.c errlist-compat.h

# This will force the generation above to happy if need be.
$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.c
$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.h
endif

ifeq ($(subdir),login)
Expand Down
10 changes: 8 additions & 2 deletions sysdeps/gnu/errlist-compat.awk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# awk script to generate errlist-compat.c
# Copyright (C) 2002 Free Software Foundation, Inc.
# Copyright (C) 2002, 2004 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -59,7 +59,7 @@ END {

count = maxerr + 1;

if (highest != count) {
if (highest < count) {
printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
count, highest_version, highest > "/dev/stderr";
exit 1;
Expand All @@ -79,6 +79,12 @@ END {
print "/* This file was generated by errlist-compat.awk; DO NOT EDIT! */\n";
print "#include <shlib-compat.h>\n";

if (highest > count) {
printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \
count, highest_version, highest > "/dev/stderr";
printf "#define ERR_MAX %d\n\n", highest;
}

for (old in compat) {
new = compat[old];
n = vcount[old];
Expand Down
13 changes: 11 additions & 2 deletions sysdeps/gnu/errlist.awk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 1991-1999, 2002 Free Software Foundation, Inc.
# Copyright (C) 1991-1999,2002,2004 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -47,7 +47,16 @@ BEGIN {
print "#endif";
print "";

print "const char *const _sys_errlist_internal[] =";
print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT";
print "# include <errlist-compat.h>";
print "#endif";
print "#ifdef ERR_MAX";
print "# define ERRLIST_SIZE ERR_MAX + 1";
print "#else"
print "# define ERRLIST_SIZE";
print "#endif";

print "const char *const _sys_errlist_internal[ERRLIST_SIZE] =";
print " {";
print " [0] = N_(\"Success\"),"
}
Expand Down

0 comments on commit 4b359a2

Please sign in to comment.