1994-05-27 12:33:43 +00:00
|
|
|
.\" Copyright (c) 1985, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
2013-03-28 20:33:07 +00:00
|
|
|
.\" Copyright (c) 2002 - 2013 Tony Finch <dot@dotat.at>. All rights reserved.
|
1994-05-27 12:33:43 +00:00
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
2005-03-08 12:52:00 +00:00
|
|
|
.\" Dave Yost. It was rewritten to support ANSI C by Tony Finch.
|
1994-05-27 12:33:43 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2005-03-08 12:52:00 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-27 12:33:43 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 01:08:13 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-27 12:33:43 +00:00
|
|
|
.\"
|
2015-02-25 21:10:03 +00:00
|
|
|
.Dd January 7, 2014
|
2013-03-28 20:33:07 +00:00
|
|
|
.Dt UNIFDEF 1 PRM
|
|
|
|
.Os " "
|
1994-05-27 12:33:43 +00:00
|
|
|
.Sh NAME
|
2002-05-30 11:29:25 +00:00
|
|
|
.Nm unifdef , unifdefall
|
2002-05-15 16:30:28 +00:00
|
|
|
.Nd remove preprocessor conditionals from code
|
1994-05-27 12:33:43 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
2013-03-28 20:33:07 +00:00
|
|
|
.Op Fl bBcdehKkmnsStV
|
2005-03-08 12:52:00 +00:00
|
|
|
.Op Fl I Ns Ar path
|
2013-03-28 20:33:07 +00:00
|
|
|
.Op Fl [i]D Ns Ar sym Ns Op = Ns Ar val
|
|
|
|
.Op Fl [i]U Ns Ar sym
|
1994-05-27 12:33:43 +00:00
|
|
|
.Ar ...
|
2015-02-25 21:10:03 +00:00
|
|
|
.Op Fl f Ar defile
|
2013-03-28 20:33:07 +00:00
|
|
|
.Op Fl x Bro Ar 012 Brc
|
|
|
|
.Op Fl M Ar backext
|
2010-01-19 18:13:54 +00:00
|
|
|
.Op Fl o Ar outfile
|
2013-03-28 20:33:07 +00:00
|
|
|
.Op Ar infile ...
|
2002-05-15 16:30:28 +00:00
|
|
|
.Nm unifdefall
|
|
|
|
.Op Fl I Ns Ar path
|
|
|
|
.Ar ...
|
|
|
|
.Ar file
|
1994-05-27 12:33:43 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-04-20 12:18:28 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2002-05-15 16:30:28 +00:00
|
|
|
utility selectively processes conditional
|
|
|
|
.Xr cpp 1
|
|
|
|
directives.
|
|
|
|
It removes from a file
|
|
|
|
both the directives
|
|
|
|
and any additional text that they specify should be removed,
|
|
|
|
while otherwise leaving the file alone.
|
|
|
|
.Pp
|
2002-04-20 12:18:28 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility acts on
|
2013-03-28 20:33:07 +00:00
|
|
|
.Ic #if , #ifdef , #ifndef ,
|
|
|
|
.Ic #elif , #else ,
|
2002-05-15 16:30:28 +00:00
|
|
|
and
|
2002-05-30 11:29:25 +00:00
|
|
|
.Ic #endif
|
2015-02-25 21:10:03 +00:00
|
|
|
lines,
|
|
|
|
using macros specified in
|
|
|
|
.Fl D
|
|
|
|
and
|
|
|
|
.Fl U
|
|
|
|
command line options or in
|
|
|
|
.Fl f
|
|
|
|
definitions files.
|
|
|
|
A directive is processed
|
|
|
|
if the macro specifications are sufficient to provide
|
|
|
|
a definite value for its control expression.
|
2009-11-25 20:23:18 +00:00
|
|
|
If the result is false,
|
|
|
|
the directive and the following lines under its control are removed.
|
|
|
|
If the result is true,
|
|
|
|
only the directive is removed.
|
|
|
|
An
|
|
|
|
.Ic #ifdef
|
|
|
|
or
|
|
|
|
.Ic #ifndef
|
|
|
|
directive is passed through unchanged
|
2015-02-25 21:10:03 +00:00
|
|
|
if its controlling macro is not specified.
|
2009-11-25 20:23:18 +00:00
|
|
|
Any
|
|
|
|
.Ic #if
|
|
|
|
or
|
|
|
|
.Ic #elif
|
|
|
|
control expression that has an unknown value or that
|
|
|
|
.Nm
|
|
|
|
cannot parse is passed through unchanged.
|
|
|
|
By default,
|
|
|
|
.Nm
|
|
|
|
ignores
|
|
|
|
.Ic #if
|
|
|
|
and
|
|
|
|
.Ic #elif
|
|
|
|
lines with constant expressions;
|
|
|
|
it can be told to process them by specifying the
|
|
|
|
.Fl k
|
|
|
|
flag on the command line.
|
|
|
|
.Pp
|
|
|
|
It understands a commonly-used subset
|
2002-05-15 16:30:28 +00:00
|
|
|
of the expression syntax for
|
2002-05-30 11:29:25 +00:00
|
|
|
.Ic #if
|
2002-05-15 16:30:28 +00:00
|
|
|
and
|
2002-05-30 11:29:25 +00:00
|
|
|
.Ic #elif
|
2009-11-25 20:23:18 +00:00
|
|
|
lines:
|
|
|
|
integer constants,
|
2015-02-25 21:10:03 +00:00
|
|
|
integer values of macros defined on the command line,
|
2002-05-15 16:30:28 +00:00
|
|
|
the
|
|
|
|
.Fn defined
|
2009-11-25 20:23:18 +00:00
|
|
|
operator,
|
2002-05-15 16:30:28 +00:00
|
|
|
the operators
|
2013-03-28 20:33:07 +00:00
|
|
|
.Ic \&! , < , > ,
|
|
|
|
.Ic <= , >= , == , != ,
|
|
|
|
.Ic && , || ,
|
2002-09-24 19:48:39 +00:00
|
|
|
and parenthesized expressions.
|
2009-11-25 20:23:18 +00:00
|
|
|
A kind of
|
|
|
|
.Dq "short circuit"
|
|
|
|
evaluation is used for the
|
|
|
|
.Ic &&
|
|
|
|
operator:
|
|
|
|
if either operand is definitely false then the result is false,
|
|
|
|
even if the value of the other operand is unknown.
|
|
|
|
Similarly,
|
|
|
|
if either operand of
|
|
|
|
.Ic ||
|
|
|
|
is definitely true then the result is true.
|
|
|
|
.Pp
|
2015-02-25 21:10:03 +00:00
|
|
|
When evaluating an expression,
|
2009-11-25 20:23:18 +00:00
|
|
|
.Nm
|
2015-02-25 21:10:03 +00:00
|
|
|
does not expand macros first.
|
|
|
|
The value of a macro must be a simple number,
|
|
|
|
not an expression.
|
|
|
|
A limited form of indirection is allowed,
|
|
|
|
where one macro's value is the name of another.
|
|
|
|
.Pp
|
|
|
|
In most cases,
|
|
|
|
.Nm
|
|
|
|
does not distinguish between object-like macros
|
|
|
|
(without arguments) and function-like macros (with arguments).
|
|
|
|
A function-like macro invocation can appear in
|
|
|
|
.Ic #if
|
|
|
|
and
|
|
|
|
.Ic #elif
|
|
|
|
control expressions.
|
|
|
|
If the macro is not explicitly defined,
|
|
|
|
or is defined with the
|
2009-11-25 20:23:18 +00:00
|
|
|
.Fl D
|
2015-02-25 21:10:03 +00:00
|
|
|
flag on the command-line,
|
|
|
|
or with
|
|
|
|
.Ic #define
|
|
|
|
in a
|
|
|
|
.Fl f
|
|
|
|
definitions file,
|
|
|
|
its arguments are ignored.
|
2009-11-25 20:23:18 +00:00
|
|
|
If a macro is explicitly undefined on the command line with the
|
|
|
|
.Fl U
|
2015-02-25 21:10:03 +00:00
|
|
|
flag,
|
|
|
|
or with
|
|
|
|
.Ic #undef
|
|
|
|
in a
|
|
|
|
.Fl f
|
|
|
|
definitions file,
|
|
|
|
it may not have any arguments since this leads to a syntax error.
|
2002-05-15 16:30:28 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
2009-11-25 20:23:18 +00:00
|
|
|
utility understands just enough about C
|
2002-05-15 16:30:28 +00:00
|
|
|
to know when one of the directives is inactive
|
1994-05-27 12:33:43 +00:00
|
|
|
because it is inside
|
|
|
|
a comment,
|
2002-12-18 20:50:44 +00:00
|
|
|
or affected by a backslash-continued line.
|
|
|
|
It spots unusually-formatted preprocessor directives
|
2009-11-25 20:23:18 +00:00
|
|
|
and knows when the layout is too odd for it to handle.
|
1994-05-27 12:33:43 +00:00
|
|
|
.Pp
|
2002-05-15 16:30:28 +00:00
|
|
|
A script called
|
|
|
|
.Nm unifdefall
|
|
|
|
can be used to remove all conditional
|
|
|
|
.Xr cpp 1
|
|
|
|
directives from a file.
|
|
|
|
It uses
|
2002-05-30 11:29:25 +00:00
|
|
|
.Nm Fl s
|
2002-05-15 16:30:28 +00:00
|
|
|
and
|
2002-05-30 11:29:25 +00:00
|
|
|
.Nm cpp Fl dM
|
2015-02-25 21:10:03 +00:00
|
|
|
to get lists of all the controlling macros
|
2002-05-15 16:30:28 +00:00
|
|
|
and their definitions (or lack thereof),
|
|
|
|
then invokes
|
2002-05-30 11:29:25 +00:00
|
|
|
.Nm
|
2002-05-15 16:30:28 +00:00
|
|
|
with appropriate arguments to process the file.
|
2009-11-25 20:23:18 +00:00
|
|
|
.Sh OPTIONS
|
2002-05-30 11:29:25 +00:00
|
|
|
.Bl -tag -width indent -compact
|
2010-02-19 16:54:51 +00:00
|
|
|
.It Fl D Ns Ar sym Ns = Ns Ar val
|
2015-02-25 21:10:03 +00:00
|
|
|
Specify that a macro is defined to a given value.
|
2010-02-19 16:54:51 +00:00
|
|
|
.Pp
|
|
|
|
.It Fl D Ns Ar sym
|
2015-02-25 21:10:03 +00:00
|
|
|
Specify that a macro is defined to the value 1.
|
2002-05-15 16:30:28 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
.It Fl U Ns Ar sym
|
2015-02-25 21:10:03 +00:00
|
|
|
Specify that a macro is undefined.
|
|
|
|
.Pp
|
|
|
|
If the same macro appears in more than one argument,
|
1994-05-27 12:33:43 +00:00
|
|
|
the last occurrence dominates.
|
|
|
|
.Pp
|
2013-03-28 20:33:07 +00:00
|
|
|
.It Fl iD Ns Ar sym Ns Op = Ns Ar val
|
|
|
|
.It Fl iU Ns Ar sym
|
|
|
|
C strings, comments,
|
|
|
|
and line continuations
|
|
|
|
are ignored within
|
|
|
|
.Ic #ifdef
|
|
|
|
and
|
|
|
|
.Ic #ifndef
|
|
|
|
blocks
|
2015-02-25 21:10:03 +00:00
|
|
|
controlled by macros
|
2013-03-28 20:33:07 +00:00
|
|
|
specified with these options.
|
|
|
|
.Pp
|
2015-02-25 21:10:03 +00:00
|
|
|
.It Fl f Ar defile
|
|
|
|
The file
|
|
|
|
.Ar defile
|
|
|
|
contains
|
|
|
|
.Ic #define
|
|
|
|
and
|
|
|
|
.Ic #undef
|
|
|
|
preprocessor directives,
|
|
|
|
which have the same effect as the corresponding
|
|
|
|
.Fl D
|
|
|
|
and
|
|
|
|
.Fl U
|
|
|
|
command-line arguments.
|
|
|
|
You can have multiple
|
|
|
|
.Fl f
|
|
|
|
arguments and mix them with
|
|
|
|
.Fl D
|
|
|
|
and
|
|
|
|
.Fl U
|
|
|
|
arguments;
|
|
|
|
later options override earlier ones.
|
|
|
|
.Pp
|
|
|
|
Each directive must be on a single line.
|
|
|
|
Object-like macro definitions (without arguments)
|
|
|
|
are set to the given value.
|
|
|
|
Function-like macro definitions (with arguments)
|
|
|
|
are treated as if they are set to 1.
|
|
|
|
.Pp
|
2009-11-25 20:23:18 +00:00
|
|
|
.It Fl b
|
|
|
|
Replace removed lines with blank lines
|
|
|
|
instead of deleting them.
|
|
|
|
Mutually exclusive with the
|
|
|
|
.Fl B
|
|
|
|
option.
|
|
|
|
.Pp
|
2010-03-12 17:55:29 +00:00
|
|
|
.It Fl B
|
|
|
|
Compress blank lines around a deleted section.
|
|
|
|
Mutually exclusive with the
|
|
|
|
.Fl b
|
|
|
|
option.
|
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
.It Fl c
|
2013-03-28 20:33:07 +00:00
|
|
|
Complement,
|
|
|
|
i.e., lines that would have been removed or blanked
|
1994-05-27 12:33:43 +00:00
|
|
|
are retained and vice versa.
|
|
|
|
.Pp
|
2005-05-21 09:55:10 +00:00
|
|
|
.It Fl d
|
2010-08-01 09:10:09 +00:00
|
|
|
Turn on printing of debugging messages.
|
2005-05-21 09:55:10 +00:00
|
|
|
.Pp
|
2003-01-20 12:41:41 +00:00
|
|
|
.It Fl e
|
|
|
|
By default,
|
|
|
|
.Nm
|
2013-03-28 20:33:07 +00:00
|
|
|
will report an error if it needs to remove
|
|
|
|
a preprocessor directive that spans more than one line,
|
|
|
|
for example, if it has a multi-line
|
|
|
|
comment hanging off its right hand end.
|
2003-01-20 12:41:41 +00:00
|
|
|
The
|
|
|
|
.Fl e
|
2013-03-28 20:33:07 +00:00
|
|
|
flag makes it ignore the line instead.
|
|
|
|
.Pp
|
|
|
|
.It Fl h
|
|
|
|
Print help.
|
|
|
|
.Pp
|
|
|
|
.It Fl I Ns Ar path
|
|
|
|
Specifies to
|
|
|
|
.Nm unifdefall
|
|
|
|
an additional place to look for
|
|
|
|
.Ic #include
|
|
|
|
files.
|
|
|
|
This option is ignored by
|
|
|
|
.Nm
|
|
|
|
for compatibility with
|
|
|
|
.Xr cpp 1
|
|
|
|
and to simplify the implementation of
|
|
|
|
.Nm unifdefall .
|
2003-01-20 12:41:41 +00:00
|
|
|
.Pp
|
2009-11-25 20:23:18 +00:00
|
|
|
.It Fl K
|
|
|
|
Always treat the result of
|
|
|
|
.Ic &&
|
|
|
|
and
|
|
|
|
.Ic ||
|
|
|
|
operators as unknown if either operand is unknown,
|
|
|
|
instead of short-circuiting when unknown operands can't affect the result.
|
|
|
|
This option is for compatibility with older versions of
|
|
|
|
.Nm .
|
|
|
|
.Pp
|
2002-09-24 19:27:44 +00:00
|
|
|
.It Fl k
|
|
|
|
Process
|
|
|
|
.Ic #if
|
|
|
|
and
|
|
|
|
.Ic #elif
|
|
|
|
lines with constant expressions.
|
|
|
|
By default, sections controlled by such lines are passed through unchanged
|
|
|
|
because they typically start
|
2002-12-04 14:42:49 +00:00
|
|
|
.Dq Li "#if 0"
|
2002-09-24 19:27:44 +00:00
|
|
|
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.
|
|
|
|
.Pp
|
2013-03-28 20:33:07 +00:00
|
|
|
.It Fl m
|
|
|
|
Modify one or more input files in place.
|
|
|
|
.Pp
|
|
|
|
.It Fl M Ar backext
|
|
|
|
Modify input files in place, and keep backups of the original files by
|
|
|
|
appending the
|
|
|
|
.Ar backext
|
|
|
|
to the input filenames.
|
|
|
|
.Pp
|
2005-03-08 12:52:00 +00:00
|
|
|
.It Fl n
|
|
|
|
Add
|
|
|
|
.Li #line
|
|
|
|
directives to the output following any deleted lines,
|
|
|
|
so that errors produced when compiling the output file correspond to
|
|
|
|
line numbers in the input file.
|
|
|
|
.Pp
|
2010-01-19 18:13:54 +00:00
|
|
|
.It Fl o Ar outfile
|
|
|
|
Write output to the file
|
|
|
|
.Ar outfile
|
2013-03-28 20:33:07 +00:00
|
|
|
instead of the standard output when processing a single file.
|
2010-01-19 18:13:54 +00:00
|
|
|
.Pp
|
2002-05-15 16:30:28 +00:00
|
|
|
.It Fl s
|
2013-03-28 20:33:07 +00:00
|
|
|
Instead of processing an input file as usual,
|
2002-05-15 16:30:28 +00:00
|
|
|
this option causes
|
|
|
|
.Nm
|
2015-02-25 21:10:03 +00:00
|
|
|
to produce a list of macros that are used in
|
|
|
|
preprocessor directive controlling expressions.
|
2002-05-15 16:30:28 +00:00
|
|
|
.Pp
|
2010-03-12 17:55:29 +00:00
|
|
|
.It Fl S
|
|
|
|
Like the
|
|
|
|
.Fl s
|
2015-02-25 21:10:03 +00:00
|
|
|
option, but the nesting depth of each macro is also printed.
|
2010-03-12 17:55:29 +00:00
|
|
|
This is useful for working out the number of possible combinations
|
2015-02-25 21:10:03 +00:00
|
|
|
of interdependent defined/undefined macros.
|
2010-03-12 17:55:29 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
.It Fl t
|
2013-03-28 20:33:07 +00:00
|
|
|
Disables parsing for C strings, comments,
|
2002-12-18 20:50:44 +00:00
|
|
|
and line continuations,
|
|
|
|
which is useful
|
1994-05-27 12:33:43 +00:00
|
|
|
for plain text.
|
2013-03-28 20:33:07 +00:00
|
|
|
This is a blanket version of the
|
|
|
|
.Fl iD
|
1994-05-27 12:33:43 +00:00
|
|
|
and
|
2013-03-28 20:33:07 +00:00
|
|
|
.Fl iU
|
|
|
|
flags.
|
2010-03-12 17:55:29 +00:00
|
|
|
.Pp
|
|
|
|
.It Fl V
|
|
|
|
Print version details.
|
2013-03-28 20:33:07 +00:00
|
|
|
.Pp
|
|
|
|
.It Fl x Bro Ar 012 Brc
|
|
|
|
Set exit status mode to zero, one, or two.
|
|
|
|
See the
|
|
|
|
.Sx EXIT STATUS
|
|
|
|
section below for details.
|
1994-05-27 12:33:43 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2002-04-20 12:18:28 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2013-03-28 20:33:07 +00:00
|
|
|
utility takes its input from
|
1994-05-27 12:33:43 +00:00
|
|
|
.Em stdin
|
2013-03-28 20:33:07 +00:00
|
|
|
if there are no
|
1994-05-27 12:33:43 +00:00
|
|
|
.Ar file
|
2013-03-28 20:33:07 +00:00
|
|
|
arguments.
|
|
|
|
You must use the
|
|
|
|
.Fl m
|
|
|
|
or
|
|
|
|
.Fl M
|
|
|
|
options if there are multiple input files.
|
|
|
|
You can specify inut from stdin or output to stdout with
|
|
|
|
.Ql - .
|
1994-05-27 12:33:43 +00:00
|
|
|
.Pp
|
2002-04-20 12:18:28 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility works nicely with the
|
1994-05-27 12:33:43 +00:00
|
|
|
.Fl D Ns Ar sym
|
2002-05-15 16:30:28 +00:00
|
|
|
option of
|
|
|
|
.Xr diff 1 .
|
2005-01-18 13:43:56 +00:00
|
|
|
.Sh EXIT STATUS
|
2013-03-28 20:33:07 +00:00
|
|
|
In normal usage the
|
2005-01-18 13:43:56 +00:00
|
|
|
.Nm
|
2013-03-28 20:33:07 +00:00
|
|
|
utility's exit status depends on the mode set using the
|
|
|
|
.Fl x
|
|
|
|
option.
|
|
|
|
.Pp
|
|
|
|
If the exit mode is zero (the default) then
|
|
|
|
.Nm
|
|
|
|
exits with status 0 if the output is an exact copy of the input,
|
|
|
|
or with status 1 if the output differs.
|
|
|
|
.Pp
|
|
|
|
If the exit mode is one,
|
|
|
|
.Nm
|
|
|
|
exits with status 1 if the output is unmodified
|
|
|
|
or 0 if it differs.
|
|
|
|
.Pp
|
|
|
|
If the exit mode is two,
|
|
|
|
.Nm
|
|
|
|
exits with status zero in both cases.
|
|
|
|
.Pp
|
|
|
|
In all exit modes,
|
|
|
|
.Nm
|
|
|
|
exits with status 2 if there is an error.
|
|
|
|
.Pp
|
|
|
|
The exit status is 0 if the
|
|
|
|
.Fl h
|
|
|
|
or
|
|
|
|
.Fl V
|
|
|
|
command line options are given.
|
1994-05-27 12:33:43 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2002-05-30 11:29:25 +00:00
|
|
|
.Bl -item
|
2000-11-10 17:46:15 +00:00
|
|
|
.It
|
2002-12-18 20:50:44 +00:00
|
|
|
Too many levels of nesting.
|
|
|
|
.It
|
|
|
|
Inappropriate
|
|
|
|
.Ic #elif ,
|
|
|
|
.Ic #else
|
|
|
|
or
|
|
|
|
.Ic #endif .
|
|
|
|
.It
|
|
|
|
Obfuscated preprocessor control line.
|
2000-11-10 17:46:15 +00:00
|
|
|
.It
|
1994-05-27 12:33:43 +00:00
|
|
|
Premature
|
|
|
|
.Tn EOF
|
2002-12-18 20:50:44 +00:00
|
|
|
(with the line number of the most recent unterminated
|
2002-12-23 15:14:12 +00:00
|
|
|
.Ic #if ) .
|
2002-12-18 20:50:44 +00:00
|
|
|
.It
|
|
|
|
.Tn EOF
|
|
|
|
in comment.
|
2000-11-10 17:46:15 +00:00
|
|
|
.El
|
2005-01-18 13:43:56 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr cpp 1 ,
|
|
|
|
.Xr diff 1
|
2015-02-25 21:10:03 +00:00
|
|
|
.Pp
|
|
|
|
The unifdef home page is
|
|
|
|
.Pa http://dotat.at/prog/unifdef
|
2005-01-18 13:43:56 +00:00
|
|
|
.Sh HISTORY
|
2002-05-30 11:29:25 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2005-01-18 13:43:56 +00:00
|
|
|
command appeared in
|
2008-05-02 16:23:47 +00:00
|
|
|
.Bx 2.9 .
|
2005-01-18 13:43:56 +00:00
|
|
|
.Tn ANSI\~C
|
|
|
|
support was added in
|
|
|
|
.Fx 4.7 .
|
2008-05-02 16:23:47 +00:00
|
|
|
.Sh AUTHORS
|
2014-06-23 08:23:05 +00:00
|
|
|
.An -nosplit
|
2009-11-25 20:23:18 +00:00
|
|
|
The original implementation was written by
|
2014-06-23 08:23:05 +00:00
|
|
|
.An Dave Yost Aq Mt Dave@Yost.com .
|
|
|
|
.An Tony Finch Aq Mt dot@dotat.at
|
2008-05-02 16:23:47 +00:00
|
|
|
rewrote it to support
|
|
|
|
.Tn ANSI\~C .
|
1994-05-27 12:33:43 +00:00
|
|
|
.Sh BUGS
|
2002-05-15 16:30:28 +00:00
|
|
|
Expression evaluation is very limited.
|
1994-05-27 12:33:43 +00:00
|
|
|
.Pp
|
2013-03-28 20:33:07 +00:00
|
|
|
Handling one line at a time means
|
|
|
|
preprocessor directives split across more than one physical line
|
2002-12-18 20:50:44 +00:00
|
|
|
(because of comments or backslash-newline)
|
2003-01-20 12:41:41 +00:00
|
|
|
cannot be handled in every situation.
|
2002-12-18 20:50:44 +00:00
|
|
|
.Pp
|
|
|
|
Trigraphs are not recognized.
|
|
|
|
.Pp
|
2015-02-25 21:10:03 +00:00
|
|
|
There is no support for macros with different definitions at
|
2002-12-18 20:50:44 +00:00
|
|
|
different points in the source file.
|
|
|
|
.Pp
|
2002-12-23 15:14:12 +00:00
|
|
|
The text-mode and ignore functionality does not correspond to modern
|
2002-12-18 20:50:44 +00:00
|
|
|
.Xr cpp 1
|
|
|
|
behaviour.
|