version 1.20, 2014/04/24 21:22:05 |
version 1.21, 2014/04/30 06:06:09 |
|
|
.Nd remove preprocessor conditionals from code |
.Nd remove preprocessor conditionals from code |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm |
.Nm |
.Op Fl bBcdehKkmnsStV |
.Op Fl BbcdehKkmnSstV |
.Op Fl I Ns Ar path |
|
.Op Fl [i]D Ns Ar sym Ns Op = Ns Ar val |
.Op Fl [i]D Ns Ar sym Ns Op = Ns Ar val |
.Op Fl [i]U Ns Ar sym |
.Op Fl [i]U Ns Ar sym |
.Ar ... |
|
.Op Fl f Ar defile |
.Op Fl f Ar defile |
.Op Fl x Bro Ar 012 Brc |
|
.Op Fl M Ar backext |
.Op Fl M Ar backext |
.Op Fl o Ar outfile |
.Op Fl o Ar outfile |
.Op Ar infile ... |
.Op Fl x Cm 0 | 1 | 2 |
|
.Ar |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
The |
The |
.Nm |
.Nm |
|
|
or affected by a backslash-continued line. |
or affected by a backslash-continued line. |
It spots unusually-formatted preprocessor directives |
It spots unusually-formatted preprocessor directives |
and knows when the layout is too odd for it to handle. |
and knows when the layout is too odd for it to handle. |
.Sh OPTIONS |
|
.Bl -tag -width indent -compact |
|
.It Fl D Ns Ar sym Ns = Ns Ar val |
|
Specify that a macro is defined to a given value. |
|
.Pp |
.Pp |
.It Fl D Ns Ar sym |
The options are as follows: |
Specify that a macro is defined to the value 1. |
|
.Pp |
.Pp |
.It Fl U Ns Ar sym |
.Bl -tag -width indent -compact |
Specify that a macro is undefined. |
.It Fl B |
|
Compress blank lines around a deleted section. |
|
Mutually exclusive with the |
|
.Fl b |
|
option. |
.Pp |
.Pp |
If the same macro appears in more than one argument, |
.It Fl b |
the last occurrence dominates. |
Replace removed lines with blank lines |
|
instead of deleting them. |
|
Mutually exclusive with the |
|
.Fl B |
|
option. |
.Pp |
.Pp |
|
.It Fl c |
|
Complement. |
|
That is, lines that would have been removed or blanked |
|
are retained and vice versa. |
|
.Pp |
.Sm off |
.Sm off |
.It Xo |
.It Xo |
.Fl iD Ar sym |
.Fl D Ar sym |
.Op = Ar val |
.Op = Ar val |
.Xc |
.Xc |
.Sm on |
.Sm on |
.It Fl iU Ns Ar sym |
.It Fl U Ns Ar sym |
Ignore |
Specify that a macro is defined |
.Ic #ifdef Ns s . |
.Pq Fl D |
If your C code uses |
to a given value, |
.Ic #ifdef Ns s |
to 1 if no value is given, |
to delimit non-C lines, |
or undefined |
such as comments |
.Pq Fl U . |
or code which is under construction, |
.Pp |
then you must tell |
If the same macro appears in more than one argument, |
|
the last occurrence dominates. |
|
.Pp |
|
.It Fl d |
|
Turn on printing of debugging messages. |
|
.Pp |
|
.It Fl e |
|
By default, |
.Nm |
.Nm |
which symbols are used for that purpose so that it will not try to parse |
will report an error if it needs to remove |
comments and line continuations |
a preprocessor directive that spans more than one line, |
inside those |
for example, if it has a multi-line |
.Ic #ifdef Ns s . |
comment hanging off its right hand end. |
One specifies ignored symbols with |
The |
.Sm off |
.Fl e |
.Fl iD Ar sym Op = Ar val |
flag makes it ignore the line instead. |
.Sm on |
|
and |
|
.Fl iU Ns Ar sym , |
|
similar to |
|
.Sm off |
|
.Fl D Ar sym Op = Ar val |
|
.Sm on |
|
and |
|
.Fl U Ns Ar sym . |
|
.Pp |
.Pp |
.It Fl f Ar defile |
.It Fl f Ar defile |
The file |
The file |
|
|
.Fl D |
.Fl D |
and |
and |
.Fl U |
.Fl U |
command-line arguments. |
command line arguments. |
You can have multiple |
Multiple |
.Fl f |
.Fl f |
arguments and mix them with |
arguments can be given and mixed with |
.Fl D |
.Fl D |
and |
and |
.Fl U |
.Fl U |
|
|
Function-like macro definitions (with arguments) |
Function-like macro definitions (with arguments) |
are treated as if they are set to 1. |
are treated as if they are set to 1. |
.Pp |
.Pp |
.It Fl b |
.Sm off |
Replace removed lines with blank lines |
.It Xo |
instead of deleting them. |
.Fl iD Ar sym |
Mutually exclusive with the |
.Op = Ar val |
.Fl B |
.Xc |
option. |
.Sm on |
.Pp |
.It Fl iU Ns Ar sym |
.It Fl B |
Ignore |
Compress blank lines around a deleted section. |
.Ic #ifdef Ns s . |
Mutually exclusive with the |
If C code uses |
.Fl b |
.Ic #ifdef Ns s |
option. |
to delimit non-C lines, |
.Pp |
such as comments |
.It Fl c |
or code which is under construction, |
Complement, |
this tells |
i.e., lines that would have been removed or blanked |
|
are retained and vice versa. |
|
.Pp |
|
.It Fl d |
|
Turn on printing of debugging messages. |
|
.Pp |
|
.It Fl e |
|
By default, |
|
.Nm |
.Nm |
will report an error if it needs to remove |
which symbols are used for that purpose so that it will not try to parse |
a preprocessor directive that spans more than one line, |
comments and line continuations |
for example, if it has a multi-line |
inside those |
comment hanging off its right hand end. |
.Ic #ifdef Ns s . |
The |
|
.Fl e |
|
flag makes it ignore the line instead. |
|
.Pp |
.Pp |
|
If the same macro appears in more than one argument, |
|
the last occurrence dominates. |
|
.Pp |
.It Fl h |
.It Fl h |
Print help. |
Print help. |
.Pp |
.Pp |
|
|
and are used as a kind of comment to sketch out future or past development. |
and are used as a kind of comment to sketch out future or past development. |
It would be rude to strip them out, just as it would be for normal comments. |
It would be rude to strip them out, just as it would be for normal comments. |
.Pp |
.Pp |
.It Fl m |
|
Modify one or more input files in place. |
|
.Pp |
|
.It Fl M Ar backext |
.It Fl M Ar backext |
Modify input files in place, and keep backups of the original files by |
Modify input files in place, and keep backups of the original files by |
appending the |
appending the |
.Ar backext |
.Ar backext |
to the input filenames. |
to the input filenames. |
.Pp |
.Pp |
|
.It Fl m |
|
Modify one or more input files in place. |
|
.Pp |
.It Fl n |
.It Fl n |
Add |
Add |
.Li #line |
.Li #line |
|
|
.Ar outfile |
.Ar outfile |
instead of the standard output when processing a single file. |
instead of the standard output when processing a single file. |
.Pp |
.Pp |
.It Fl s |
|
Instead of processing an input file as usual, |
|
this option causes |
|
.Nm |
|
to produce a list of macros that are used in |
|
preprocessor directive controlling expressions. |
|
.Pp |
|
.It Fl S |
.It Fl S |
Like the |
Like the |
.Fl s |
.Fl s |
|
|
This is useful for working out the number of possible combinations |
This is useful for working out the number of possible combinations |
of interdependent defined/undefined macros. |
of interdependent defined/undefined macros. |
.Pp |
.Pp |
|
.It Fl s |
|
Instead of processing an input file as usual, |
|
this option causes |
|
.Nm |
|
to produce a list of macros that are used in |
|
preprocessor directive controlling expressions. |
|
.Pp |
.It Fl t |
.It Fl t |
Disables parsing for C strings, comments, |
Disables parsing for C strings, comments, |
and line continuations, |
and line continuations, |
|
|
.It Fl V |
.It Fl V |
Print version details. |
Print version details. |
.Pp |
.Pp |
.It Fl x Bro Ar 012 Brc |
.It Fl x Cm 0 | 1 | 2 |
Set exit status mode to zero, one, or two. |
Set exit status mode to zero, one, or two. |
See the |
See the |
.Sx EXIT STATUS |
.Sx EXIT STATUS |
|
|
if there are no |
if there are no |
.Ar file |
.Ar file |
arguments. |
arguments. |
You must use the |
The |
.Fl m |
.Fl m |
or |
or |
.Fl M |
.Fl M |
options if there are multiple input files. |
options must be used if there are multiple input files. |
You can specify inut from stdin or output to stdout with |
A dash |
.Ql - . |
.Pq - |
|
specifies input from stdin or output to stdout. |
.Pp |
.Pp |
The |
The |
.Nm |
.Nm |