]> granicus.if.org Git - mutt/commitdiff
Generate error if makedoc is missing a type.
authorKevin McCarthy <kevin@8t8.us>
Mon, 25 Jun 2018 20:13:55 +0000 (13:13 -0700)
committerKevin McCarthy <kevin@8t8.us>
Mon, 25 Jun 2018 20:13:55 +0000 (13:13 -0700)
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.

doc/makedoc.c
init.h

index a84554b7604cafb9776d45c021d5f28f0b92a011..29f9dcae65e7fa988fec96adb38830e81d3d1114 100644 (file)
@@ -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 9858a50cc618771d63f81ae48cc91386c3354701..3db05e2e9d632e21777baedbb39cc84583766033 100644 (file)
--- 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) */