>> They do implement inline asm() nowadays, but alas not &&label and
>> computed gotos.
>
> The only places I've seen &&label used
In the kernel or elsewhere? It's certainly useful.
Here it's used to make up for 'case' not supporting
strings, avoiding a cascade of 'else if'.
///////////////////////////////////////////////////////////////////////
static const char *set_personality(void){
char *s;
size_t sl;
char buf[16];
personality_table_struct findme = { buf, NULL};
personality_table_struct *found;
static const personality_table_struct personality_table[] = {
{"390", &&case_390},
{"aix", &&case_aix},
{"gnu", &&case_gnu},
{"hp", &&case_hp},
{"hpux", &&case_hpux},
{"irix", &&case_irix},
{"os390", &&case_os390},
{"s390", &&case_s390},
{"sco", &&case_sco},
{"sgi", &&case_sgi},
{"unknown", &&case_unknown}
};
const int personality_table_count
= sizeof(personality_table)/sizeof(personality_table_struct);
personality = 0;
s = getenv("CMD_ENV");
if(!s || !*s) s="unknown"; /* "Do The Right Thing[tm]" */
sl = strlen(s);
if(sl > 15) return "Environment specified an unknown personality.";
strncpy(buf, s, sl);
buf[sl] = '\0';
saved_personality_text = strdup(buf);
found = bsearch(&findme, personality_table, personality_table_count,
sizeof(personality_table_struct), compare_personality_table_structs
);
if(!found) return "Environment specified an unknown personality.";
goto *(found->jump); /* See gcc extension info. :-) */
case_gnu:
personality = PER_GOOD_o | PER_CUMUL_MARKED | PER_OLD_m;
// other stuff...
return NULL;
case_unknown: /* defaults, but also check inferior environment variables */
if(
getenv("UNIX95") /* Irix */
|| getenv("POSIXLY_CORRECT") /* most gnu stuff */
|| (getenv("POSIX2") && !strcmp(getenv("POSIX2"), "on")) /* Unixware 7 */
) personality = PER_BROKEN_o;
return NULL;
case_aix:
// blah, blah...
return NULL;
case_irix:
case_sgi:
s = getenv("_XPG");
if(s && s[0]>'0' && s[0]<='9') personality = PER_BROKEN_o;
else personality = PER_IRIX_l;
return NULL;
case_os390: /* IBM's OS/390 OpenEdition on the S/390 mainframe */
case_s390:
case_390:
personality = PER_390_j;
return NULL;
case_hp:
case_hpux:
case_sco:
personality = PER_BROKEN_o;
return NULL;
}
//////////////////////////////////////////////////////////////////
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/