version 1.10, 2002/12/02 07:18:50 |
version 1.11, 2003/01/22 18:26:15 |
|
|
.Nd remove preprocessor conditionals from code |
.Nd remove preprocessor conditionals from code |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm |
.Nm |
.Op Fl cklst |
.Op Fl ceklst |
.Oo |
.Oo |
.Fl I Ns Ar path |
.Fl I Ns Ar path |
.Fl D Ns Ar sym |
.Fl D Ns Ar sym |
|
|
to know when one of the directives is inactive |
to know when one of the directives is inactive |
because it is inside |
because it is inside |
a comment, |
a comment, |
or a single or double quote. |
or affected by a backslash-continued line. |
Parsing for quotes is very simplistic: |
It spots unusually-formatted preprocessor directives |
when it finds an open quote, |
and knows when the layout is too odd to handle. |
it ignores everything (except escaped quotes) |
|
until it finds a close quote, and |
|
it will not complain if it gets |
|
to the end of a line and finds no backslash for continuation. |
|
.Pp |
.Pp |
Available options: |
Available options: |
.Bl -tag -width indent -compact |
.Bl -tag -width indent -compact |
|
|
i.e., the lines that would have been removed or blanked |
i.e., the lines that would have been removed or blanked |
are retained and vice versa. |
are retained and vice versa. |
.Pp |
.Pp |
|
.It Fl e |
|
Because |
|
.Nm |
|
processes its input one line at a time, |
|
it cannot remove preprocessor directives that span more than one line. |
|
The most common example of this is a directive with a multi-line |
|
comment hanging off its right hand end. |
|
By default, |
|
if |
|
.Nm |
|
has to process such a directive, |
|
it will complain that the line is too obfuscated. |
|
The |
|
.Fl e |
|
option changes the behavior so that, |
|
where possible, |
|
such lines are left unprocessed instead of reporting an error. |
|
.Pp |
.It Fl k |
.It Fl k |
Process |
Process |
.Ic #if |
.Ic #if |
|
|
command lines. |
command lines. |
.Pp |
.Pp |
.It Fl t |
.It Fl t |
Disables parsing for C comments and quotes, which is useful |
Disables parsing for C comments |
|
and line continuations, |
|
which is useful |
for plain text. |
for plain text. |
.Pp |
.Pp |
.It Fl iD Ns Ar sym |
.It Fl iD Ns Ar sym |
|
|
then you must tell |
then you must tell |
.Nm |
.Nm |
which symbols are used for that purpose so that it will not try to parse |
which symbols are used for that purpose so that it will not try to parse |
for quotes and comments |
comments and line continuations |
inside those |
inside those |
.Ic #ifdef Ns s . |
.Ic #ifdef Ns s . |
One specifies ignored symbols with |
One specifies ignored symbols with |
|
|
.Sh DIAGNOSTICS |
.Sh DIAGNOSTICS |
.Bl -item |
.Bl -item |
.It |
.It |
Inappropriate elif, else or endif. |
Too many levels of nesting. |
.It |
.It |
|
Inappropriate |
|
.Ic #elif , |
|
.Ic #else |
|
or |
|
.Ic #endif . |
|
.It |
|
Obfuscated preprocessor control line. |
|
.It |
Premature |
Premature |
.Tn EOF |
.Tn EOF |
with line numbers of the unterminated |
(with the line number of the most recent unterminated |
.Ic #ifdef Ns s . |
.Ic #if ) . |
|
.It |
|
.Tn EOF |
|
in comment. |
.El |
.El |
.Pp |
.Pp |
The |
The |
|
|
.Sh BUGS |
.Sh BUGS |
Expression evaluation is very limited. |
Expression evaluation is very limited. |
.Pp |
.Pp |
Does not work correctly if input contains nul characters. |
Preprocessor control lines split across more than one physical line |
|
(because of comments or backslash-newline) |
|
cannot be handled in every situation. |
|
.Pp |
|
Trigraphs are not recognized. |
|
.Pp |
|
There is no support for symbols with different definitions at |
|
different points in the source file. |
|
.Pp |
|
The text-mode and ignore functionality doesn't correspond to modern |
|
.Xr cpp 1 |
|
behaviour. |
.Sh HISTORY |
.Sh HISTORY |
The |
The |
.Nm |
.Nm |