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().
This commit is contained in:
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; TokenSym *ts;
Sym *s; Sym *s;
(void) s1; /* not used */
ts = tok_alloc(sym, strlen(sym)); ts = tok_alloc(sym, strlen(sym));
s = define_find(ts->tok); s = define_find(ts->tok);
/* undefine symbol by putting an invalid name */ /* 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. */ So it is handled here as if it were in a DLL. */
pe_putimport(s, 0, name, (uintptr_t)val); pe_putimport(s, 0, name, (uintptr_t)val);
#else #else
(void) s; /* not used */
set_elf_sym(symtab_section, (uintptr_t)val, 0, set_elf_sym(symtab_section, (uintptr_t)val, 0,
ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0, ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0,
SHN_ABS, name); 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) PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time)
{ {
(void) s; /* not used */
if (total_time < 1) if (total_time < 1)
total_time = 1; total_time = 1;
if (total_bytes < 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]; char buf[64];
TokenSym *ts; TokenSym *ts;
(void) s1; /* not used */
snprintf(buf, sizeof(buf), "L..%u", n); snprintf(buf, sizeof(buf), "L..%u", n);
ts = tok_alloc(buf, strlen(buf)); ts = tok_alloc(buf, strlen(buf));
return ts->tok; return ts->tok;
@ -434,6 +435,7 @@ static void asm_free_labels(TCCState *st)
static void use_section1(TCCState *s1, Section *sec) static void use_section1(TCCState *s1, Section *sec)
{ {
(void) s1; /* not used */
cur_text_section->data_offset = ind; cur_text_section->data_offset = ind;
cur_text_section = sec; cur_text_section = sec;
ind = cur_text_section->data_offset; 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); init_section->data_offset - 4, R_386_PC32, sym_index);
/* R_386_PC32 = R_X86_64_PC32 = 2 */ /* R_386_PC32 = R_X86_64_PC32 = 2 */
} }
#else
(void) s1; /* not used */
#endif #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) #define LD_TOK_EOF (-1)
/* return next ld script token */ /* 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; int c;
char *q; char *q;
@ -2903,10 +2905,10 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed)
group = !strcmp(cmd, "GROUP"); group = !strcmp(cmd, "GROUP");
if (!as_needed) if (!as_needed)
new_undef_syms(); new_undef_syms();
t = ld_next(s1, filename, sizeof(filename)); t = ld_next(filename, sizeof(filename));
if (t != '(') if (t != '(')
expect("("); expect("(");
t = ld_next(s1, filename, sizeof(filename)); t = ld_next(filename, sizeof(filename));
for(;;) { for(;;) {
libname[0] = '\0'; libname[0] = '\0';
if (t == LD_TOK_EOF) { 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 == ')') { } else if (t == ')') {
break; break;
} else if (t == '-') { } else if (t == '-') {
t = ld_next(s1, filename, sizeof(filename)); t = ld_next(filename, sizeof(filename));
if ((t != LD_TOK_NAME) || (filename[0] != 'l')) { if ((t != LD_TOK_NAME) || (filename[0] != 'l')) {
tcc_error_noabort("library name expected"); tcc_error_noabort("library name expected");
ret = -1; 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 == ',') { if (t == ',') {
t = ld_next(s1, filename, sizeof(filename)); t = ld_next(filename, sizeof(filename));
} }
} }
if (group && !as_needed) { if (group && !as_needed) {
@ -2979,7 +2981,7 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
ch = handle_eob(); ch = handle_eob();
for(;;) { for(;;) {
t = ld_next(s1, cmd, sizeof(cmd)); t = ld_next(cmd, sizeof(cmd));
if (t == LD_TOK_EOF) if (t == LD_TOK_EOF)
return 0; return 0;
else if (t != LD_TOK_NAME) else if (t != LD_TOK_NAME)
@ -2992,11 +2994,11 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
} else if (!strcmp(cmd, "OUTPUT_FORMAT") || } else if (!strcmp(cmd, "OUTPUT_FORMAT") ||
!strcmp(cmd, "TARGET")) { !strcmp(cmd, "TARGET")) {
/* ignore some commands */ /* ignore some commands */
t = ld_next(s1, cmd, sizeof(cmd)); t = ld_next(cmd, sizeof(cmd));
if (t != '(') if (t != '(')
expect("("); expect("(");
for(;;) { for(;;) {
t = ld_next(s1, filename, sizeof(filename)); t = ld_next(filename, sizeof(filename));
if (t == LD_TOK_EOF) { if (t == LD_TOK_EOF) {
tcc_error_noabort("unexpected end of file"); tcc_error_noabort("unexpected end of file");
return -1; return -1;

View File

@ -3557,6 +3557,7 @@ ST_FUNC void tccpp_delete(TCCState *s)
{ {
int i, n; int i, n;
(void) s; /* not used */
/* free -D and compiler defines */ /* free -D and compiler defines */
free_defines(NULL); 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. const char *ops_conflict = "habdioptxN"; // unsupported but destructive if ignored.
int verbose = 0; int verbose = 0;
(void) s1; /* not used */
i_lib = 0; i_obj = 0; // will hold the index of the lib and first obj i_lib = 0; i_obj = 0; // will hold the index of the lib and first obj
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
const char *a = argv[i]; const char *a = argv[i];
@ -321,6 +322,7 @@ ST_FUNC int tcc_tool_impdef(TCCState *s1, int argc, char **argv)
p = NULL; p = NULL;
v = 0; v = 0;
(void) s1; /* not used */
for (i = 1; i < argc; ++i) { for (i = 1; i < argc; ++i) {
const char *a = argv[i]; const char *a = argv[i];
if ('-' == a[0]) { if ('-' == a[0]) {
@ -433,6 +435,7 @@ the_end:
ST_FUNC void tcc_tool_cross(TCCState *s, char **argv, int option) 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); 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]; char *a0 = argv[0];
int prefix = tcc_basename(a0) - a0; int prefix = tcc_basename(a0) - a0;
(void) s; /* not used */
snprintf(program, sizeof program, snprintf(program, sizeof program,
"%.*s%s" "%.*s%s"
#ifdef TCC_TARGET_PE #ifdef TCC_TARGET_PE