* 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. */