Remove some unused-parameter lint

Mark TCCState parameter as unused in tcc_undefine_symbol(), tcc_add_symbol(),
tcc_print_stats(), asm_get_local_label_name(), use_section1(), tccpp_delete(),
tcc_tool_ar(), tcc_tool_impdef(), and tcc_tool_cross().
Also mark it unused in tcc_add_bcheck() unless CONFIG_TCC_BCHECK.
Remove it entirely in ld_next().
master
Larry Doolittle 2017-05-08 08:30:43 -07:00
parent 56df27502c
commit 7443db0d5f
5 changed files with 21 additions and 9 deletions

View File

@ -702,6 +702,7 @@ LIBTCCAPI void tcc_undefine_symbol(TCCState *s1, const char *sym)
{
TokenSym *ts;
Sym *s;
(void) s1; /* not used */
ts = tok_alloc(sym, strlen(sym));
s = define_find(ts->tok);
/* undefine symbol by putting an invalid name */
@ -1191,6 +1192,7 @@ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val)
So it is handled here as if it were in a DLL. */
pe_putimport(s, 0, name, (uintptr_t)val);
#else
(void) s; /* not used */
set_elf_sym(symtab_section, (uintptr_t)val, 0,
ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0,
SHN_ABS, name);
@ -1984,6 +1986,7 @@ LIBTCCAPI void tcc_set_options(TCCState *s, const char *r)
PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time)
{
(void) s; /* not used */
if (total_time < 1)
total_time = 1;
if (total_bytes < 1)

View File

@ -26,6 +26,7 @@ ST_FUNC int asm_get_local_label_name(TCCState *s1, unsigned int n)
char buf[64];
TokenSym *ts;
(void) s1; /* not used */
snprintf(buf, sizeof(buf), "L..%u", n);
ts = tok_alloc(buf, strlen(buf));
return ts->tok;
@ -434,6 +435,7 @@ static void asm_free_labels(TCCState *st)
static void use_section1(TCCState *s1, Section *sec)
{
(void) s1; /* not used */
cur_text_section->data_offset = ind;
cur_text_section = sec;
ind = cur_text_section->data_offset;

View File

@ -1127,6 +1127,8 @@ ST_FUNC void tcc_add_bcheck(TCCState *s1)
init_section->data_offset - 4, R_386_PC32, sym_index);
/* R_386_PC32 = R_X86_64_PC32 = 2 */
}
#else
(void) s1; /* not used */
#endif
}
@ -2758,7 +2760,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
#define LD_TOK_EOF (-1)
/* return next ld script token */
static int ld_next(TCCState *s1, char *name, int name_size)
static int ld_next(char *name, int name_size)
{
int c;
char *q;
@ -2903,10 +2905,10 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed)
group = !strcmp(cmd, "GROUP");
if (!as_needed)
new_undef_syms();
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
if (t != '(')
expect("(");
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
for(;;) {
libname[0] = '\0';
if (t == LD_TOK_EOF) {
@ -2916,7 +2918,7 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed)
} else if (t == ')') {
break;
} else if (t == '-') {
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
if ((t != LD_TOK_NAME) || (filename[0] != 'l')) {
tcc_error_noabort("library name expected");
ret = -1;
@ -2951,9 +2953,9 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed)
}
}
}
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
if (t == ',') {
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
}
}
if (group && !as_needed) {
@ -2979,7 +2981,7 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
ch = handle_eob();
for(;;) {
t = ld_next(s1, cmd, sizeof(cmd));
t = ld_next(cmd, sizeof(cmd));
if (t == LD_TOK_EOF)
return 0;
else if (t != LD_TOK_NAME)
@ -2992,11 +2994,11 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
} else if (!strcmp(cmd, "OUTPUT_FORMAT") ||
!strcmp(cmd, "TARGET")) {
/* ignore some commands */
t = ld_next(s1, cmd, sizeof(cmd));
t = ld_next(cmd, sizeof(cmd));
if (t != '(')
expect("(");
for(;;) {
t = ld_next(s1, filename, sizeof(filename));
t = ld_next(filename, sizeof(filename));
if (t == LD_TOK_EOF) {
tcc_error_noabort("unexpected end of file");
return -1;

View File

@ -3557,6 +3557,7 @@ ST_FUNC void tccpp_delete(TCCState *s)
{
int i, n;
(void) s; /* not used */
/* free -D and compiler defines */
free_defines(NULL);

View File

@ -104,6 +104,7 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv)
const char *ops_conflict = "habdioptxN"; // unsupported but destructive if ignored.
int verbose = 0;
(void) s1; /* not used */
i_lib = 0; i_obj = 0; // will hold the index of the lib and first obj
for (i = 1; i < argc; i++) {
const char *a = argv[i];
@ -321,6 +322,7 @@ ST_FUNC int tcc_tool_impdef(TCCState *s1, int argc, char **argv)
p = NULL;
v = 0;
(void) s1; /* not used */
for (i = 1; i < argc; ++i) {
const char *a = argv[i];
if ('-' == a[0]) {
@ -433,6 +435,7 @@ the_end:
ST_FUNC void tcc_tool_cross(TCCState *s, char **argv, int option)
{
(void) s; (void) argv; /* not used */
tcc_error("-m%d not implemented.", option);
}
@ -486,6 +489,7 @@ ST_FUNC void tcc_tool_cross(TCCState *s, char **argv, int target)
char *a0 = argv[0];
int prefix = tcc_basename(a0) - a0;
(void) s; /* not used */
snprintf(program, sizeof program,
"%.*s%s"
#ifdef TCC_TARGET_PE