From: Kevin McCarthy Date: Mon, 25 Jun 2018 20:13:55 +0000 (-0700) Subject: Generate error if makedoc is missing a type. X-Git-Tag: mutt-1-11-rel~130 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc040a5ba1bf744f064f4a7f9e2787cf1a1a85e3;p=mutt Generate error if makedoc is missing a type. Add a comment in init.h to remind devs to update makedoc.c when adding a new type. Change makedoc to fail on a missing type. Otherwise it's too easy to miss the resulting problem in the documentation. Credit goes to Eike Rathke for noting that it was too easy to forget to do this, and something should be fixed. I found his solution a bit too complicated though, and opted for just adding comment and program failure. --- diff --git a/doc/makedoc.c b/doc/makedoc.c index a84554b7..29f9dcae 100644 --- a/doc/makedoc.c +++ b/doc/makedoc.c @@ -394,8 +394,10 @@ static int buff2type (const char *s) for (type = DT_NONE; types[type].machine; type++) if (!strcmp (types[type].machine, s)) return type; - - return DT_NONE; + + fprintf (stderr, "%s: Unknown type %s. Please update makedoc.c\n", + Progname, s); + exit (1); } static const char *type2human (int type) diff --git a/init.h b/init.h index 9858a50c..3db05e2e 100644 --- a/init.h +++ b/init.h @@ -27,6 +27,7 @@ #include "buffy.h" #ifndef _MAKEDOC +/* If you add a data type, be sure to update doc/makedoc.c */ #define DT_MASK 0x0f #define DT_BOOL 1 /* boolean option */ #define DT_NUM 2 /* a number (short) */