Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.
Still need to add real targets under targets/ to build packages.
Differential Revision: D2796
Reviewed by: brooks imp
The most notable new feature is support for processing multiple
files in one invocation. There is also support for more make-friendly
exit statuses.
The most notable bug fix is #line directives now include the input
file name.
Obtained from: http://dotat.at/prog/unifdef
Only significant change is to fix a bu when the output file overwrites
the input when the input is redirected.
Obtained from: http://dotat.at/prog/unifdef
Fix a long-standing cpp compatibility bug: The -DFOO argument
(without an explicit value) should define FOO to 1 not to the empty
string.
Add support for CRLF newlines, based on a suggestion from Mark Rushakoff.
Obtained from: http://dotat.at/prog/unifdef/
file can safely be the same as the input file. Idea from IRIX unifdef(1).
This version fixes a bug in the NetBSD unifdef which refuses to
write to a -o outfile which does not exist.
Obtained from: NetBSD
If the number of nested #if blocks exceeds 64, nest() increments
the nesting depth and then reports an error. The message includes
the line number for the start of the current #if block, which is
read from past the end of the relevant array.
Avoid the out-of-bounds read by reporting the error and exiting
before the nesting depth has a chance to increase.
Submitted by: Jonathan Nieder <jrnieder@gmail.com>
The old code used a shell loop to convert each controlling macro
definition into a command-line argument, reading the macro definitions
file each time. The new code converts the list of controlling macros
into a sed script which can run through the list of macro definitions
in one go.
Add some explanatory comments, since the code is quite meta.
Use {} instead of () for redirecting a group of commands.
Submitted by: Jonathan Nieder <jrnieder@gmail.com>
Main highlights:
(A) The new -B option compresses blank lines around a deleted section
so that blank lines around "paragraphs" of code don't get doubled.
(B) Lenient evaluation of && and || so that #if expressions can be
evaluated even when some of their sub-expressions cannot be.
(C) The evaluator can now handle macros with arguments.
(D) Portability fixes, especially for unifdefall.
Contributions from:
Ben Hutchings at Solarflare Communications (A and B)
Anders H Kaseorg <andersk@mit.edu> (A and C)
Jonathan Nieder <jrnieder@gmail.com> (D)
Obtained from: http://dotat.at/prog/unifdef/
caused by files that have #endif and no newline on the last line
(reported by joe@). Also fix a benign uninitialized variable bug.
Update and tidy the copyright.
Allow the user to run unifdef without defining any symbols. This is
useful in conjunction with the -k flag.
Fix a bug in the -s handling code that would have caused out-of-bounds
array accesses.
Add a -n option to insert #line directives in the output.
Ignore comment markers inside string and character literals
(bug reported by Amos Shapira <amos.shapira@netregistry.com.au>).
More accurate copyright notices.
Fix the usage synopsis.
Amend the copyright notice to reflect the fact that there's no Berkeley
code left.
Fix a typo in a comment, improve the descriptions of the way we use
some global variables (relevant to the bug below), and note that
division-by-zero has side effects so the current expression evaluator
can't be trivially extended to arithmetic in its current design.
Avoid hitting an abort(); /* bug */ when in "text mode" (i.e.
ignoring comment state) by updating the line parser state properly.
PR: 53907
* Be less strict about multi-line preprocessor directives (e.g. those
with comments hanging off the right-hand end) since they're more
of a problem in practise than I expected. Prompted by phk.
* Fix the handling of "ignore" symbols.
* Style pedantry from OpenBSD and Ted Unangst <tedu@stanford.edu>,
including some whitespace fixes and removal of strcpy()
(and not including excessively strict KNF enforcement).
* Fix some typos and terminological inconsistencies.
* The partial-evaluation of #elif sequences was broken and the
spaghetti logic of its implementation was too hard to understand.
I've re-done it using a straight-forward table-driven push-down
automaton.
* The pre-processor line parser did not allow for all of the weird
places that people might put comments, which could have caused it
to add syntax-errors to the output by removing a #if line containing
the start- or end-marker of a comment.
* The lexer didn't need to special-case the handling of string-literals
or character-constants, but it did need to learn about line-continuations
(backslash-newline).
* The input routine was buggy and bit-rotten and trivially replacable
with fgets(). I've also made the program static- and const-safe and
improved the presentation-order. The formatting of the state-transition
tables remains non-stylish.
This commit-messsage was brought to you by code-point 45.
MFC-after: one-week