svn commit: r365605 - head/usr.sbin/crunch/crunchgen
Kyle Evans
kevans at FreeBSD.org
Thu Sep 10 18:19:46 UTC 2020
Author: kevans
Date: Thu Sep 10 18:19:45 2020
New Revision: 365605
URL: https://svnweb.freebsd.org/changeset/base/365605
Log:
crunchgen(8): fix crunched application build with WARNS=6
This was revealed by the rescue build with a patch I'm working on to default
WARNS=6 everywhere. The issues resolved were:
- Missing prototype for _crunched_${ident}_stub in the *_stub.c generated
bits
- Missing prototype for crunched_main
- Incomplete prototype for _crunched_${ident}_stub in the generated parts of
crunched_main
- Literal strings in the stub table must drop const qualifier, unless we
const'ify name
- f field in struct stub didn't have a proper prototype
Most of these issues are minor formalities and easily addressed.
I note that if my patch to eventually raise WARNS for the rescue build
lands, we'll need to bump the __FreeBSD_version requirement for
bootstrapping crunchgen and wipe out the rescue .OBJDIR if it's stale, which
we should be able to detect pretty easily from a couple of the issues that
have been fixed here.
Reviewed by: arichardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26363
Modified:
head/usr.sbin/crunch/crunchgen/crunched_main.c
head/usr.sbin/crunch/crunchgen/crunchgen.c
Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c
==============================================================================
--- head/usr.sbin/crunch/crunchgen/crunched_main.c Thu Sep 10 18:04:34 2020 (r365604)
+++ head/usr.sbin/crunch/crunchgen/crunched_main.c Thu Sep 10 18:19:45 2020 (r365605)
@@ -76,15 +76,19 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
+typedef int crunched_stub_t(int, char **, char **);
+
struct stub {
- char *name;
- int (*f)();
+ const char *name;
+ crunched_stub_t *f;
};
extern const char *__progname;
extern struct stub entry_points[];
static void crunched_usage(void);
+
+crunched_stub_t crunched_main;
static struct stub *
find_entry_point(const char *basename)
Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==============================================================================
--- head/usr.sbin/crunch/crunchgen/crunchgen.c Thu Sep 10 18:04:34 2020 (r365604)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c Thu Sep 10 18:19:45 2020 (r365605)
@@ -934,7 +934,9 @@ gen_output_cfile(void)
fprintf(outcf, "%s\n", *cp);
for (p = progs; p != NULL; p = p->next)
- fprintf(outcf, "extern int _crunched_%s_stub();\n", p->ident);
+ fprintf(outcf,
+ "extern crunched_stub_t _crunched_%s_stub;\n",
+ p->ident);
fprintf(outcf, "\nstruct stub entry_points[] = {\n");
for (p = progs; p != NULL; p = p->next) {
@@ -1122,9 +1124,10 @@ prog_makefile_rules(FILE *outmk, prog_t *p)
fprintf(outmk, "%s_stub.c:\n", p->name);
fprintf(outmk, "\techo \""
"extern int main(int argc, char **argv, char **envp); "
+ "int _crunched_%s_stub(int argc, char **argv, char **envp);"
"int _crunched_%s_stub(int argc, char **argv, char **envp)"
"{return main(argc,argv,envp);}\" >%s_stub.c\n",
- p->ident, p->name);
+ p->ident, p->ident, p->name);
fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)",
p->name, p->name, p->ident);
if (p->libs)
More information about the svn-src-all
mailing list