From 7443db0d5f841b81a55e918bf8c228dd20f9ddb2 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Mon, 8 May 2017 08:30:43 -0700 Subject: [PATCH] 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(). --- libtcc.c | 3 +++ tccasm.c | 2 ++ tccelf.c | 20 +++++++++++--------- tccpp.c | 1 + tcctools.c | 4 ++++ 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libtcc.c b/libtcc.c index 3ce7b29..331baf3 100644 --- a/libtcc.c +++ b/libtcc.c @@ -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) diff --git a/tccasm.c b/tccasm.c index 5356b62..4d93b59 100644 --- a/tccasm.c +++ b/tccasm.c @@ -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; diff --git a/tccelf.c b/tccelf.c index aedc85a..1ca9266 100644 --- a/tccelf.c +++ b/tccelf.c @@ -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; diff --git a/tccpp.c b/tccpp.c index d70ddd6..ed8b81d 100644 --- a/tccpp.c +++ b/tccpp.c @@ -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); diff --git a/tcctools.c b/tcctools.c index ac6850c..55050ad 100644 --- a/tcctools.c +++ b/tcctools.c @@ -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