Document the -Ov option, minor fix for gcc -Og

The -Ov option is useful but was undocumented.

Add an initialization to keep gcc from complaining at optimization
level -Og.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2018-12-14 13:02:39 -08:00
parent 0402a2d402
commit 1e2358b17f
2 changed files with 9 additions and 2 deletions

View File

@ -1135,6 +1135,7 @@ static bool process_arg(char *p, char *q, int pass)
break;
}
olen = 0; /* Placate gcc at lower optimization levels */
plen = strlen(p);
for (tx = textopts; tx->label; tx++) {
olen = strlen(tx->label);
@ -1985,10 +1986,11 @@ static void help(const char xopt)
" -l listfile write listing to a listfile\n\n"
" -Ipath add a pathname to the include file path\n");
printf
(" -Olevel optimize opcodes, immediates and branch offsets\n"
(" -Oflags... optimize opcodes, immediates and branch offsets\n"
" -O0 no optimization\n"
" -O1 minimal optimization\n"
" -Ox multipass optimization (default)\n"
" -Ov display the number of passes executed at the end\n"
" -Pfile pre-include a file (also --include)\n"
" -Dmacro[=str] pre-define a macro\n"
" -Umacro undefine a macro\n"

View File

@ -746,7 +746,9 @@ with a \i{stub preprocessor} which does nothing.
\S{opt-O} The \i\c{-O} Option: Specifying \i{Multipass Optimization}
Using the \c{-O} option, you can tell NASM to carry out different
levels of optimization. The syntax is:
levels of optimization. Multiple flags can be specified after the
\c{-O} options, some of which can be combined in a single option,
e.g. \c{-Oxv}.
\b \c{-O0}: No optimization. All operands take their long forms,
if a short form is not specified, except conditional jumps.
@ -764,6 +766,9 @@ levels of optimization. The syntax is:
releases, the letter \c{x} may also be any number greater than
one. This number has no effect on the actual number of passes.
\b \c{-Ov}: At the end of assembly, print the number of passes
actually executed.
The \c{-Ox} mode is recommended for most uses, and is the default
since NASM 2.09.