]> git.draconx.ca Git - cdecl99.git/blobdiff - test/declgen.c
Replace typegen.sh with a new and improved script.
[cdecl99.git] / test / declgen.c
index 4fb39cb52e26539d29df0749a1c8e24e508c07d0..c02613a23cd4cb632097c1176122838d521e876a 100644 (file)
@@ -150,21 +150,15 @@ struct cdecl_declspec *gen_storspecs(struct gen_rng *rng, bool registeronly)
  * Generate random type specifiers.  There is a short list of valid
  * combinations, from which we can select one uniformly at random.
  */
-static const unsigned long total_types;
-static struct cdecl_declspec *gen_raw_typespecs(struct gen_rng *rng)
-{
-       switch (gsl_rng_uniform_int(rng->rng, total_types)) {
-#      include "typegen.h"
-       }
-}
-static const unsigned long total_types = TOTAL_TYPES;
+#include "typegen.h"
 
 struct cdecl_declspec *gen_typespecs(struct gen_rng *rng, bool voidtype)
 {
        struct cdecl_declspec *specs;
 
 retry:
-       specs = gen_raw_typespecs(rng);
+       specs = gen_raw_typespecs(gsl_rng_uniform_int(rng->rng,
+                                                     GEN_TOTAL_TYPES));
 
        switch (specs->type) {
        /* void is not always valid, so we might need to pick again. */