diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-16 22:14:50 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-16 22:15:34 -0700 |
commit | 21d6be423f0bbe921fe67d454eceeb39e5e6c773 (patch) | |
tree | 24e8fc82fc0d82fd1b3afa2d52a4947c95d1bc1c /output | |
parent | 9e8e948f86d3529c44f99e20b6031436df2cbb62 (diff) | |
download | nasm-21d6be423f0bbe921fe67d454eceeb39e5e6c773.tar.gz nasm-21d6be423f0bbe921fe67d454eceeb39e5e6c773.tar.bz2 nasm-21d6be423f0bbe921fe67d454eceeb39e5e6c773.zip |
Minor fixes needed to compile with MSVC++ 2005
Minor fixes to make it possible to compile with MS Visual C++ 2005.
Unfortunately, MSVC++ is not fully C99 compliant; in particular, it
doesn't handle interspersed declarations and other code. Furthermore,
it chokes on some expressions in outelf64.c, which fortunately can be
easily substituted with simpler expressions.
Diffstat (limited to 'output')
-rw-r--r-- | output/outbin.c | 3 | ||||
-rw-r--r-- | output/outelf32.c | 15 | ||||
-rw-r--r-- | output/outelf64.c | 15 | ||||
-rw-r--r-- | output/outmacho.c | 5 | ||||
-rw-r--r-- | output/outrdf2.c | 10 |
5 files changed, 25 insertions, 23 deletions
diff --git a/output/outbin.c b/output/outbin.c index 0dfc3d8..a1c51c8 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -206,7 +206,6 @@ static struct Section *create_section(char *name) static void bin_cleanup(int debuginfo) { - (void)debuginfo; /* placate optimizers */ struct Section *g, **gp; struct Section *gs = NULL, **gsp; struct Section *s, **sp; @@ -217,6 +216,8 @@ static void bin_cleanup(int debuginfo) uint64_t pend; int h; + (void)debuginfo; /* placate optimizers */ + #ifdef DEBUG fprintf(stdout, "bin_cleanup: Sections were initially referenced in this order:\n"); diff --git a/output/outelf32.c b/output/outelf32.c index 35d5ac6..fbc98d6 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -203,8 +203,8 @@ void stabs32_deflabel(char *, int32_t, int32_t, int, char *); void stabs32_directive(const char *, const char *); void stabs32_typevalue(int32_t); void stabs32_output(int, void *); -void stabs32_generate(); -void stabs32_cleanup(); +void stabs32_generate(void); +void stabs32_cleanup(void); /* end of stabs debugging stuff */ @@ -1256,10 +1256,10 @@ static int32_t elf_segbase(int32_t segment) static int elf_directive(char *directive, char *value, int pass) { - (void)directive; - (void)value; - (void)pass; - return 0; + (void)directive; + (void)value; + (void)pass; + return 0; } static void elf_filename(char *inname, char *outname, efunc error) @@ -1344,6 +1344,7 @@ void stabs32_init(struct ofmt *of, void *id, FILE * fp, efunc error) void stabs32_linenum(const char *filename, int32_t linenumber, int32_t segto) { (void)segto; + if (!stabs_filename) { stabs_filename = (char *)nasm_malloc(strlen(filename) + 1); strcpy(stabs_filename, filename); @@ -1555,7 +1556,7 @@ void stabs32_generate(void) stabstrbuf = ssbuf; } -void stabs32_cleanup() +void stabs32_cleanup(void) { struct linelist *ptr, *del; if (!stabslines) diff --git a/output/outelf64.c b/output/outelf64.c index 554ed5e..4424d81 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -215,8 +215,8 @@ void stabs64_deflabel(char *, int32_t, int32_t, int, char *); void stabs64_directive(const char *, const char *); void stabs64_typevalue(int32_t); void stabs64_output(int, void *); -void stabs64_generate(); -void stabs64_cleanup(); +void stabs64_generate(void); +void stabs64_cleanup(void); /* end of stabs debugging stuff */ @@ -1291,7 +1291,7 @@ static int elf_directive(char *directive, char *value, int pass) (void)directive; (void)value; (void)pass; - return 0; + return 0; } static void elf_filename(char *inname, char *outname, efunc error) @@ -1525,7 +1525,8 @@ void stabs64_generate(void) /* member must be adjusted by adding 3 */ WRITEDLONG(rptr, (int64_t)(sptr - sbuf) - 4); - WRITEDLONG(rptr, ((int64_t)(ptr->info.section + 3) << 32) | R_X86_64_32); + WRITELONG(rptr, R_X86_64_32); + WRITELONG(rptr, ptr->info.section + 3); numstabs++; currfile = mainfileindex; @@ -1545,7 +1546,8 @@ void stabs64_generate(void) /* relocation table entry */ WRITEDLONG(rptr, (int64_t)(sptr - sbuf) - 4); - WRITEDLONG(rptr, ((int64_t)(ptr->info.section + 3) << 32) | R_X86_64_32); + WRITELONG(rptr, R_X86_64_32); + WRITELONG(rptr, ptr->info.section + 3); } WRITE_STAB(sptr, 0, N_SLINE, 0, ptr->line, ptr->info.offset); @@ -1554,7 +1556,8 @@ void stabs64_generate(void) /* relocation table entry */ WRITEDLONG(rptr, (int64_t)(sptr - sbuf) - 4); - WRITEDLONG(rptr, ((int64_t)(ptr->info.section + 3) << 32) | R_X86_64_32); + WRITELONG(rptr, R_X86_64_32); + WRITELONG(rptr, ptr->info.section + 3); ptr = ptr->next; diff --git a/output/outmacho.c b/output/outmacho.c index 7efdc71..86700f8 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -522,14 +522,13 @@ static void macho_output(int32_t secto, const void *data, uint32_t type, static int32_t macho_section(char *name, int pass, int *bits) { - - (void)pass; - int32_t index, originalIndex; char *sectionAttributes; struct sectmap *sm; struct section *s; + (void)pass; + /* Default to 32 bits. */ if (!name) { *bits = 32; diff --git a/output/outrdf2.c b/output/outrdf2.c index 7fb4615..c98bead 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -84,14 +84,13 @@ static int32_t headerlength; static void rdf2_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) { - + int segtext, segdata, segbss; + (void)ldef; (void)eval; maxbits = 64; - int segtext, segdata, segbss; - /* set up the initial segments */ segments[0].segname = ".text"; segments[0].segnumber = 0; @@ -135,14 +134,13 @@ static void rdf2_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) static int32_t rdf2_section_names(char *name, int pass, int *bits) { - - (void)pass; - int i; char *p, *q; int code = -1; int reserved = 0; + (void)pass; + /* * Default is 32 bits, in the text segment. */ |