mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
d2d6d8d537
contains a sigdec[] vector of structures, but the generated output is missing braces around the initializer of each struct, which triggers warnings in WARNS=3: src/usr.bin/top/sigdesc.h:10: warning: missing braces around initializer src/usr.bin/top/sigdesc.h:10: warning: (near initialization for `sigdesc[0]') * Fix the sigconv.awk script to generate a header with initializers which look better. * Add rules to usr.bin/top/Makefile that rebuilds a new sigconv.h header which matches the correct signal set from the build-time version of `${DESTDIR}/usr/include/signal.h' (so sigconv.h doesn't get stale once changes are made to the header). * Remove the old sigconv.h header, now that it is autoupdated at build time. * Various Makefile style fixes (the committed Makefile was kindly submitted by Ruslan): - Reorder .PATH, PROG, SRCS and CFLAGS to match style.Makefile(5) - Split off the generated sources (sigdesc.h top.local.h) in an SRCS+= line of their own. - Add entries to CLEANFILES near the rules that generate the respective files. - Move the explicit rule which builds top.1 after the implicit rules which generate its dependencies. Reviewed by: ru, bde Submitted by: ru (Makefile) MFC after: 2 weeks
56 lines
1.1 KiB
Awk
56 lines
1.1 KiB
Awk
# $FreeBSD$
|
|
|
|
BEGIN {
|
|
nsig = 0;
|
|
j = 0;
|
|
print "/* This file was automatically generated */"
|
|
print "/* by the awk script \"sigconv.awk\". */\n"
|
|
print "struct sigdesc {"
|
|
print " char *name;"
|
|
print " int number;"
|
|
print "};\n"
|
|
print "struct sigdesc sigdesc[] = {"
|
|
}
|
|
|
|
/^#define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ {
|
|
|
|
j = sprintf("%d", $3);
|
|
str = $2;
|
|
|
|
if (nsig < j)
|
|
nsig = j;
|
|
|
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
|
substr(str, 4), j);
|
|
}
|
|
/^#[ \t]*define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ {
|
|
|
|
j = sprintf("%d", $4);
|
|
str = $3;
|
|
|
|
if (nsig < j)
|
|
nsig = j;
|
|
|
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
|
substr(str, 4), j);
|
|
}
|
|
/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]+[0-9]*[ \t]/ {
|
|
|
|
j = sprintf("%d", $4);
|
|
str = $3;
|
|
|
|
if (nsig < j)
|
|
nsig = j;
|
|
|
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
|
substr(str, 5), j);
|
|
}
|
|
|
|
END {
|
|
for (n = 1; n <= nsig; n++)
|
|
if (siglist[n] != "")
|
|
printf(" %s\n", siglist[n]);
|
|
|
|
printf(" { NULL,\t 0 }\n};\n");
|
|
}
|