From 7065309739ef398af07e470469f1ae6f0580200c Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 19 Oct 2007 14:42:29 -0700 Subject: Formatting: kill off "stealth whitespace" "Stealth whitespace" makes it harder to read diffs, and just generally cause unwanted weirdness. Do a source-wide pass to get rid of it. --- assemble.c | 72 +++++++++++++++++++++++++++---------------------------- disasm.c | 6 ++--- doc/genps.pl | 2 +- doc/rdsrc.pl | 21 ++++++++-------- eval.c | 2 +- exprlib.c | 1 - float.c | 11 ++++----- float.h | 2 +- hashtbl.c | 2 +- insns.pl | 46 +++++++++++++++++------------------ labels.c | 4 ++-- lib/snprintf.c | 1 - listing.c | 2 +- macros.pl | 8 +++---- misc/fmtinsns.pl | 2 -- mkdep.pl | 8 +++---- nasm.c | 36 ++++++++++++++-------------- nasm.h | 64 ++++++++++++++++++++++++------------------------- nasmlib.c | 12 +++++----- nasmlib.h | 6 ++--- outform.c | 6 ++--- output/outaout.c | 2 +- output/outas86.c | 2 +- output/outbin.c | 8 +++---- output/outcoff.c | 2 +- output/outieee.c | 12 +++++----- output/outmacho.c | 2 +- output/outobj.c | 2 +- output/outrdf.c | 2 +- output/outrdf2.c | 2 +- pptok.pl | 20 ++++++++-------- preproc.c | 38 ++++++++++++++--------------- rdoff/ldrdf.c | 10 ++++---- rdoff/ldsegs.h | 2 +- rdoff/rdflib.c | 2 +- rdoff/rdlib.c | 4 ++-- rdoff/rdoff.c | 6 ++--- rdoff/rdoff.h | 4 ++-- rdoff/segtab.c | 2 +- regs.pl | 4 ++-- stdscan.c | 1 - test/riprel.pl | 2 -- tokhash.pl | 36 ++++++++++++++-------------- version.pl | 1 - 44 files changed, 235 insertions(+), 245 deletions(-) diff --git a/assemble.c b/assemble.c index b6cab12..2fd9f97 100644 --- a/assemble.c +++ b/assemble.c @@ -417,10 +417,10 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp, add_asp(instruction, bits); size_prob = false; - - for (temp = nasm_instructions[instruction->opcode]; temp->opcode != -1; temp++){ + + for (temp = nasm_instructions[instruction->opcode]; temp->opcode != -1; temp++){ int m = matches(temp, instruction, bits); - + if (m == 99) m += jmp_match(segment, offset, bits, instruction, temp->code); @@ -517,7 +517,7 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp, NO_SEG, NO_SEG); offset++; } - } + } insn_end = offset + insn_size; gencode(segment, offset, bits, instruction, codes, insn_end); @@ -903,8 +903,8 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, break; case 0300: case 0301: - case 0302: - case 0303: + case 0302: + case 0303: break; case 0310: if (bits == 64) @@ -915,7 +915,7 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, length += (bits != 32) && !has_prefix(ins,P_A32); break; case 0312: - break; + break; case 0313: if (bits != 64 || has_prefix(ins,P_A16) || has_prefix(ins,P_A32)) return -1; @@ -978,7 +978,7 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, int rfield; int32_t rflags; ea_data.rex = 0; /* Ensure ea.REX is initially 0 */ - + if (c <= 0177) { /* pick rfield from operand b */ rflags = regflag(&ins->oprs[c & 7]); @@ -1003,7 +1003,7 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, } ins->rex &= rex_mask; - + if (ins->rex & REX_D) { if (ins->rex & REX_H) { errfunc(ERR_NONFATAL, "cannot use high register in drex instruction"); @@ -1053,7 +1053,7 @@ static void gencode(int32_t segment, int32_t offset, int bits, uint8_t bytes[4]; int32_t size; int64_t data; - + while (*codes) switch (c = *codes++) { case 01: @@ -1245,7 +1245,7 @@ static void gencode(int32_t segment, int32_t offset, int bits, out(offset, segment, bytes, OUT_RAWDATA + 1, NO_SEG, NO_SEG); offset += 1; break; - + case 054: case 055: case 056: @@ -1471,13 +1471,13 @@ static void gencode(int32_t segment, int32_t offset, int bits, break; case 0322: - case 0323: - break; - + case 0323: + break; + case 0324: ins->rex |= REX_W; break; - + case 0330: *bytes = *codes++ ^ condval[ins->condition]; out(offset, segment, bytes, OUT_RAWDATA + 1, NO_SEG, NO_SEG); @@ -1549,7 +1549,7 @@ static void gencode(int32_t segment, int32_t offset, int bits, int32_t rflags; uint8_t *p; int32_t s; - + if (c <= 0177) { /* pick rfield from operand b */ rflags = regflag(&ins->oprs[c & 7]); @@ -1565,7 +1565,7 @@ static void gencode(int32_t segment, int32_t offset, int bits, rfield, rflags, ins->forw_ref)) { errfunc(ERR_NONFATAL, "invalid effective address"); } - + p = bytes; *p++ = ea_data.modrm; if (ea_data.sib_present) @@ -1600,7 +1600,7 @@ static void gencode(int32_t segment, int32_t offset, int bits, } s++; break; - case 8: + case 8: case 2: case 4: data = ins->oprs[(c >> 3) & 7].offset; @@ -1690,7 +1690,7 @@ static int matches(const struct itemplate *itemp, insn * instruction, int bits) for (i = 0; i < itemp->operands; i++) if (instruction->oprs[i].type & ~itemp->opd[i] & (COLON | TO)) return 0; - + /* * Check that the operand flags all match up */ @@ -1781,7 +1781,7 @@ static int matches(const struct itemplate *itemp, insn * instruction, int bits) for (i = 0; i < MAX_OPERANDS; i++) size[i] = asize; } - + if (itemp->flags & (IF_SM | IF_SM2)) { oprs = (itemp->flags & IF_SM2 ? 2 : itemp->operands); asize = 0; @@ -1808,7 +1808,7 @@ static int matches(const struct itemplate *itemp, insn * instruction, int bits) */ if (((itemp->flags & IF_PLEVEL) > cpu)) return 3; - + /* * Check if instruction is available in long mode */ @@ -1844,7 +1844,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, if (REG_EA & ~f) return NULL; /* Invalid EA register */ - + output->rex |= op_rexflags(input, REX_B|REX_P|REX_W|REX_H); output->sib_present = false; /* no SIB necessary */ @@ -1883,7 +1883,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, if (s == 0) i = -1; /* make this easy, at least */ - + if (i >= EXPR_REG_START && i < REG_ENUM_LIMIT) { it = regvals[i]; ix = reg_flags[i]; @@ -1891,7 +1891,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, it = -1; ix = 0; } - + if (b != -1 && b >= EXPR_REG_START && b < REG_ENUM_LIMIT) { bt = regvals[b]; bx = reg_flags[b]; @@ -1899,7 +1899,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, bt = -1; bx = 0; } - + /* check for a 32/64-bit memory reference... */ if ((ix|bx) & (BITS32|BITS64)) { /* it must be a 32/64-bit memory reference. Firstly we have @@ -1920,7 +1920,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, return NULL; /* Invalid size */ sok &= ~bx; } - + /* While we're here, ensure the user didn't specify WORD. */ if (input->addr_size == 16 || (input->addr_size == 32 && !(sok & BITS32)) || @@ -1964,7 +1964,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, if (it == -1 && (bt & 7) != REG_NUM_ESP) { /* no SIB needed */ int mod, rm; - + if (bt == -1) { rm = 5; mod = 0; @@ -1990,12 +1990,12 @@ static ea *process_ea(operand * input, ea * output, int addrbits, } else { /* we need a SIB */ int mod, scale, index, base; - + if (it == -1) index = 4, s = 1; else index = (it & 7); - + switch (s) { case 1: scale = 0; @@ -2012,7 +2012,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, default: /* then what the smeg is it? */ return NULL; /* panic */ } - + if (bt == -1) { base = 5; mod = 0; @@ -2039,7 +2039,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, } } else { /* it's 16-bit */ int mod, rm; - + /* check for 64-bit long mode */ if (addrbits == 64) return NULL; @@ -2125,7 +2125,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits, } } } - + output->size = 1 + output->sib_present + output->bytes; return output; } @@ -2139,21 +2139,21 @@ static void add_asp(insn *instruction, int addrbits) for (j = 0; j < instruction->operands; j++) { if (!(MEMORY & ~instruction->oprs[j].type)) { int32_t i, b; - + /* Verify as Register */ if (instruction->oprs[j].indexreg < EXPR_REG_START || instruction->oprs[j].indexreg >= REG_ENUM_LIMIT) i = 0; else i = reg_flags[instruction->oprs[j].indexreg]; - + /* Verify as Register */ if (instruction->oprs[j].basereg < EXPR_REG_START || instruction->oprs[j].basereg >= REG_ENUM_LIMIT) b = 0; else b = reg_flags[instruction->oprs[j].basereg]; - + if (instruction->oprs[j].scale == 0) i = 0; @@ -2167,7 +2167,7 @@ static void add_asp(insn *instruction, int addrbits) valid &= 32; if (!(REG64 & ~b)) valid &= 64; - + if (!(REG16 & ~i)) valid &= 16; if (!(REG32 & ~i)) diff --git a/disasm.c b/disasm.c index d541ac5..db4d517 100644 --- a/disasm.c +++ b/disasm.c @@ -179,7 +179,7 @@ static uint8_t *do_drex(uint8_t *data, insn *ins) if ((drex & 8) != ((ins->rex & REX_OC) ? 8 : 0)) return NULL; /* OC0 mismatch */ ins->rex = (ins->rex & ~7) | (drex & 7); - + dst->segment = SEG_RMREG; dst->basereg = drex >> 4; return data; @@ -520,7 +520,7 @@ static int matches(const struct itemplate *t, uint8_t *data, data += 4; ins->oprs[c - 064].segment &= ~SEG_64BIT; ins->oprs[c - 064].segment |= SEG_32BIT; - } + } if (segsize != osize) { ins->oprs[c - 064].type = (ins->oprs[c - 064].type & ~SIZE_MASK) @@ -803,7 +803,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, slen = 0; /* TODO: snprintf returns the value that the string would have if - * the buffer were long enough, and not the actual length of + * the buffer were long enough, and not the actual length of * the returned string, so each instance of using the return * value of snprintf should actually be checked to assure that * the return value is "sane." Maybe a macro wrapper could diff --git a/doc/genps.pl b/doc/genps.pl index c80a1b2..5517d84 100755 --- a/doc/genps.pl +++ b/doc/genps.pl @@ -561,7 +561,7 @@ for ( $i = 0 ; $i < $npara ; $i++ ) { push(@tocptypes, 'toc0'.' :'.$sech.':'.$chap.' '.$secn.':'); unshift(@{$paras[$i]}, - [-5, $xref], [0,$chap.' '.$secn.':'], [0, ' ']); + [-5, $xref], [0,$chap.' '.$secn.':'], [0, ' ']); } elsif ( $ptype eq 'head' || $ptype eq 'subh' ) { unless ( $xtype =~ /^\S+ (\S+) :(.*)$/ ) { die "Bad para"; diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index 7775d43..1bf397e 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.pl @@ -9,24 +9,24 @@ # Source-form features: # --------------------- -# +# # Bullet \b # Bullets the paragraph. Rest of paragraph is indented to cope. In # HTML, consecutive groups of bulleted paragraphs become unordered # lists. -# +# # Emphasis \e{foobar} # produces `_foobar_' in text and italics in HTML, PS, RTF -# +# # Inline code \c{foobar} # produces ``foobar'' in text, and fixed-pitch font in HTML, PS, RTF -# +# # Display code # \c line one # \c line two # produces fixed-pitch font where appropriate, and doesn't break # pages except sufficiently far into the middle of a display. -# +# # Chapter, header and subheader # \C{intro} Introduction # \H{whatsnasm} What is NASM? @@ -40,17 +40,17 @@ # Expands to `Chapter 1', `Section 1.1', `Section 1.1.1'. \K has an # initial capital whereas \k doesn't. In HTML, will produce # hyperlinks. -# +# # Web link \W{http://foobar/}{text} or \W{mailto:me@here}\c{me@here} # the \W prefix is ignored except in HTML; in HTML the last part # becomes a hyperlink to the first part. -# +# # Literals \{ \} \\ # In case it's necessary, they expand to the real versions. -# +# # Nonbreaking hyphen \- # Need more be said? -# +# # Source comment \# # Causes everything after it on the line to be ignored by the # source-form processor. @@ -458,7 +458,7 @@ sub fixup_xrefs { if ($$pname[$i] =~ /^k/) { $k = $$pname[$i]; $caps = ($k =~ /^kK/); - $k = substr($k,2); + $k = substr($k,2); $repl = $refs{$k}; die "undefined keyword `$k'\n" unless $repl; substr($repl,0,1) =~ tr/a-z/A-Z/ if $caps; @@ -1417,4 +1417,3 @@ sub write_dip { } close(PARAS); } - diff --git a/eval.c b/eval.c index 423b08d..b554f1d 100644 --- a/eval.c +++ b/eval.c @@ -623,7 +623,7 @@ static expr *eval_floatize(enum floatize type) int sign = 1; int64_t val; int j; - + i = scan(scpriv, tokval); if (i != '(') { error(ERR_NONFATAL, "expecting `('"); diff --git a/exprlib.c b/exprlib.c index d116ee5..af022b8 100644 --- a/exprlib.c +++ b/exprlib.c @@ -151,4 +151,3 @@ int32_t reloc_wrt(expr * vect) } else return NO_SEG; } - diff --git a/float.c b/float.c index f19454d..4db4bd0 100644 --- a/float.c +++ b/float.c @@ -70,7 +70,7 @@ static int float_multiply(uint16_t * to, uint16_t * from) uint32_t temp[MANT_WORDS * 2]; int32_t i, j; - /* + /* * guaranteed that top bit of 'from' is set -- so we only have * to worry about _one_ bit shift to the left */ @@ -120,7 +120,7 @@ static int32_t read_exponent(const char *string, int32_t max) { int32_t i = 0; bool neg = false; - + if (*string == '+') { string++; } else if (*string == '-') { @@ -130,7 +130,7 @@ static int32_t read_exponent(const char *string, int32_t max) while (*string) { if (*string >= '0' && *string <= '9') { i = (i * 10) + (*string - '0'); - + /* * To ensure that underflows and overflows are * handled properly we must avoid wraparounds of @@ -217,7 +217,7 @@ static bool ieee_flconvert(const char *string, uint16_t * mant, } string++; } - + if (*string) { int32_t e; @@ -742,7 +742,7 @@ static int to_float(const char *str, int sign, uint8_t * result, goto overflow; } } - + if (!fmt->explicit) mant[one_pos] &= ~one_mask; /* remove explicit one */ mant[0] |= exponent << (15 - fmt->exponent); @@ -825,4 +825,3 @@ int float_option(const char *option) return -1; /* Unknown option */ } } - diff --git a/float.h b/float.h index 04e9b17..6f64436 100644 --- a/float.h +++ b/float.h @@ -1,5 +1,5 @@ /* float.h header file for the floating-point constant module of - * the Netwide Assembler + * the Netwide Assembler * * The Netwide Assembler is copyright (C) 1996 Simon Tatham and * Julian Hall. All rights reserved. The software is diff --git a/hashtbl.c b/hashtbl.c index 5dd743d..458bb25 100644 --- a/hashtbl.c +++ b/hashtbl.c @@ -129,7 +129,7 @@ void **hash_add(struct hash_insert *insert, const char *key, void *data) if (op->key) { size_t pos = op->hash & mask; size_t inc = ((op->hash >> 32) & mask) | 1; - + while ((xp = &newtbl[pos])->key) pos = (pos+inc) & mask; diff --git a/insns.pl b/insns.pl index 90c00c0..c68b0b5 100644 --- a/insns.pl +++ b/insns.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# +# # insns.pl produce insnsa.c, insnsd.c, insnsi.h, insnsn.c from insns.dat # # The Netwide Assembler is copyright (C) 1996 Simon Tatham and @@ -72,15 +72,15 @@ close F; if ( !defined($output) || $output eq 'a' ) { print STDERR "Writing insnsa.c...\n"; - + open A, ">insnsa.c"; - + print A "/* This file auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; print A "#include \"nasm.h\"\n"; print A "#include \"insns.h\"\n"; print A "\n"; - + foreach $i (@opcodes, @opcodes_cc) { print A "static const struct itemplate instrux_${i}[] = {\n"; $aname = "aa_$i"; @@ -94,21 +94,21 @@ if ( !defined($output) || $output eq 'a' ) { print A " instrux_${i},\n"; } print A "};\n"; - + close A; } if ( !defined($output) || $output eq 'd' ) { print STDERR "Writing insnsd.c...\n"; - + open D, ">insnsd.c"; - + print D "/* This file auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; print D "#include \"nasm.h\"\n"; print D "#include \"insns.h\"\n"; print D "\n"; - + print D "static const struct itemplate instrux[] = {\n"; $n = 0; foreach $j (@big) { @@ -139,26 +139,26 @@ if ( !defined($output) || $output eq 'd' ) { printf D " { itable_%s, -1 },\n", $nn; } elsif (defined($dinstables{$nn})) { printf D " { itable_%s, %u },\n", - $nn, scalar(@{$dinstables{$nn}}); + $nn, scalar(@{$dinstables{$nn}}); } else { printf D " { NULL, 0 },\n"; } } print D "};\n"; } - + close D; } if ( !defined($output) || $output eq 'i' ) { print STDERR "Writing insnsi.h...\n"; - + open I, ">insnsi.h"; - + print I "/* This file is auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; print I "/* This file in included by nasm.h */\n\n"; - + print I "/* Instruction names */\n\n"; print I "#ifndef NASM_INSNSI_H\n"; print I "#define NASM_INSNSI_H 1\n\n"; @@ -174,19 +174,19 @@ if ( !defined($output) || $output eq 'i' ) { print I "\n};\n\n"; print I "#define MAX_INSLEN ", $maxlen, "\n\n"; print I "#endif /* NASM_INSNSI_H */\n"; - + close I; } if ( !defined($output) || $output eq 'n' ) { print STDERR "Writing insnsn.c...\n"; - + open N, ">insnsn.c"; - + print N "/* This file is auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; print N "/* This file in included by names.c */\n\n"; - + print N "static const char * const insn_names[] = {"; $first = 1; foreach $i (@opcodes) { @@ -208,7 +208,7 @@ if ( !defined($output) || $output eq 'n' ) { $ilower =~ tr/A-Z/a-z/; # Change to lower case (Perl 4 compatible) print N "\n\t\"${ilower}\""; } - + print N "\n};\n\n"; print N "/* and the corresponding opcodes */\n"; print N "static const enum opcode ico[] = {"; @@ -218,9 +218,9 @@ if ( !defined($output) || $output eq 'n' ) { $first = 0; print N "\n\tI_$i"; } - + print N "\n};\n"; - + close N; } @@ -231,7 +231,7 @@ sub format { my $num, $nd = 0; return (undef, undef) if $operands eq "ignore"; - + # format the operands $operands =~ s/:/|colon,/g; $operands =~ s/mem(\d+)/mem|bits$1/g; @@ -254,12 +254,12 @@ sub format { } $operands = join(',', @ops); $operands =~ tr/a-z/A-Z/; - + # format the flags $flags =~ s/,/|IF_/g; $flags =~ s/(\|IF_ND|IF_ND\|)//, $nd = 1 if $flags =~ /IF_ND/; $flags = "IF_" . $flags; - + ("{I_$opcode, $num, {$operands}, \"$codes\", $flags},", $nd); } diff --git a/labels.c b/labels.c index d907b35..1fa9fa9 100644 --- a/labels.c +++ b/labels.c @@ -136,12 +136,12 @@ static union label *find_label(char *label, int create) lfree = lfree->admin.next; init_block(lfree); } - + lfree->admin.movingon = BOGUS_VALUE; lfree->defn.label = perm_copy(label); lfree->defn.special = NULL; lfree->defn.is_global = NOT_DEFINED_YET; - + hash_add(&ip, lfree->defn.label, lfree); return lfree++; } diff --git a/lib/snprintf.c b/lib/snprintf.c index de4d96d..01734dc 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -23,4 +23,3 @@ int snprintf(char *str, size_t size, const char *format, ...) return rv; } - diff --git a/listing.c b/listing.c index c0d43c7..1844b53 100644 --- a/listing.c +++ b/listing.c @@ -172,7 +172,7 @@ static void list_output(int32_t offset, const void *data, uint32_t type) HEX(q + 11, p[5]); HEX(q + 13, p[6]); HEX(q + 15, p[7]); - list_out(offset, q); + list_out(offset, q); } else { q[0] = '['; q[5] = ']'; diff --git a/macros.pl b/macros.pl index 596277d..f3ed616 100644 --- a/macros.pl +++ b/macros.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# +# # macros.pl produce macros.c from standard.mac # # The Netwide Assembler is copyright (C) 1996 Simon Tatham and @@ -17,10 +17,10 @@ my $tasm_count; undef $tasm_count; open(OUTPUT,">macros.c") or die "unable to open macros.c\n"; - + print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" . " - don't edit it */\n\n#include \"compiler.h\"\n\nstatic const char *stdmac[] = {\n"; - + foreach $fname ( @ARGV ) { open(INPUT,$fname) or die "unable to open $fname\n"; while () { @@ -35,7 +35,7 @@ foreach $fname ( @ARGV ) { if (length > 0) { print OUTPUT " \"$_\",\n"; $index++; - } + } } else { die "$fname:$line: error unterminated quote"; } diff --git a/misc/fmtinsns.pl b/misc/fmtinsns.pl index 831ead4..323ab9c 100755 --- a/misc/fmtinsns.pl +++ b/misc/fmtinsns.pl @@ -29,5 +29,3 @@ while ($line = ) { } print $line, "\n"; } - - diff --git a/mkdep.pl b/mkdep.pl index d376287..4195bc2 100755 --- a/mkdep.pl +++ b/mkdep.pl @@ -84,7 +84,7 @@ sub insert_deps($) { my($file) = @_; $nexttemp++; # Unique serial number for each temp file my($tmp) = File::Spec->catfile(dirname($file), 'tmp.'.$nexttemp); - + sysopen(IN, $file, O_RDONLY) or die "$0: Cannot open input: $file\n"; sysopen(OUT, $tmp, O_WRONLY|O_CREAT|O_TRUNC, 0666) @@ -151,15 +151,15 @@ sub insert_deps($) { } } close(OUT); - - (unlink($file) && rename($tmp, $file)) + + (unlink($file) && rename($tmp, $file)) or die "$0: Failed to change $tmp -> $file\n"; } # # Main program # - + %deps = (); @files = (); @mkfiles = (); diff --git a/nasm.c b/nasm.c index 9498540..6ec7f07 100644 --- a/nasm.c +++ b/nasm.c @@ -410,7 +410,7 @@ static int process_arg(char *p, char *q) ofmt->current_dfmt = ofmt->debug_formats[0]; } else if (p[1] == 'O') { /* Optimization level */ int opt; - + if (!*param) { /* Naked -O == -Ox */ optimizing = INT_MAX >> 1; /* Almost unlimited */ @@ -432,18 +432,18 @@ static int process_arg(char *p, char *q) else optimizing = opt; /* More than 5 passes */ break; - + case 'v': case '+': param++; opt_verbose_info = true; break; - + case 'x': param++; optimizing = INT_MAX >> 1; /* Almost unlimited */ break; - + default: report_error(ERR_FATAL, "unknown optimization option -O%c\n", @@ -809,7 +809,7 @@ static void parse_cmdline(int argc, char **argv) "file `%s' is both input and output file", inname); - if (*errname) { + if (*errname) { error_file = fopen(errname, "w"); if (!error_file) { error_file = stderr; /* Revert to default! */ @@ -1487,13 +1487,13 @@ static enum directives getkw(char **directive, char **value) * This function prints an error message to error_file in the * style used by GNU. An example would be: * file.asm:50: error: blah blah blah - * where file.asm is the name of the file, 50 is the line number on + * where file.asm is the name of the file, 50 is the line number on * which the error occurs (or is detected) and "error:" is one of * the possible optional diagnostics -- it can be "error" or "warning" - * or something else. Finally the line terminates with the actual + * or something else. Finally the line terminates with the actual * error message. - * - * @param severity the severity of the warning or error + * + * @param severity the severity of the warning or error * @param fmt the printf style format string */ static void report_error_gnu(int severity, const char *fmt, ...) @@ -1520,16 +1520,16 @@ static void report_error_gnu(int severity, const char *fmt, ...) /** * MS style error reporting * This function prints an error message to error_file in the - * style used by Visual C and some other Microsoft tools. An example + * style used by Visual C and some other Microsoft tools. An example * would be: * file.asm(50) : error: blah blah blah - * where file.asm is the name of the file, 50 is the line number on + * where file.asm is the name of the file, 50 is the line number on * which the error occurs (or is detected) and "error:" is one of * the possible optional diagnostics -- it can be "error" or "warning" - * or something else. Finally the line terminates with the actual + * or something else. Finally the line terminates with the actual * error message. - * - * @param severity the severity of the warning or error + * + * @param severity the severity of the warning or error * @param fmt the printf style format string */ static void report_error_vc(int severity, const char *fmt, ...) @@ -1555,7 +1555,7 @@ static void report_error_vc(int severity, const char *fmt, ...) /** * check for supressed warning - * checks for suppressed warning or pass one only warning and we're + * checks for suppressed warning or pass one only warning and we're * not in pass 1 * * @param severity the severity of the warning or error @@ -1578,11 +1578,11 @@ static int is_suppressed_warning(int severity) /** * common error reporting * This is the common back end of the error reporting schemes currently - * implemented. It prints the nature of the warning and then the + * implemented. It prints the nature of the warning and then the * specific error message to error_file and may or may not return. It * doesn't return if the error severity is a "panic" or "debug" type. - * - * @param severity the severity of the warning or error + * + * @param severity the severity of the warning or error * @param fmt the printf style format string */ static void report_error_common(int severity, const char *fmt, diff --git a/nasm.h b/nasm.h index 5749b38..8780990 100644 --- a/nasm.h +++ b/nasm.h @@ -301,7 +301,7 @@ extern Preproc nasmpp; * matches any character that may appear at places other than the start of an * identifier. E.g. a period may only appear at the start of an identifier * (for local labels), whereas a number may appear anywhere *but* at the - * start. + * start. */ #define isidstart(c) ( isalpha(c) || (c)=='_' || (c)=='.' || (c)=='?' \ @@ -422,51 +422,51 @@ enum { typedef uint32_t opflags_t; /* Size, and other attributes, of the operand */ -#define BITS8 0x00000001L -#define BITS16 0x00000002L -#define BITS32 0x00000004L -#define BITS64 0x00000008L /* x64 and FPU only */ -#define BITS80 0x00000010L /* FPU only */ +#define BITS8 0x00000001L +#define BITS16 0x00000002L +#define BITS32 0x00000004L +#define BITS64 0x00000008L /* x64 and FPU only */ +#define BITS80 0x00000010L /* FPU only */ #define BITS128 0x20000000L -#define FAR 0x00000020L /* grotty: this means 16:16 or */ +#define FAR 0x00000020L /* grotty: this means 16:16 or */ /* 16:32, like in CALL/JMP */ -#define NEAR 0x00000040L -#define SHORT 0x00000080L /* and this means what it says :) */ +#define NEAR 0x00000040L +#define SHORT 0x00000080L /* and this means what it says :) */ -#define SIZE_MASK 0x200000FFL /* all the size attributes */ +#define SIZE_MASK 0x200000FFL /* all the size attributes */ /* Modifiers */ #define MODIFIER_MASK 0x00000f00L -#define TO 0x00000100L /* reverse effect in FADD, FSUB &c */ -#define COLON 0x00000200L /* operand is followed by a colon */ -#define STRICT 0x00000400L /* do not optimize this operand */ +#define TO 0x00000100L /* reverse effect in FADD, FSUB &c */ +#define COLON 0x00000200L /* operand is followed by a colon */ +#define STRICT 0x00000400L /* do not optimize this operand */ /* Type of operand: memory reference, register, etc. */ #define OPTYPE_MASK 0x0000f000L #define REGISTER 0x00001000L /* register number in 'basereg' */ #define IMMEDIATE 0x00002000L #define MEMORY 0x0000c000L -#define REGMEM 0x00008000L /* for r/m, ie EA, operands */ +#define REGMEM 0x00008000L /* for r/m, ie EA, operands */ /* Register classes */ -#define REG_EA 0x00009000L /* 'normal' reg, qualifies as EA */ +#define REG_EA 0x00009000L /* 'normal' reg, qualifies as EA */ #define RM_GPR 0x00208000L /* integer operand */ #define REG_GPR 0x00209000L /* integer register */ -#define REG8 0x00209001L /* 8-bit GPR */ -#define REG16 0x00209002L /* 16-bit GPR */ -#define REG32 0x00209004L /* 32-bit GPR */ -#define REG64 0x00209008L /* 64-bit GPR */ -#define IP_REG 0x00801000L /* RIP or EIP register */ -#define RIPREG 0x00801008L /* RIP */ -#define EIPREG 0x00801004L /* EIP */ -#define FPUREG 0x01001000L /* floating point stack registers */ -#define FPU0 0x01011000L /* FPU stack register zero */ +#define REG8 0x00209001L /* 8-bit GPR */ +#define REG16 0x00209002L /* 16-bit GPR */ +#define REG32 0x00209004L /* 32-bit GPR */ +#define REG64 0x00209008L /* 64-bit GPR */ +#define IP_REG 0x00801000L /* RIP or EIP register */ +#define RIPREG 0x00801008L /* RIP */ +#define EIPREG 0x00801004L /* EIP */ +#define FPUREG 0x01001000L /* floating point stack registers */ +#define FPU0 0x01011000L /* FPU stack register zero */ #define RM_MMX 0x02008000L /* MMX operand */ -#define MMXREG 0x02009000L /* MMX register */ +#define MMXREG 0x02009000L /* MMX register */ #define RM_XMM 0x04008000L /* XMM (SSE) operand */ -#define XMMREG 0x04009000L /* XMM (SSE) register */ +#define XMMREG 0x04009000L /* XMM (SSE) register */ #define XMM0 0x04019000L /* XMM register zero */ -#define REG_CDT 0x00101004L /* CRn, DRn and TRn */ +#define REG_CDT 0x00101004L /* CRn, DRn and TRn */ #define REG_CREG 0x00111004L /* CRn */ #define REG_DREG 0x00121004L /* DRn */ #define REG_TREG 0x00141004L /* TRn */ @@ -480,7 +480,7 @@ typedef uint32_t opflags_t; #define REG_EIP 0x00801004L /* EIP relative addressing */ /* Special GPRs */ -#define REG_SMASK 0x000f0000L /* a mask for the following */ +#define REG_SMASK 0x000f0000L /* a mask for the following */ #define REG_ACCUM 0x00219000L /* accumulator: AL, AX, EAX, RAX */ #define REG_AL 0x00219001L #define REG_AX 0x00219002L @@ -601,7 +601,7 @@ typedef struct { /* an instruction itself */ int nprefix; /* number of entries in above */ enum opcode opcode; /* the opcode - not just the string */ enum ccode condition; /* the condition code, if Jcc/SETcc */ - int operands; /* how many operands? 0-3 + int operands; /* how many operands? 0-3 * (more if db et al) */ operand oprs[MAX_OPERANDS]; /* the operands, defined as above */ extop *eops; /* extended operands */ @@ -631,7 +631,7 @@ struct ofmt { * This is a single keyword used to select the driver. */ const char *shortname; - + /* * this is reserved for out module specific help. @@ -850,7 +850,7 @@ struct dfmt { const char *shortname; /* - * init - called initially to set up local pointer to object format, + * init - called initially to set up local pointer to object format, * void pointer to implementation defined data, file pointer (which * probably won't be used, but who knows?), and error function. */ @@ -875,7 +875,7 @@ struct dfmt { * is encountered. 'directive' contains the first parameter to the * DEBUG directive, and params contains the rest. For example, * 'DEBUG VAR _somevar:int' would translate to a call to this - * function with 'directive' equal to "VAR" and 'params' equal to + * function with 'directive' equal to "VAR" and 'params' equal to * "_somevar:int". */ void (*debug_directive) (const char *directive, const char *params); diff --git a/nasmlib.c b/nasmlib.c index 7f7fdef..5e43daa 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -254,7 +254,7 @@ int64_t readnum(char *str, bool *error) *error = true; return 0; } - + /* * `checklimit' must be 2**(32|64) / radix. We can't do that in * 32/64-bit arithmetic, which we're (probably) using, so we @@ -284,7 +284,7 @@ int64_t readnum(char *str, bool *error) (result == checklimit && digit >= last)) { warn = true; } - + result = radix * result + digit; } r++; @@ -530,7 +530,7 @@ void saa_free(struct SAA *s) static void saa_extend(struct SAA *s) { size_t blkn = s->nblks++; - + if (blkn >= s->nblkptrs) { size_t rindex = s->rblk - s->blk_ptrs; size_t windex = s->wblk - s->blk_ptrs; @@ -690,7 +690,7 @@ void saa_rnbytes(struct SAA *s, void *data, size_t len) void saa_fread(struct SAA *s, size_t posn, void *data, size_t len) { size_t ix; - + if (posn+len > s->datalen) { nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fread"); return; @@ -708,7 +708,7 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len) void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len) { size_t ix; - + if (posn > s->datalen) { /* Seek beyond the end of the existing array not supported */ nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite"); @@ -867,7 +867,7 @@ void null_debug_linenum(const char *filename, int32_t linenumber, int32_t segto) { (void)filename; (void)linenumber; - (void)segto; + (void)segto; } void null_debug_deflabel(char *name, int32_t segment, int32_t offset, int is_global, char *special) diff --git a/nasmlib.h b/nasmlib.h index 30f0065..3850634 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -43,7 +43,7 @@ typedef void (*efunc) (int severity, const char *fmt, ...); * argument to an efunc. */ -#define ERR_DEBUG 0x00000008 /* put out debugging message */ +#define ERR_DEBUG 0x00000008 /* put out debugging message */ #define ERR_WARNING 0x00000000 /* warn only: no further action */ #define ERR_NONFATAL 0x00000001 /* terminate assembly after phase */ #define ERR_FATAL 0x00000002 /* instantly fatal: exit with error */ @@ -59,7 +59,7 @@ typedef void (*efunc) (int severity, const char *fmt, ...); */ #define ERR_WARN_MASK 0x0000FF00 /* the mask for this feature */ -#define ERR_WARN_SHR 8 /* how far to shift right */ +#define ERR_WARN_SHR 8 /* how far to shift right */ #define WARN(x) ((x) << ERR_WARN_SHR) @@ -186,7 +186,7 @@ void standard_extension(char *inname, char *outname, char *extension, WRITECHAR(p,(v) >> 16); \ WRITECHAR(p,(v) >> 24); \ } while (0) - + #define WRITEDLONG(p,v) \ do { \ WRITECHAR(p,v); \ diff --git a/outform.c b/outform.c index 3f4d18f..60b7695 100644 --- a/outform.c +++ b/outform.c @@ -1,7 +1,7 @@ /* outform.c manages a list of output formats, and associates - * them with their relevant drivers. Also has a - * routine to find the correct driver given a name - * for it + * them with their relevant drivers. Also has a + * routine to find the correct driver given a name + * for it * * The Netwide Assembler is copyright (C) 1996 Simon Tatham and * Julian Hall. All rights reserved. The software is diff --git a/output/outaout.c b/output/outaout.c index 2c7f7d6..d3e8b01 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -223,7 +223,7 @@ static void aout_cleanup(int debuginfo) static int32_t aout_section_names(char *name, int pass, int *bits) { - + (void)pass; /* diff --git a/output/outas86.c b/output/outas86.c index 351aa04..5dbdd41 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -140,7 +140,7 @@ static void as86_cleanup(int debuginfo) static int32_t as86_section_names(char *name, int pass, int *bits) { - + (void)pass; /* diff --git a/output/outbin.c b/output/outbin.c index 32bd88a..bf4c44b 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -557,7 +557,7 @@ static void bin_cleanup(int debuginfo) else l -= s->vstart; } - + if (r->bytes >= 4) WRITEDLONG(q, l); else if (r->bytes == 2) @@ -742,8 +742,8 @@ static void bin_out(int32_t segto, const void *data, uint32_t type, uint8_t *p, mydata[8]; struct Section *s; int32_t realbytes; - - + + if (wrt != NO_SEG) { wrt = NO_SEG; /* continue to do _something_ */ error(ERR_NONFATAL, "WRT not supported by binary output format"); @@ -761,7 +761,7 @@ static void bin_out(int32_t segto, const void *data, uint32_t type, s = find_section_by_index(segto); if (!s) error(ERR_PANIC, "code directed to nonexistent segment?"); - + /* "Smart" section-type adaptation code. */ if (!(s->flags & TYPE_DEFINED)) { if ((type & OUT_TYPMASK) == OUT_RESERVE) diff --git a/output/outcoff.c b/output/outcoff.c index c9e780c..14c917d 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -604,7 +604,7 @@ typedef struct tagString { #define EXPORT_SECTION_NAME ".drectve" #define EXPORT_SECTION_FLAGS INFO_FLAGS -/* +/* #define EXPORT_SECTION_NAME ".text" #define EXPORT_SECTION_FLAGS TEXT_FLAGS */ diff --git a/output/outieee.c b/output/outieee.c index 6f35e57..8af3cbe 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -174,8 +174,8 @@ static int32_t ieee_putld(int32_t, int32_t, uint8_t *); static int32_t ieee_putlr(struct ieeeFixupp *); static void ieee_unqualified_name(char *, char *); -/* - * pup init +/* + * pup init */ static void ieee_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) { @@ -266,7 +266,7 @@ static void ieee_deflabel(char *name, int32_t segment, * * (ii) `segment' is one of our segments, or a SEG_ABS segment. * Save the label position for later output of a PUBDEF record. - * + * * * (iii) `segment' is not one of our segments. Save the label * position for later output of an EXTDEF. @@ -876,7 +876,7 @@ static void ieee_write_file(int debuginfo) */ ieee_putascii("CO0,%02X%s.\r\n", strlen(boast), boast); - /* + /* * write processor-specific information */ ieee_putascii("AD8,4,L.\r\n"); @@ -890,7 +890,7 @@ static void ieee_write_file(int debuginfo) 1900 + thetime->tm_year, thetime->tm_mon + 1, thetime->tm_mday, thetime->tm_hour, thetime->tm_min, thetime->tm_sec); - /* + /* * if debugging, dump file names */ for (fn = fnhead; fn && debuginfo; fn = fn->next) { @@ -904,7 +904,7 @@ static void ieee_write_file(int debuginfo) */ ieee_putcs(false); - /* + /* * Write the section headers */ seg = seghead; diff --git a/output/outmacho.c b/output/outmacho.c index 545fa27..b5be2c6 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -116,7 +116,7 @@ struct symbol { /* nasm internal data */ struct symbol *next; /* next symbol in the list */ char *name; /* name of this symbol */ - int32_t initial_snum; /* symbol number used above in + int32_t initial_snum; /* symbol number used above in reloc */ int32_t snum; /* true snum for reloc */ diff --git a/output/outobj.c b/output/outobj.c index 4c9949c..a39b4ff 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1378,7 +1378,7 @@ static int32_t obj_segment(char *name, int pass, int *bits) * that its default group is group FLAT, even if * the group FLAT does not explicitly _contain_ the * segment. - * + * * When we see this, we must create the group * `FLAT', containing no segments, if it does not * already exist; then we must set the default diff --git a/output/outrdf.c b/output/outrdf.c index d3fbb92..23e661e 100644 --- a/output/outrdf.c +++ b/output/outrdf.c @@ -398,7 +398,7 @@ static void rdf_out(int32_t segto, void *data, uint32_t type, WRITEDLONG(pd, *(int64_t *)data); else WRITESHORT(pd, *(int32_t *)data); - + membufwrite(seg[segto], databuf, bytes); diff --git a/output/outrdf2.c b/output/outrdf2.c index ba488b4..a53282a 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -176,7 +176,7 @@ static int32_t rdf2_section_names(char *name, int pass, int *bits) } } /* - * check it against the text strings in segmenttypes + * check it against the text strings in segmenttypes */ for (i = 0; i < COUNT_SEGTYPES; i++) diff --git a/pptok.pl b/pptok.pl index ee49648..896d9d1 100755 --- a/pptok.pl +++ b/pptok.pl @@ -16,7 +16,7 @@ while (defined($line = )) { $line =~ s/^\s+//; # Remove leading whitespace $line =~ s/\s*\#.*$//; # Remove comments and trailing whitespace next if ($line eq ''); - + if ($line =~ /^\%(.*)\*$/) { push(@cctok, $1); } elsif ($line =~ /^\%(.*)$/) { @@ -83,9 +83,9 @@ if ($what eq 'h') { $n += 2; } print OUT "};\n\n"; - + printf OUT "#define PP_COND(x) ((enum pp_conditional)((x) & 0x%x))\n", - (scalar(@cond)-1) << 1; + (scalar(@cond)-1) << 1; print OUT "#define PP_IS_COND(x) ((unsigned int)(x) < PP_\U$first_uncond\E)\n"; print OUT "#define PP_NEGATIVE(x) ((x) & 1)\n"; print OUT "\n"; @@ -132,12 +132,12 @@ if ($what eq 'c') { # Paranoia... verify_hash_table(\%tokens, \@hashinfo); - + ($n, $sv, $g) = @hashinfo; $sv2 = $sv+2; - + die if ($n & ($n-1)); - + print OUT "#include \"compiler.h\"\n"; print OUT "#include \n"; print OUT "#include \n"; @@ -156,7 +156,7 @@ if ($what eq 'c') { } } print OUT "};\n"; - + print OUT "enum preproc_token pp_token_hash(const char *token)\n"; print OUT "{\n"; @@ -171,14 +171,14 @@ if ($what eq 'c') { print OUT " ", defined($h) ? $h : 'UNUSED', ",\n"; } print OUT " };\n"; - + print OUT " static const int16_t hash2[$n] = {\n"; for ($i = 0; $i < $n; $i++) { my $h = ${$g}[$i*2+1]; print OUT " ", defined($h) ? $h : 'UNUSED', ",\n"; } print OUT " };\n"; - + print OUT " uint32_t k1, k2;\n"; print OUT " uint64_t crc;\n"; # For correct overflow behavior, "ix" should be unsigned of the same @@ -187,7 +187,7 @@ if ($what eq 'c') { print OUT "\n"; printf OUT " crc = crc64i(UINT64_C(0x%08x%08x), token);\n", - $$sv[0], $$sv[1]; + $$sv[0], $$sv[1]; print OUT " k1 = (uint32_t)crc;\n"; print OUT " k2 = (uint32_t)(crc >> 32);\n"; print OUT "\n"; diff --git a/preproc.c b/preproc.c index d242faf..3a33ef4 100644 --- a/preproc.c +++ b/preproc.c @@ -139,7 +139,7 @@ struct Context { * the substituted parameter. So in the definition * * %define a(x,y) ( (x) & ~(y) ) - * + * * the token representing `x' will have its type changed to * TOK_SMAC_PARAM, but the one representing `y' will be * TOK_SMAC_PARAM+1. @@ -167,7 +167,7 @@ struct Token { * Multi-line macro definitions are stored as a linked list of * these, which is essentially a container to allow several linked * lists of Tokens. - * + * * Note that in this module, linked lists are treated as stacks * wherever possible. For this reason, Lines are _pushed_ on to the * `expansion' field in MMacro structures, so that the linked list, @@ -254,7 +254,7 @@ enum { }; #define emitting(x) ( (x) == COND_IF_TRUE || (x) == COND_ELSE_TRUE ) -/* +/* * These defines are used as the possible return values for do_directive */ #define NO_DIRECTIVE_FOUND 0 @@ -837,7 +837,7 @@ static Token *tokenize(char *line) /* * this function allocates a new managed block of memory and - * returns a pointer to the block. The managed blocks are + * returns a pointer to the block. The managed blocks are * deleted only all at once by the delete_Blocks function. */ static void *new_Block(size_t size) @@ -865,9 +865,9 @@ static void delete_Blocks(void) { Blocks *a, *b = &blocks; - /* + /* * keep in mind that the first block, pointed to by blocks - * is a static and not dynamically allocated, so we don't + * is a static and not dynamically allocated, so we don't * free it. */ while (b) { @@ -881,7 +881,7 @@ static void delete_Blocks(void) } /* - * this function creates a new Token and passes a pointer to it + * this function creates a new Token and passes a pointer to it * back to the caller. It sets the type and text elements, and * also the mac and next elements to NULL. */ @@ -1557,7 +1557,7 @@ static bool if_condition(Token * tline, enum preproc_token ct) free_tlist(origline); return j ^ PP_NEGATIVE(ct); - + fail: free_tlist(origline); return -1; @@ -1582,7 +1582,7 @@ static bool define_smacro(Context *ctx, char *mname, bool casesense, int nparam, Token *expansion) { SMacro *smac, **smhead; - + if (smacro_defined(ctx, mname, nparam, &smac, casesense)) { if (!smac) { error(ERR_WARNING, @@ -1607,7 +1607,7 @@ static bool define_smacro(Context *ctx, char *mname, bool casesense, smhead = (SMacro **) hash_findi_add(smacros, mname); else smhead = &ctx->localmac; - + smac = nasm_malloc(sizeof(SMacro)); smac->next = *smhead; *smhead = smac; @@ -1631,7 +1631,7 @@ static void undef_smacro(Context *ctx, const char *mname) smhead = (SMacro **) hash_findi(smacros, mname, NULL); else smhead = &ctx->localmac; - + if (smhead) { /* * We now have a macro name... go hunt for it. @@ -1654,13 +1654,13 @@ static void undef_smacro(Context *ctx, const char *mname) * find and process preprocessor directive in passed line * Find out if a line contains a preprocessor directive, and deal * with it if so. - * + * * If a directive _is_ found, it is the responsibility of this routine * (and not the caller) to free_tlist() the line. * * @param tline a pointer to the current tokeninzed line linked list * @return DIRECTIVE_FOUND or NO_DIRECTIVE_FOUND - * + * */ static int do_directive(Token * tline) { @@ -2252,7 +2252,7 @@ static int do_directive(Token * tline) rotate %= (int)mmac->nparam; if (rotate < 0) rotate += mmac->nparam; - + mmac->rotate = rotate; } return DIRECTIVE_FOUND; @@ -2478,7 +2478,7 @@ static int do_directive(Token * tline) case PP_STRLEN: casesense = true; - + tline = tline->next; skip_white_(tline); tline = expand_id(tline); @@ -3119,11 +3119,11 @@ static Token *expand_smacro(Token * tline) if (m && m->in_progress) m = NULL; if (!m) { /* in progess or didn't find '(' or wrong nparam */ - /* + /* * Design question: should we handle !tline, which * indicates missing ')' here, or expand those * macros anyway, which requires the (t) test a few - * lines down? + * lines down? */ nasm_free(params); nasm_free(paramsize); @@ -3993,11 +3993,11 @@ void pp_pre_undefine(char *definition) void pp_runtime(char *definition) { Token *def; - + def = tokenize(definition); if(do_directive(def) == NO_DIRECTIVE_FOUND) free_tlist(def); - + } void pp_extra_stdmac(const char **macros) diff --git a/rdoff/ldrdf.c b/rdoff/ldrdf.c index cd07fe7..ece8c3f 100644 --- a/rdoff/ldrdf.c +++ b/rdoff/ldrdf.c @@ -47,7 +47,7 @@ */ struct segment_infonode { - int dest_seg; /* output segment to be placed into, -1 to + int dest_seg; /* output segment to be placed into, -1 to skip linking this segment */ int32_t reloc; /* segment's relocation factor */ }; @@ -109,7 +109,7 @@ rdf_headerbuf *newheader = NULL; /* The current state of segment allocation, including information about * which output segment numbers have been allocated, and their types and - * amount of data which has already been allocated inside them. + * amount of data which has already been allocated inside them. */ struct SegmentHeaderRec outputseg[RDF_MAXSEGS]; int nsegs = 0; @@ -188,7 +188,7 @@ void loadmodule(const char *filename) exit(1); } - /* + /* * store information about the module, and determine what segments * it contains, and what we should do with them (determine relocation * factor if we decide to keep them) @@ -860,7 +860,7 @@ void write_output(const char *filename) break; } - /* + /* * okay, now the relocation is in the segment pointed to by * cur->seginfo[localseg], and we know everything else is * okay to go ahead and do the relocation @@ -926,7 +926,7 @@ void write_output(const char *filename) case RDFREC_FARIMPORT: /* * scan the global symbol table for the symbol - * and associate its location with the segment number + * and associate its location with the segment number * for this module */ se = symtabFind(symtab, hr->i.label); diff --git a/rdoff/ldsegs.h b/rdoff/ldsegs.h index 7050376..fcecdf6 100644 --- a/rdoff/ldsegs.h +++ b/rdoff/ldsegs.h @@ -38,7 +38,7 @@ struct segconfig sconft[SEGCONFIGMAX] = { {0xFFFF, 0xFFFF, "invalid segment", 0, 0} }; -#define getsegconfig(target,number) \ +#define getsegconfig(target,number) \ { \ int _i; \ int _t = number; \ diff --git a/rdoff/rdflib.c b/rdoff/rdflib.c index b4bf6d6..852920e 100644 --- a/rdoff/rdflib.c +++ b/rdoff/rdflib.c @@ -15,7 +15,7 @@ * The format of the directory will be 'RDLDD' followed by a version * number, followed by the length of the directory, and then the * directory, the format of which has not yet been designed. - * The module name of the directory must be '.dir'. + * The module name of the directory must be '.dir'. * * All module names beginning with '.' are reserved for possible future * extensions. The linker ignores all such modules, assuming they have diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c index a6ae156..885752d 100644 --- a/rdoff/rdlib.c +++ b/rdoff/rdlib.c @@ -119,8 +119,8 @@ int rdl_searchlib(struct librarynode *lib, const char *label, rdffile * f) rewind(lib->fp); while (!feof(lib->fp)) { - /* - * read the module name from the file, and prepend + /* + * read the module name from the file, and prepend * the library name and '.' to it. */ strcpy(buf, lib->name); diff --git a/rdoff/rdoff.c b/rdoff/rdoff.c index 2539499..8201c72 100644 --- a/rdoff/rdoff.c +++ b/rdoff/rdoff.c @@ -1,4 +1,4 @@ -/* rdoff.c library of routines for manipulating rdoff files +/* rdoff.c library of routines for manipulating rdoff files * * The Netwide Assembler is copyright (C) 1996 Simon Tatham and * Julian Hall. All rights reserved. The software is @@ -135,10 +135,10 @@ void freemembuf(memorybuffer * b) General purpose routines and variables used by the library functions ========================================================================= */ -/* +/* * translateint32_t() and translateint16_t() * - * translate from little endian to local representation + * translate from little endian to local representation */ int32_t translateint32_t(int32_t in) { diff --git a/rdoff/rdoff.h b/rdoff/rdoff.h index dc23f2b..88efd10 100644 --- a/rdoff/rdoff.h +++ b/rdoff/rdoff.h @@ -48,7 +48,7 @@ #define RDFREC_MODNAME 8 #define RDFREC_COMMON 10 -/* +/* * Generic record - contains the type and length field, plus a 128 byte * array 'data' */ @@ -58,7 +58,7 @@ struct GenericRec { char data[128]; }; -/* +/* * Relocation record */ struct RelocRec { diff --git a/rdoff/segtab.c b/rdoff/segtab.c index e1a3ddf..693094e 100644 --- a/rdoff/segtab.c +++ b/rdoff/segtab.c @@ -11,7 +11,7 @@ struct segtabnode { struct segtabnode *left; struct segtabnode *right; - /* + /* * counts of how many are left or right, for use in reorganising * the tree */ diff --git a/regs.pl b/regs.pl index 404c2f6..3ba802c 100755 --- a/regs.pl +++ b/regs.pl @@ -42,7 +42,7 @@ sub process_line($) { if ( !defined($disclass{$dclass}) ) { $disclass{$dclass} = []; } - + $disclass{$dclass}->[$x86regno] = $reg; } @@ -69,7 +69,7 @@ while ( defined($line = ) ) { chomp $line; $line =~ s/\s*(\#.*|)$//; - + next if ( $line eq '' ); process_line($line); diff --git a/stdscan.c b/stdscan.c index c2f97e8..3f74869 100644 --- a/stdscan.c +++ b/stdscan.c @@ -225,4 +225,3 @@ int stdscan(void *private_data, struct tokenval *tv) } else /* just an ordinary char */ return tv->t_type = (uint8_t)(*stdscan_bufptr++); } - diff --git a/test/riprel.pl b/test/riprel.pl index 0f016df..3859f1d 100644 --- a/test/riprel.pl +++ b/test/riprel.pl @@ -21,5 +21,3 @@ foreach $mode ('abs', 'rel') { } print "\nfoo:\n"; - - diff --git a/tokhash.pl b/tokhash.pl index b5e85aa..7da5625 100755 --- a/tokhash.pl +++ b/tokhash.pl @@ -27,7 +27,7 @@ while (defined($line = )) { if ($line =~ /^([A-Z0-9_]+)(|cc)\s/) { $insn = $1.$2; ($token = $1) =~ tr/A-Z/a-z/; - + if ($2 eq '') { # Single instruction token if (!defined($tokens{$token})) { @@ -60,7 +60,7 @@ while (defined($line = )) { $reg = $1.$2.$4; $reg_nr = $2; $reg_prefix = $1; - $reg_suffix = $4; + $reg_suffix = $4; } else { $nregs = 1; undef $reg_prefix, $reg_suffix; @@ -72,7 +72,7 @@ while (defined($line = )) { } $tokens{$reg} = scalar @tokendata; push(@tokendata, "\"${reg}\", TOKEN_REG, 0, R_\U${reg}\E"); - + if (defined($reg_prefix)) { $reg_nr++; $reg = sprintf("%s%u%s", $reg_prefix, $reg_nr, $reg_suffix); @@ -99,12 +99,12 @@ while (defined($line = )) { die "Duplicate definition: $token\n"; } $tokens{$token} = scalar @tokendata; - + $data = $pattern; if ($data =~ /^(.*)\{(.*)\}(.*)$/) { my $head = $1, $tail = $3; my $px = $2; - + $px =~ s/\*/(.*)/g; if ($token =~ /$px/i) { $data = $head."\U$1".$tail; @@ -156,25 +156,25 @@ if ($output eq 'h') { # Paranoia... verify_hash_table(\%tokens, \@hashinfo); - + ($n, $sv, $g) = @hashinfo; $sv2 = $sv+2; - + die if ($n & ($n-1)); - + print "/*\n"; print " * This file is generated from insns.dat, regs.dat and token.dat\n"; print " * by tokhash.pl; do not edit.\n"; print " */\n"; print "\n"; - + print "#include \"compiler.h\"\n"; print "#include \n"; print "#include \"nasm.h\"\n"; print "#include \"hashtbl.h\"\n"; print "#include \"insns.h\"\n"; print "\n"; - + # These somewhat odd sizes and ordering thereof are due to the # relative ranges of the types; this makes it fit in 16 bytes on # 64-bit machines and 12 bytes on 32-bit machines. @@ -185,35 +185,35 @@ if ($output eq 'h') { print " int32_t num;\n"; print "};\n"; print "\n"; - + print "int nasm_token_hash(const char *token, struct tokenval *tv)\n"; print "{\n"; - + # Put a large value in unused slots. This makes it extremely unlikely # that any combination that involves unused slot will pass the range test. # This speeds up rejection of unrecognized tokens, i.e. identifiers. print "#define UNUSED 16383\n"; - + print " static const int16_t hash1[$n] = {\n"; for ($i = 0; $i < $n; $i++) { my $h = ${$g}[$i*2+0]; print " ", defined($h) ? $h : 'UNUSED', ",\n"; } print " };\n"; - + print " static const int16_t hash2[$n] = {\n"; for ($i = 0; $i < $n; $i++) { my $h = ${$g}[$i*2+1]; print " ", defined($h) ? $h : 'UNUSED', ",\n"; } print " };\n"; - + printf " static const struct tokendata tokendata[%d] = {\n", scalar(@tokendata); foreach $d (@tokendata) { print " { ", $d, " },\n"; } print " };\n"; - + print " uint32_t k1, k2;\n"; print " uint64_t crc;\n"; # For correct overflow behavior, "ix" should be unsigned of the same @@ -222,7 +222,7 @@ if ($output eq 'h') { print " const struct tokendata *data;\n"; print "\n"; printf " crc = crc64(UINT64_C(0x%08x%08x), token);\n", - $$sv[0], $$sv[1]; + $$sv[0], $$sv[1]; print " k1 = (uint32_t)crc;\n"; print " k2 = (uint32_t)(crc >> 32);\n"; print "\n"; @@ -231,7 +231,7 @@ if ($output eq 'h') { print " return tv->t_type = TOKEN_ID;\n"; print "\n"; print " data = &tokendata[ix];\n"; - + print " if (strcmp(data->string, token))\n"; print " return tv->t_type = TOKEN_ID;\n"; print "\n"; diff --git a/version.pl b/version.pl index e78fbc2..746c006 100755 --- a/version.pl +++ b/version.pl @@ -133,4 +133,3 @@ if ( $what eq 'h' ) { } exit 0; - -- cgit v1.2.3