From ac06133ed24c10137d43fe5bc3440dcc8cadd594 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 31 Mar 2017 11:41:16 -0700 Subject: [PATCH] output: remove the completely unused set_info method Every single backend has this method set to NULL. It is also a rather strange interface. Signed-off-by: H. Peter Anvin --- asm/nasm.c | 9 +++------ include/nasm.h | 11 ----------- output/nullout.c | 7 ------- output/outaout.c | 2 -- output/outas86.c | 1 - output/outbin.c | 10 ---------- output/outcoff.c | 9 --------- output/outdbg.c | 8 -------- output/outelf.c | 10 ---------- output/outieee.c | 9 --------- output/outlib.h | 1 - output/outmacho.c | 2 -- output/outobj.c | 9 --------- output/outrdf2.c | 8 -------- 14 files changed, 3 insertions(+), 93 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 4a5c3ec8..a3405965 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -935,7 +935,6 @@ static bool process_arg(char *p, char *q, int pass) } switch (s) { - case OPT_PREFIX: case OPT_POSTFIX: { @@ -959,8 +958,7 @@ static bool process_arg(char *p, char *q, int pass) strlcpy(lpostfix, param, POSTFIX_MAX); break; default: - nasm_panic(ERR_NOFILE, - "internal error"); + panic(); break; } break; @@ -977,9 +975,8 @@ static bool process_arg(char *p, char *q, int pass) } default: - if (!ofmt->setinfo(GI_SWITCH, &p)) - nasm_error(ERR_NONFATAL | ERR_NOFILE | ERR_USAGE, - "unrecognised option `-%c'", p[1]); + nasm_error(ERR_NONFATAL | ERR_NOFILE | ERR_USAGE, + "unrecognised option `-%c'", p[1]); break; } } else if (pass == 2) { diff --git a/include/nasm.h b/include/nasm.h index 61e56344..0ce9581c 100644 --- a/include/nasm.h +++ b/include/nasm.h @@ -696,8 +696,6 @@ typedef struct insn { /* an instruction itself */ int8_t evex_brerop; /* BR/ER/SAE operand position */ } insn; -enum geninfo { GI_SWITCH }; - /* Instruction flags type: IF_* flags are defined in insns.h */ typedef uint64_t iflags_t; @@ -802,15 +800,6 @@ struct ofmt { void (*init)(void); /* - * This procedure is called to pass generic information to the - * object file. The first parameter gives the information type - * (currently only command line switches) - * and the second parameter gives the value. This function returns - * 1 if recognized, 0 if unrecognized - */ - int (*setinfo)(enum geninfo type, char **string); - - /* * This is the modern output function, which gets passed * a struct out_data with much more information. See the * definition of struct out_data. diff --git a/output/nullout.c b/output/nullout.c index 862c0083..60401950 100644 --- a/output/nullout.c +++ b/output/nullout.c @@ -35,13 +35,6 @@ #include "nasmlib.h" #include "outlib.h" -int null_setinfo(enum geninfo type, char **string) -{ - (void)type; - (void)string; - return 0; -} - enum directive_result null_directive(enum directives directive, char *value, int pass) { diff --git a/output/outaout.c b/output/outaout.c index 0e3349d1..83859d97 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -914,7 +914,6 @@ const struct ofmt of_aout = { &null_debug_form, aout_stdmac, aout_init, - null_setinfo, nasm_do_legacy_output, aout_out, aout_deflabel, @@ -940,7 +939,6 @@ const struct ofmt of_aoutb = { &null_debug_form, aout_stdmac, aoutb_init, - null_setinfo, nasm_do_legacy_output, aout_out, aout_deflabel, diff --git a/output/outas86.c b/output/outas86.c index 15be1ea2..59b10e71 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -635,7 +635,6 @@ const struct ofmt of_as86 = { &null_debug_form, as86_stdmac, as86_init, - null_setinfo, nasm_do_legacy_output, as86_out, as86_deflabel, diff --git a/output/outbin.c b/output/outbin.c index 6100ceb1..af07e0fe 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -1397,13 +1397,6 @@ static int32_t bin_segbase(int32_t segment) return segment; } -static int bin_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - return 0; -} - const struct ofmt of_bin, of_ith, of_srec; static void binfmt_init(void); static void do_output_bin(void); @@ -1663,7 +1656,6 @@ const struct ofmt of_bin = { &null_debug_form, bin_stdmac, bin_init, - bin_set_info, nasm_do_legacy_output, bin_out, bin_deflabel, @@ -1685,7 +1677,6 @@ const struct ofmt of_ith = { &null_debug_form, bin_stdmac, ith_init, - bin_set_info, nasm_do_legacy_output, bin_out, bin_deflabel, @@ -1707,7 +1698,6 @@ const struct ofmt of_srec = { &null_debug_form, bin_stdmac, srec_init, - bin_set_info, nasm_do_legacy_output, bin_out, bin_deflabel, diff --git a/output/outcoff.c b/output/outcoff.c index 86a7ff85..99ded314 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -1158,12 +1158,6 @@ static void coff_win32_filename(char *inname, char *outname) extern macros_t coff_stdmac[]; -static int coff_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - return 0; -} #endif /* defined(OF_COFF) || defined(OF_WIN32) */ #ifdef OF_COFF @@ -1177,7 +1171,6 @@ const struct ofmt of_coff = { &null_debug_form, coff_stdmac, coff_std_init, - coff_set_info, nasm_do_legacy_output, coff_out, coff_deflabel, @@ -1207,7 +1200,6 @@ const struct ofmt of_win32 = { &df_cv8, coff_stdmac, coff_win32_init, - coff_set_info, nasm_do_legacy_output, coff_out, coff_deflabel, @@ -1235,7 +1227,6 @@ const struct ofmt of_win64 = { &df_cv8, coff_stdmac, coff_win64_init, - coff_set_info, nasm_do_legacy_output, coff_out, coff_deflabel, diff --git a/output/outdbg.c b/output/outdbg.c index 20088ba9..5608b446 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -321,13 +321,6 @@ static void dbg_filename(char *inname, char *outname) standard_extension(inname, outname, ".dbg"); } -static int dbg_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - return 0; -} - static const char * const types[] = { "unknown", "label", "byte", "word", "dword", "float", "qword", "tbyte" }; @@ -405,7 +398,6 @@ const struct ofmt of_dbg = { &debug_debug_form, NULL, dbg_init, - dbg_set_info, dbg_out, dbg_legacy_out, dbg_deflabel, diff --git a/output/outelf.c b/output/outelf.c index e1cba760..6a1101d1 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -2207,13 +2207,6 @@ static void elf_filename(char *inname, char *outname) extern macros_t elf_stdmac[]; -static int elf_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - return 0; -} - /* Claim "elf" as a pragma namespace, for the future */ static const struct pragma_facility elf_pragma_list[] = { @@ -2260,7 +2253,6 @@ const struct ofmt of_elf32 = { &elf32_df_stabs, elf_stdmac, elf_init, - elf_set_info, nasm_do_legacy_output, elf32_out, elf_deflabel, @@ -2311,7 +2303,6 @@ const struct ofmt of_elf64 = { &elf64_df_stabs, elf_stdmac, elf_init, - elf_set_info, nasm_do_legacy_output, elf64_out, elf_deflabel, @@ -2362,7 +2353,6 @@ const struct ofmt of_elfx32 = { &elfx32_df_stabs, elf_stdmac, elf_init, - elf_set_info, nasm_do_legacy_output, elfx32_out, elf_deflabel, diff --git a/output/outieee.c b/output/outieee.c index a043ec51..165e9f74 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -224,14 +224,6 @@ static void ieee_init(void) checksum = 0; } -static int ieee_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - - return 0; -} - /* * Rundown */ @@ -1524,7 +1516,6 @@ const struct ofmt of_ieee = { &ladsoft_debug_form, NULL, ieee_init, - ieee_set_info, nasm_do_legacy_output, ieee_out, ieee_deflabel, diff --git a/output/outlib.h b/output/outlib.h index 2406978c..ef594422 100644 --- a/output/outlib.h +++ b/output/outlib.h @@ -40,7 +40,6 @@ uint64_t realsize(enum out_type type, uint64_t size); /* Do-nothing versions of some output routines */ -int null_setinfo(enum geninfo type, char **string); enum directive_result null_directive(enum directives directive, char *value, int pass); void null_sectalign(int32_t seg, unsigned int value); diff --git a/output/outmacho.c b/output/outmacho.c index 0f42f4b1..76de154a 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1756,7 +1756,6 @@ const struct ofmt of_macho32 = { &null_debug_form, macho_stdmac, macho32_init, - null_setinfo, nasm_do_legacy_output, macho_output, macho_symdef, @@ -1805,7 +1804,6 @@ const struct ofmt of_macho64 = { &null_debug_form, macho_stdmac, macho64_init, - null_setinfo, nasm_do_legacy_output, macho_output, macho_symdef, diff --git a/output/outobj.c b/output/outobj.c index 1f9cac31..6e01e247 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -663,14 +663,6 @@ static void obj_init(void) current_seg = NULL; } -static int obj_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - - return 0; -} - static void obj_cleanup(void) { obj_write_file(); @@ -2666,7 +2658,6 @@ const struct ofmt of_obj = { &borland_debug_form, obj_stdmac, obj_init, - obj_set_info, nasm_do_legacy_output, obj_out, obj_deflabel, diff --git a/output/outrdf2.c b/output/outrdf2.c index 1491fd25..30d047b1 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -767,13 +767,6 @@ static void rdf2_filename(char *inname, char *outname) extern macros_t rdf2_stdmac[]; -static int rdf2_set_info(enum geninfo type, char **val) -{ - (void)type; - (void)val; - return 0; -} - const struct ofmt of_rdf2 = { "Relocatable Dynamic Object File Format v2.0", "rdf", @@ -783,7 +776,6 @@ const struct ofmt of_rdf2 = { &null_debug_form, rdf2_stdmac, rdf2_init, - rdf2_set_info, nasm_do_legacy_output, rdf2_out, rdf2_deflabel, -- 2.11.4.GIT