зеркало из https://github.com/mozilla/pjs.git
Added -gtszapsymbol and -gtsnozapsymbol for manually overriding the
implicit rules. See gtscc -help.
This commit is contained in:
Родитель
86af4aeb6b
Коммит
0d8aeda785
|
@ -543,6 +543,42 @@ safe_fgets(char* buf, unsigned size, FILE* fp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
EhSymTableSetSymbolState(EhSymTable* table, char* name, EhSymState new_state)
|
||||||
|
{
|
||||||
|
EhSym* sym = EhSymTableFind(table, name);
|
||||||
|
|
||||||
|
if (sym == NULL) {
|
||||||
|
sym = EhSymNewDefined(name, NULL);
|
||||||
|
|
||||||
|
EhSymTableInsert(table, sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* new_state must be EH_SYM_DEFINED || EH_SYM_ZAPPED */
|
||||||
|
if (sym->state == EH_SYM_DEFINED || sym->state == EH_SYM_ZAPPED) {
|
||||||
|
sym->state = new_state;
|
||||||
|
} else if (sym->state == EH_SYM_INLINE) {
|
||||||
|
char* state_name;
|
||||||
|
if (new_state == EH_SYM_DEFINED)
|
||||||
|
state_name = "global";
|
||||||
|
else
|
||||||
|
state_name = "static";
|
||||||
|
fprintf(stderr,
|
||||||
|
"WARNING: Symbol %s is an inline.\n"
|
||||||
|
" Forcing the symbol %s will be ignored.\n",
|
||||||
|
name,
|
||||||
|
state_name);
|
||||||
|
} else { /* EH_SYM_UNDEFINED */
|
||||||
|
/*
|
||||||
|
* This call is being made after objects have started being
|
||||||
|
* read. This is too late. I'm not sure I care though.
|
||||||
|
*/
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
EhSymTableFpLoad(EhSymTable* table, FILE* fp)
|
EhSymTableFpLoad(EhSymTable* table, FILE* fp)
|
||||||
{
|
{
|
||||||
|
@ -2386,6 +2422,8 @@ usage(void)
|
||||||
"gtscc [gtscc_options] [compiler_options] -c file.c file.cpp ...\n"
|
"gtscc [gtscc_options] [compiler_options] -c file.c file.cpp ...\n"
|
||||||
"gtscc_options:\n"
|
"gtscc_options:\n"
|
||||||
"-gtsfile <db.gts> the gts database file (use this)\n"
|
"-gtsfile <db.gts> the gts database file (use this)\n"
|
||||||
|
"-gtszapsymbol <name> convert symbol <name>\n"
|
||||||
|
"-gtsnozapsymbol <name> don't convert symbol <name>\n"
|
||||||
"-gtsrootdir <directory> the root for the tree (use this)\n"
|
"-gtsrootdir <directory> the root for the tree (use this)\n"
|
||||||
"-gtsverbose be more verbose (3 levels)\n"
|
"-gtsverbose be more verbose (3 levels)\n"
|
||||||
"-gtsnozap don't convert globals to statics\n"
|
"-gtsnozap don't convert globals to statics\n"
|
||||||
|
@ -2394,6 +2432,8 @@ usage(void)
|
||||||
"gtscc [gtscc_options] [linker_options] file.o ... libxx.a ...\n"
|
"gtscc [gtscc_options] [linker_options] file.o ... libxx.a ...\n"
|
||||||
"gtscc_options:\n"
|
"gtscc_options:\n"
|
||||||
"-gtsfile <db.gts> the gts database file (use this)\n"
|
"-gtsfile <db.gts> the gts database file (use this)\n"
|
||||||
|
"-gtszapsymbol <name> convert symbol <name>\n"
|
||||||
|
"-gtsnozapsymbol <name> don't convert symbol <name>\n"
|
||||||
"-gtsrootdir <directory> the root for the tree (use this)\n"
|
"-gtsrootdir <directory> the root for the tree (use this)\n"
|
||||||
"-gtspref <directory> please recompile these paths first\n"
|
"-gtspref <directory> please recompile these paths first\n"
|
||||||
"-gtsunpref <directory> please try to avoid recompiling these\n"
|
"-gtsunpref <directory> please try to avoid recompiling these\n"
|
||||||
|
@ -2563,6 +2603,26 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
|
} else if (strcmp(argv[n], "-gtszapsymbol") == 0) {
|
||||||
|
if (argc < n+2) {
|
||||||
|
fprintf(stderr, "-gtszapsymbol requires an argument\n");
|
||||||
|
usage();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
EhSymTableSetSymbolState(table, argv[n+1], EH_SYM_ZAPPED);
|
||||||
|
n++;
|
||||||
|
|
||||||
|
} else if (strcmp(argv[n], "-gtsnozapsymbol") == 0) {
|
||||||
|
if (argc < n+2) {
|
||||||
|
fprintf(stderr, "-gtsnozapsymbol requires an argument\n");
|
||||||
|
usage();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
EhSymTableSetSymbolState(table, argv[n+1], EH_SYM_DEFINED);
|
||||||
|
n++;
|
||||||
|
|
||||||
} else if (strcmp(argv[n], "-gtsname") == 0) {
|
} else if (strcmp(argv[n], "-gtsname") == 0) {
|
||||||
if (argc < n+2) {
|
if (argc < n+2) {
|
||||||
fprintf(stderr, "-gtsname requires an argument\n");
|
fprintf(stderr, "-gtsname requires an argument\n");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче