| 1 |
/* On IA64 This test resulted in a missing jumptable and an undefined |
| 2 |
reference to a label. Make sure we can compile and link it with |
| 3 |
no undefs at -O2. */ |
| 4 |
|
| 5 |
/* { dg-do link } */ |
| 6 |
/* { dg-options "-O2" } */ |
| 7 |
|
| 8 |
typedef enum yasm_module_type { |
| 9 |
YASM_MODULE_ARCH = 0, |
| 10 |
YASM_MODULE_DBGFMT, |
| 11 |
YASM_MODULE_OBJFMT, |
| 12 |
YASM_MODULE_LISTFMT, |
| 13 |
YASM_MODULE_OPTIMIZER |
| 14 |
} yasm_module_type; |
| 15 |
|
| 16 |
struct yasm_module { |
| 17 |
const char *name; |
| 18 |
}; |
| 19 |
|
| 20 |
typedef struct yasm_module yasm_arch_module; |
| 21 |
typedef struct yasm_module yasm_dbgfmt_module; |
| 22 |
typedef struct yasm_module yasm_objfmt_module; |
| 23 |
typedef struct yasm_module yasm_listfmt_module; |
| 24 |
typedef struct yasm_module yasm_optimizer_module; |
| 25 |
|
| 26 |
typedef struct module { |
| 27 |
void *data; |
| 28 |
} module; |
| 29 |
|
| 30 |
static struct { |
| 31 |
module *m; |
| 32 |
int n; |
| 33 |
} module_types[] = { |
| 34 |
{}, |
| 35 |
}; |
| 36 |
|
| 37 |
void |
| 38 |
yasm_list_modules(yasm_module_type type, |
| 39 |
void (*printfunc) (const char *name)) |
| 40 |
{ |
| 41 |
int i; |
| 42 |
module *modules = module_types[type].m; |
| 43 |
yasm_arch_module *arch; |
| 44 |
yasm_dbgfmt_module *dbgfmt; |
| 45 |
yasm_objfmt_module *objfmt; |
| 46 |
yasm_listfmt_module *listfmt; |
| 47 |
yasm_optimizer_module *optimizer; |
| 48 |
|
| 49 |
for (i=0; i<2; i++) { |
| 50 |
switch (type) { |
| 51 |
case YASM_MODULE_ARCH: |
| 52 |
arch = modules[i].data; |
| 53 |
printfunc(arch->name); |
| 54 |
break; |
| 55 |
case YASM_MODULE_DBGFMT: |
| 56 |
dbgfmt = modules[i].data; |
| 57 |
printfunc(dbgfmt->name); |
| 58 |
break; |
| 59 |
case YASM_MODULE_OBJFMT: |
| 60 |
objfmt = modules[i].data; |
| 61 |
printfunc(objfmt->name); |
| 62 |
break; |
| 63 |
case YASM_MODULE_LISTFMT: |
| 64 |
listfmt = modules[i].data; |
| 65 |
printfunc(listfmt->name); |
| 66 |
break; |
| 67 |
case YASM_MODULE_OPTIMIZER: |
| 68 |
optimizer = modules[i].data; |
| 69 |
printfunc(optimizer->name); |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
int |
| 75 |
main() {} |