[interp] Remove unreachable code (#12411)
[mono-project.git] / mono / utils / mono-experiments.c
blob5f83034032b56c53690e1e25404d85fa93525da7
2 #include "config.h"
3 #include <glib.h>
4 #include "mono/utils/mono-lazy-init.h"
5 #include "mono/utils/mono-experiments.h"
7 mono_lazy_init_t mono_experiments_enabled_init;
9 guint8 mono_experiments_enabled_table[] = {
10 #define EXPERIMENT(id,ghurl) 0,
11 #include "mono-experiments.def"
12 #undef EXPERIMENT
15 static
16 const char* mono_experiment_names[] = {
17 #define EXPERIMENT(id,ghurl) #id,
18 #include "mono-experiments.def"
19 #undef EXPERIMENT
22 static int
23 lookup_experiment_by_name (const char *exp_name)
25 /* slow loop, but we only do this once, on demand. */
26 for (int i = 0; i < MONO_EXPERIMENT_NUM_EXPERIMENTS; i++) {
27 if (!strcmp (mono_experiment_names[i], exp_name))
28 return i;
30 return -1;
33 void
34 mono_experiments_initialize_table (void)
36 char *str = g_getenv ("MONO_EXPERIMENT");
37 if (str == NULL)
38 return;
39 char **experiments = g_strsplit (str, ",", 0);
41 char **exp_name = &experiments[0];
42 while (*exp_name) {
43 int exp_id = lookup_experiment_by_name (*exp_name);
44 if (exp_id < 0) {
45 g_warning ("This version of Mono does not include experiment '%s'. Experiments have no stability, backward compatability or deprecation guarantees.", *exp_name);
46 } else {
47 mono_experiments_enabled_table [exp_id] = 1;
49 exp_name++;
52 g_free (str);
53 g_strfreev (experiments);