Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package unifdef for openSUSE:Factory checked in at 2021-03-10 08:57:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/unifdef (Old) and /work/SRC/openSUSE:Factory/.unifdef.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "unifdef" Wed Mar 10 08:57:09 2021 rev:21 rq:877843 version:2.12 Changes: -------- --- /work/SRC/openSUSE:Factory/unifdef/unifdef.changes 2015-12-06 07:41:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.unifdef.new.2378/unifdef.changes 2021-03-10 08:58:34.446970659 +0100 @@ -1,0 +2,13 @@ +Mon Mar 8 23:26:46 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 2.12: + * man: note incomplete C++ raw string literal support + * C++11 raw string literal support + * doc: clarify where to send bug reports + * unifdef.1: clarify backslash-newline behaviour in DESCRIPTION + * unifdef: more fixes for weird whitespace + * portability: fix problems compiling with C++ compiler + * Avoid -Wmissing-initializer + * man: use .Mt to mark up email addresses + +------------------------------------------------------------------- Old: ---- unifdef-2.11.tar.xz New: ---- unifdef-2.12.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ unifdef.spec ++++++ --- /var/tmp/diff_new_pack.r85ZHg/_old 2021-03-10 08:58:34.930971159 +0100 +++ /var/tmp/diff_new_pack.r85ZHg/_new 2021-03-10 08:58:34.930971159 +0100 @@ -1,7 +1,7 @@ # # spec file for package unifdef # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -20,12 +20,11 @@ Summary: Removes ifdefs from C files License: BSD-2-Clause Group: Development/Libraries/C and C++ -Version: 2.11 +Version: 2.12 Release: 0 -Url: http://dotat.at/prog/unifdef/ -Source: http://dotat.at/prog/unifdef/unifdef-%{version}.tar.xz +URL: https://dotat.at/prog/unifdef/ +Source: https://dotat.at/prog/unifdef/unifdef-%{version}.tar.xz BuildRequires: xz -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Unifdef is useful for removing ifdef'ed lines from a file while otherwise @@ -52,11 +51,11 @@ %{?make_install} %{!?make_install:make install DESTDIR=%{buildroot}} %files -%defattr(-,root,root) +%license COPYING +%doc Changelog README %{_bindir}/unifdef %{_bindir}/unifdefall %{_mandir}/man1/unifdef.1* %{_mandir}/man1/unifdefall.1* -%doc Changelog COPYING README %changelog ++++++ unifdef-2.11.tar.xz -> unifdef-2.12.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/.travis.yml new/unifdef-2.12/.travis.yml --- old/unifdef-2.11/.travis.yml 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/.travis.yml 2020-02-14 17:58:51.000000000 +0100 @@ -1,19 +1,42 @@ language: c +sudo: false + +os: + - linux + - osx + compiler: - gcc - clang matrix: - include: - - compiler: i586-mingw32msvc-gcc - env: BUILD_MINGW="yes" - -before_install: - - sudo apt-get -qq update + include: + ## Ubuntu 14.04 Trusty (beta), sudo required! + - os: linux + dist: trusty + sudo: required + compiler: gcc + env: TRUSTY="yes" + - os: linux + dist: trusty + sudo: required + compiler: clang + env: TRUSTY="yes" + ## MinGW / wine + - os: linux + sudo: required + compiler: i586-mingw32msvc-gcc + env: BUILD_MINGW="yes" + allow_failures: + - compiler: i586-mingw32msvc-gcc install: - - if test "${BUILD_MINGW}" = "yes"; then sudo apt-get -qq install wine; fi + - env | grep -v "encrypted" | LC_ALL=C sort + - if test "${BUILD_MINGW}" = "yes"; then + sudo apt-get -qq update && + sudo apt-get -qq install wine; + fi script: - if test "${BUILD_MINGW}" != "yes"; then @@ -28,8 +51,9 @@ make -f win32/Makefile.mingw test; fi -## whitelist branches: only: - master - - tmp + - next + - /^travis.*/ + - /^tmp.*/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/COPYING new/unifdef-2.12/COPYING --- old/unifdef-2.11/COPYING 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/COPYING 2020-02-14 17:58:51.000000000 +0100 @@ -14,7 +14,7 @@ Unless otherwise stated, the files in this package are: - Copyright (c) 2002 - 2015 Tony Finch <d...@dotat.at> + Copyright (c) 2002 - 2020 Tony Finch <d...@dotat.at> unifdefall.sh is: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/Changelog new/unifdef-2.12/Changelog --- old/unifdef-2.11/Changelog 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/Changelog 2020-02-14 17:58:51.000000000 +0100 @@ -1,13 +1,348 @@ --------------------------------------------------- -2015-12-03 12:10:08 +0000 Tony Finch <d...@dotat.at> (HEAD -> master, tag: -unifdef-2.11) +2020-02-14 16:49:56 +0000 Tony Finch <d...@dotat.at> + +scripts: cleaner Changelog + +The Changelog was contaminated by branch name decorations, but I only +want tags. Although there is a --decorate-refs-exclude option, it does +not seem to have any effect on the %d format specifier. Seems easier +to just leave them out altogether. + + scripts/gitlog2changelog.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--------------------------------------------------- +2020-02-14 16:49:31 +0000 Tony Finch <d...@dotat.at> Bump copyright dates COPYING | 2 +- - unifdef.1 | 4 ++-- unifdef.c | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) + 2 files changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2020-02-14 16:35:26 +0000 Tony Finch <d...@dotat.at> + +man: note incomplete C++ raw string literal support + + unifdef.1 | 6 ++++++ + 1 file changed, 6 insertions(+) + +--------------------------------------------------- +2020-02-14 17:03:59 +0100 Zenju <ze...@gmx.de> + + C++11 raw string literal support + + unifdef.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +--------------------------------------------------- +2017-04-24 10:45:07 +0100 Tony Finch <d...@dotat.at> + +doc: clarify where to send bug reports + + README | 7 ++++--- + unifdef.1 | 16 +++++++++++----- + 2 files changed, 15 insertions(+), 8 deletions(-) + +--------------------------------------------------- +2017-03-21 13:26:15 +0000 Tony Finch <d...@dotat.at> + +unifdef.1: clarify backslash-newline behaviour in DESCRIPTION + + unifdef.1 | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--------------------------------------------------- +2017-02-06 18:52:47 +0000 Tony Finch <d...@dotat.at> + +web: advertise pre-release version + + web/index.html | 5 +++++ + 1 file changed, 5 insertions(+) + +--------------------------------------------------- +2017-02-06 18:49:50 +0000 Tony Finch <d...@dotat.at> + +Bump copyright dates + + COPYING | 2 +- + unifdef.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2017-02-06 18:21:55 +0000 Tony Finch <d...@dotat.at> + +unifdef: more fixes for weird whitespace + +The previous attempt (in commit 802c5cd6) to deal with some whitespace +corner cases had a bug when parsing a dangling C comment; rather than +using the general purpose lexer to scan the dangling line, it assumed +the line state must be dirty - which is not necessarily the case for +dangling C comments as it is for long linear whitespace or C++ +comments. + +The original example that exposed this problem was from Linux +__BACKPORT_LINUX_REGULATOR_DRIVER_H_; the test case in this +commit is based on analysis of the bug. + +Reported-By: pavel.aron...@celeno.com +Reported-By: aviv.alba...@celeno.com + + tests/dangle.c | 6 ++++++ + tests/dangle.experr | 0 + tests/dangle.expout | 6 ++++++ + tests/dangle.exprc | 1 + + tests/dangle.sh | 1 + + tests/whitespace-1.experr | 2 +- + unifdef.c | 6 ++++-- + 7 files changed, 19 insertions(+), 3 deletions(-) + +--------------------------------------------------- +2016-02-26 09:39:13 +0000 Tony Finch <d...@dotat.at> + +portability: fix problems compiling with C++ compiler + +Michael McConville suggested removing a "redundant" cast of +the return value from malloc(), based on a change in the +OpenBSD version of unifdef. This is a good suggestion for +a purely C program, but the cast is required in C++. + +Carsten Hey contributed some portability improvements in +2012 which included this cast, so that unifdef can be +compiled with a C++ compiler. Unfortunately since then +there have been several regressions in C++ support. + +This commit fixes those regressions. + + unifdef.c | 2 +- + win32/unifdef.h | 2 +- + win32/win32.c | 10 +++++----- + 3 files changed, 7 insertions(+), 7 deletions(-) + +--------------------------------------------------- +2016-02-16 16:58:21 +0000 Tony Finch <d...@dotat.at> + +test: need newlines in MinGW printf workaround + + tests/outperms.sh | 2 +- + tests/overperms.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 16:03:29 +0000 Tony Finch <d...@dotat.at> + +test: GNU printf(1) is POSIXly incorrect + + tests/outperms.sh | 2 +- + tests/overperms.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 14:37:18 +0000 Tony Finch <d...@dotat.at> + +test: ugly workaround for lack of chmod() in MinGW + + tests/outperms.sh | 5 ++++- + tests/overperms.sh | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 14:31:47 +0000 Tony Finch <d...@dotat.at> + +win32: nonexistent new file is not an error in rename(old,new) + + win32/win32.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--------------------------------------------------- +2016-02-16 14:06:53 +0000 Tony Finch <d...@dotat.at> + +win32: revert mktempmode() change - it does not help + + win32/win32.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--------------------------------------------------- +2016-02-16 14:05:40 +0000 Tony Finch <d...@dotat.at> + +test: revert rm change - I was misreading the error message! + + tests/multi-generic-sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 13:53:42 +0000 Tony Finch <d...@dotat.at> + +win32: more thorough implementation of mktempmde() + +Let's see if this makes the permissions tests pass. + + win32/win32.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 13:43:27 +0000 Tony Finch <d...@dotat.at> + +test: suppress error output from rm + +POSIX says rm -f should not produce any error messages or nonzero +exit status, but MinGW fails to follow the rules. + + tests/multi-generic-sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-16 13:35:00 +0000 Tony Finch <d...@dotat.at> + +test: typo in stderr redirection, sigh + + tests/000-init.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--------------------------------------------------- +2016-02-16 13:25:35 +0000 Tony Finch <d...@dotat.at> + +test: a hack for MinGW on Travis-CI + +The first test that is run for the MinGW build on Travis-CI is +exploding messily when it tries to initialize Wine, but after that +most of the other tests run OK. Let's try adding a fake non-test +to absorb this mess and get closer to a working build. + + tests/000-init.experr | 0 + tests/000-init.expout | 0 + tests/000-init.exprc | 1 + + tests/000-init.sh | 1 + + 4 files changed, 2 insertions(+) + +--------------------------------------------------- +2016-02-15 17:38:42 +0000 Tony Finch <d...@dotat.at> + +win32: preen comment + + win32/win32.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2016-02-15 17:33:12 +0000 Tony Finch <d...@dotat.at> + +win32: go back to slow snprintf() because MinGW is still troublesome + + win32/unifdef.h | 1 - + win32/win32.c | 33 ++++++++++++++++++++++++++------- + 2 files changed, 26 insertions(+), 8 deletions(-) + +--------------------------------------------------- +2016-02-15 17:09:33 +0000 Tony Finch <d...@dotat.at> + +README: thanks to Ruediger Meier! + + README | 3 +++ + 1 file changed, 3 insertions(+) + +--------------------------------------------------- +2016-02-15 17:12:45 +0000 Tony Finch <d...@dotat.at> + +win32: better snprintf() portability hack + +The code is now much shorter and does not malloc or copy. + +There is a #define renaming to avoid a name collision since +Visual Studio 2015 includes a standard snprintf. + +Reported-By: Ruediger Meier <ruediger.me...@ga-group.nl> + + win32/unifdef.h | 9 ++++++++- + win32/win32.c | 33 ++++++++------------------------- + 2 files changed, 16 insertions(+), 26 deletions(-) + +--------------------------------------------------- +2016-02-15 16:20:07 +0000 Tony Finch <d...@dotat.at> + +test: try to work better on MinGW + +A lot of the test failures are due to CRLFs in stderr which do not +match the bare LFs in the experr files. So, unilaterally strip CRs +from stderr output. + +We don't need to do this for stdout, since unifdef writes that in +binary mode so it can match the newline style of the input file. + +We might also need to fix the rc files - let's see how this change +works first. + + scripts/runtests.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +--------------------------------------------------- +2016-02-12 00:47:29 +0100 Ruediger Meier <ruediger.me...@ga-group.nl> + +travis: add OSX and Ubuntu Trusty builds + +Actually this is a rewrite of .travis.yml: + - speedup build (sudo: false) + - add OSX build + - add Ubuntu 14.04 Trusty build (beta) + - MinGW is allowed to fail silently (no more "Still Failing" emails!) + - add env output for debugging + +Note "apt-get install wine failed" for Trusty, that's why we don't +check MinGW there. + +Signed-off-by: Ruediger Meier <ruediger.me...@ga-group.nl> + + .travis.yml | 42 +++++++++++++++++++++++++++++++++--------- + 1 file changed, 33 insertions(+), 9 deletions(-) + +--------------------------------------------------- +2015-12-07 12:10:30 +0000 Tony Finch <d...@dotat.at> + +ifdef-how: what conditionals cause this line to be emitted? + +Suggested-by: Anthony Liu <ant...@gmail.com> + + ifdef-how.pl | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +--------------------------------------------------- +2015-12-03 14:34:11 +0000 Tony Finch <d...@dotat.at> + +Avoid -Wmissing-initializer + + unifdef.c | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) + +--------------------------------------------------- +2015-12-03 14:08:26 +0000 Tony Finch <d...@dotat.at> + +man: use .Mt to mark up email addresses + +Obtained-from: FreeBSD +Submitted-by: Franco Fichtner <fra...@lastsummer.de> + + unifdef.1 | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--------------------------------------------------- +2015-12-03 12:15:06 +0000 Tony Finch <d...@dotat.at> + +Freecode is read-only + + README | 3 --- + web/index.html | 2 -- + 2 files changed, 5 deletions(-) + +--------------------------------------------------- +2015-12-03 12:10:08 +0000 Tony Finch <d...@dotat.at> + +Bump copyright dates + + COPYING | 2 +- + unifdef.1 | 4 ++-- + unifdef.c | 2 +- + win32/unifdef.h | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) --------------------------------------------------- 2015-12-03 12:06:33 +0000 Tony Finch <d...@dotat.at> @@ -19,7 +354,7 @@ 2 files changed, 6 insertions(+), 3 deletions(-) --------------------------------------------------- -2015-12-03 11:50:46 +0000 Tony Finch <d...@dotat.at> (github/master) +2015-12-03 11:50:46 +0000 Tony Finch <d...@dotat.at> Fix uninitialized variable in evaluator. @@ -379,7 +714,7 @@ 5 files changed, 6 insertions(+) --------------------------------------------------- -2014-01-07 19:16:02 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.10) +2014-01-07 19:16:02 +0000 Tony Finch <d...@dotat.at> web: update for unifdef-2.10 release @@ -509,7 +844,7 @@ 1 file changed, 3 insertions(+), 10 deletions(-) --------------------------------------------------- -2013-06-07 11:53:51 +0100 Tony Finch <d...@dotat.at> (tag: unifdef-2.9) +2013-06-07 11:53:51 +0100 Tony Finch <d...@dotat.at> INSTALL: more portability notes. @@ -575,8 +910,7 @@ 1 file changed, 5 insertions(+), 5 deletions(-) --------------------------------------------------- -2013-05-10 00:16:01 +0200 Ruediger Meier <ruediger.me...@ga-group.nl> -(github/pull/4) +2013-05-10 00:16:01 +0200 Ruediger Meier <ruediger.me...@ga-group.nl> travis-ci: fix release traget by git cloning with infinite depth @@ -922,7 +1256,7 @@ 1 file changed, 5 insertions(+), 11 deletions(-) --------------------------------------------------- -2013-05-06 18:07:21 +0100 Tony Finch <d...@dotat.at> (tag: unifdef-2.8) +2013-05-06 18:07:21 +0100 Tony Finch <d...@dotat.at> INSTALL: be clearer about dependencies up front @@ -1453,7 +1787,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) --------------------------------------------------- -2013-03-28 19:05:30 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.7) +2013-03-28 19:05:30 +0000 Tony Finch <d...@dotat.at> bump copyright dates @@ -2012,7 +2346,7 @@ 1 file changed, 2 insertions(+) --------------------------------------------------- -2011-02-22 16:53:10 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.6) +2011-02-22 16:53:10 +0000 Tony Finch <d...@dotat.at> Release unifdef-2.6 @@ -2089,7 +2423,7 @@ 3 files changed, 5 insertions(+), 5 deletions(-) --------------------------------------------------- -2011-01-18 18:48:45 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.5) +2011-01-18 18:48:45 +0000 Tony Finch <d...@dotat.at> Release unifdef-2.5 @@ -2164,7 +2498,7 @@ 1 file changed, 11 insertions(+), 2 deletions(-) --------------------------------------------------- -2010-09-13 12:14:15 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.4) +2010-09-13 12:14:15 +0000 Tony Finch <d...@dotat.at> Re-roll release of unifdef-2.4 @@ -2410,7 +2744,7 @@ 1 file changed, 2 insertions(+), 2 deletions(-) --------------------------------------------------- -2010-03-12 16:27:30 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.3) +2010-03-12 16:27:30 +0000 Tony Finch <d...@dotat.at> Release unifdef-2.3 @@ -2516,7 +2850,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) --------------------------------------------------- -2010-03-12 10:15:18 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.2) +2010-03-12 10:15:18 +0000 Tony Finch <d...@dotat.at> Release unifdef-2.2 @@ -2580,7 +2914,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) --------------------------------------------------- -2010-03-11 21:17:58 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.1) +2010-03-11 21:17:58 +0000 Tony Finch <d...@dotat.at> Release unifdef-2.1 @@ -2723,8 +3057,7 @@ 3 files changed, 88 insertions(+) --------------------------------------------------- -2010-03-10 17:42:54 +0000 Tony Finch <d...@dotat.at> (tag: unifdef-2.0, -dotat-cvs) +2010-03-10 17:42:54 +0000 Tony Finch <d...@dotat.at> Improved debugging support. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/README new/unifdef-2.12/README --- old/unifdef-2.11/README 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/README 2020-02-14 17:58:51.000000000 +0100 @@ -11,9 +11,6 @@ Pre-formatted documentation can be found in unifdef.txt -You can subscribe to release announcements at: - http://freecode.com/projects/unifdef - You can download the latest release tar and zip files from: http://dotat.at/prog/unifdef @@ -23,9 +20,10 @@ I also maintain a copy at http://github.com/fanf2/unifdef (Warning: GitHub's zip download is incomplete and unusable.) -Please send bug reports and patches to me. Unless you state otherwise, -I will assume that any contributions are under the two-clause BSD -licence. See the COPYING file for details. +Please send bug reports and patches to me via email to the +address above. Unless you state otherwise, I will assume that +any contributions are under the two-clause BSD licence. See +the COPYING file for details. Thanks to the following people for their contributions: @@ -38,6 +36,9 @@ Anders H Kaseorg <ande...@mit.edu> - bug fixes and other improvements +Ruediger Meier <ruediger.me...@ga-group.nl> + - build and portability cleanups + Ben Hutchings at Solarflare Communications - lenient evaluation of && and || diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/ifdef-how.pl new/unifdef-2.12/ifdef-how.pl --- old/unifdef-2.11/ifdef-how.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/ifdef-how.pl 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +if (@ARGV != 2) { + die <<END; +usage: ifdef-how <file> <line> + +Print the sequence of preprocessor conditionals which lead to the +given line being retained after preprocessing. There is no output +if the line is always retained. Conditionals that must be true are +printed verbatim; conditionals that musy be false have their +preprocessor keyword prefixed with NOT. + +Warning: this program does not parse comments or strings, so it will +not handle tricky code correctly. +END +} + +my $file = shift; +my $line = shift; + +open my $fh, '<', $file + or die "ifdef-how: open $file: $!\n"; + +my @stack; +while (<$fh>) { + last if $. == $line; + if (m{^\s*#\s*(if|ifdef|ifndef)\b}) { + push @stack, $_; + } + if (m{^\s*#\s*(elif|else)\b}) { + $stack[-1] =~ s{^(\s*#\s*)(?!NOT)\b}{${1}NOT}gm; + $stack[-1] .= $_; + } + if (m{^\s*#\s*endif\b}) { + pop @stack; + } +} + +print @stack; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/scripts/gitlog2changelog.sh new/unifdef-2.12/scripts/gitlog2changelog.sh --- old/unifdef-2.11/scripts/gitlog2changelog.sh 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/scripts/gitlog2changelog.sh 2020-02-14 17:58:51.000000000 +0100 @@ -2,7 +2,8 @@ line="---------------------------------------------------" -git log --no-merges --decorate -M --stat --pretty=format:"$line%n%ai %an <%ae>%d%n%n%s%n%n%b" | +git log --no-merges -M --stat \ + --pretty=format:"$line%n%ai %an <%ae>%n%n%s%n%n%b" | uniq | fold -s echo echo $line diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/scripts/runtests.sh new/unifdef-2.12/scripts/runtests.sh --- old/unifdef-2.11/scripts/runtests.sh 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/scripts/runtests.sh 2020-02-14 17:58:51.000000000 +0100 @@ -10,6 +10,11 @@ sh ./${cmd} >${t}.out 2>${t}.err echo $? >${t}.rc + # strip carriage returns from error output + # in case we are trying to run on MinGW + tr -d ' ' >${t}.xerr <${t}.err + mv ${t}.xerr ${t}.err + ok=true for e in out err rc do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/000-init.exprc new/unifdef-2.12/tests/000-init.exprc --- old/unifdef-2.11/tests/000-init.exprc 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/000-init.exprc 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1 @@ +0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/000-init.sh new/unifdef-2.12/tests/000-init.sh --- old/unifdef-2.11/tests/000-init.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/000-init.sh 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1 @@ +unifdef </dev/null >/dev/null 2>&1 || true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/dangle.c new/unifdef-2.12/tests/dangle.c --- old/unifdef-2.11/tests/dangle.c 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/dangle.c 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1,6 @@ +#ifdef FIRST +wombats +#endif /* com + mmm + mmmm + ment */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/dangle.expout new/unifdef-2.12/tests/dangle.expout --- old/unifdef-2.11/tests/dangle.expout 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/dangle.expout 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1,6 @@ +#ifdef FIRST +wombats +#endif /* com + mmm + mmmm + ment */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/dangle.exprc new/unifdef-2.12/tests/dangle.exprc --- old/unifdef-2.11/tests/dangle.exprc 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/dangle.exprc 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1 @@ +0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/dangle.sh new/unifdef-2.12/tests/dangle.sh --- old/unifdef-2.11/tests/dangle.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/unifdef-2.12/tests/dangle.sh 2020-02-14 17:58:51.000000000 +0100 @@ -0,0 +1 @@ +unifdef dangle.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/outperms.sh new/unifdef-2.12/tests/outperms.sh --- old/unifdef-2.11/tests/outperms.sh 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/tests/outperms.sh 2020-02-14 17:58:52.000000000 +0100 @@ -1,7 +1,10 @@ umask 027 unifdef -DFOO=1 -DFOOB=42 -UBAR -ooutfile.c if1.c e=$? -ls -l outfile.c | cut -d' ' -f1 1>&2 +case ${BUILD_MINGW} in +(yes) printf '%s\n' '-rw-r-----' 1>&2 ;; +(*) ls -l outfile.c | cut -d' ' -f1 1>&2 ;; +esac cat outfile.c rm outfile.c exit $e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/overperms.sh new/unifdef-2.12/tests/overperms.sh --- old/unifdef-2.11/tests/overperms.sh 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/tests/overperms.sh 2020-02-14 17:58:52.000000000 +0100 @@ -3,7 +3,10 @@ ls -l outfile.c | cut -d' ' -f1 1>&2 unifdef -DFOO=1 -DFOOB=42 -UBAR -m outfile.c e=$? -ls -l outfile.c | cut -d' ' -f1 1>&2 +case ${BUILD_MINGW} in +(yes) printf '%s\n' '-rw-r-----' 1>&2 ;; +(*) ls -l outfile.c | cut -d' ' -f1 1>&2 ;; +esac cat outfile.c rm outfile.c exit $e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/tests/whitespace-1.experr new/unifdef-2.12/tests/whitespace-1.experr --- old/unifdef-2.11/tests/whitespace-1.experr 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/tests/whitespace-1.experr 2020-02-14 17:58:52.000000000 +0100 @@ -1,2 +1,2 @@ -unifdef: whitespace.c: 3: Obfuscated preprocessor control line (#if line 1 depth 1) +unifdef: whitespace.c: 4: Obfuscated preprocessor control line (#if line 1 depth 1) unifdef: Output may be truncated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/unifdef.1 new/unifdef-2.12/unifdef.1 --- old/unifdef-2.11/unifdef.1 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/unifdef.1 2020-02-14 17:58:52.000000000 +0100 @@ -182,9 +182,12 @@ to know when one of the directives is inactive because it is inside a comment, -or affected by a backslash-continued line. +or cannot be evaluated because it is split by a backslash-continued line. It spots unusually-formatted preprocessor directives -and knows when the layout is too odd for it to handle. +and passes them through unchanged when the layout is too odd for it to handle. +(See the +.Sx BUGS +section below.) .Pp A script called .Nm unifdefall @@ -485,30 +488,43 @@ support was added in .Fx 4.7 . .Sh AUTHORS +.An -nosplit The original implementation was written by -.An Dave Yost Aq d...@yost.com . -.An Tony Finch Aq d...@dotat.at +.An Dave Yost Aq Mt d...@yost.com . +.An Tony Finch Aq Mt d...@dotat.at rewrote it to support .Tn ANSI\~C . .Sh BUGS +.Bl -bullet +.It Expression evaluation is very limited. -.Pp +.It Character constants are not evaluated. String literals and character constants in .Fl f definition files are ignored rather than parsed as part of a macro's replacement tokens. -.Pp -Handling one line at a time means -preprocessor directives split across more than one physical line +.It +Only the basic form of C++ raw string literals is recognized, +like +.Li R"(string)" +without delimiters as in +.Li R"delimiter(string)delimiter" . +.It +Source files are processed one line at a time, +so preprocessor directives split across more than one physical line (because of comments or backslash-newline) cannot be handled in every situation. -.Pp +.It Trigraphs are not recognized. -.Pp +.It There is no support for macros with different definitions at different points in the source file. -.Pp +.It The text-mode and ignore functionality does not correspond to modern .Xr cpp 1 behaviour. +.El +.Pp +Please send bug reports by email to +.Aq Mt d...@dotat.at . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/unifdef.c new/unifdef-2.12/unifdef.c --- old/unifdef-2.11/unifdef.c 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/unifdef.c 2020-02-14 17:58:52.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002 - 2015 Tony Finch <d...@dotat.at> + * Copyright (c) 2002 - 2020 Tony Finch <d...@dotat.at> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -114,7 +114,8 @@ STARTING_COMMENT, /* just after slash-backslash-newline */ FINISHING_COMMENT, /* star-backslash-newline in a C comment */ CHAR_LITERAL, /* inside '' */ - STRING_LITERAL /* inside "" */ + STRING_LITERAL, /* inside "" */ + RAW_STRING_LITERAL /* inside R"()" */ } Comment_state; static char const * const comment_name[] = { @@ -848,12 +849,14 @@ if (fgets(tline + len, MAXLINE - len, input) == NULL) { if (ferror(input)) err(2, "can't read %s", filename); - /* append the missing newline at eof */ + debug("parser insert newline at EOF", linenum); strcpy(tline + len, newline); cp += strlen(newline); linestate = LS_START; } else { - linestate = LS_DIRTY; + debug("parser concatenate dangling whitespace"); + ++linenum; + cp = skipcomment(cp); } } if (retval != LT_PLAIN && (wascomment || linestate != LS_START)) { @@ -974,24 +977,24 @@ struct op op[5]; }; static const struct ops eval_ops[] = { - { eval_table, { { "||", op_or } } }, - { eval_table, { { "&&", op_and } } }, - { eval_table, { { "|", op_bor, "|" } } }, - { eval_table, { { "^", op_bxor } } }, - { eval_table, { { "&", op_band, "&" } } }, - { eval_table, { { "==", op_eq }, - { "!=", op_ne } } }, - { eval_table, { { "<=", op_le }, - { ">=", op_ge }, - { "<", op_lt, "<=" }, - { ">", op_gt, ">=" } } }, - { eval_table, { { "<<", op_blsh }, - { ">>", op_brsh } } }, - { eval_table, { { "+", op_add }, - { "-", op_sub } } }, - { eval_unary, { { "*", op_mul }, - { "/", op_div }, - { "%", op_mod } } }, + { eval_table, { { "||", op_or, NULL } } }, + { eval_table, { { "&&", op_and, NULL } } }, + { eval_table, { { "|", op_bor, "|" } } }, + { eval_table, { { "^", op_bxor, NULL } } }, + { eval_table, { { "&", op_band, "&" } } }, + { eval_table, { { "==", op_eq, NULL }, + { "!=", op_ne, NULL } } }, + { eval_table, { { "<=", op_le, NULL }, + { ">=", op_ge, NULL }, + { "<", op_lt, "<=" }, + { ">", op_gt, ">=" } } }, + { eval_table, { { "<<", op_blsh, NULL }, + { ">>", op_brsh, NULL } } }, + { eval_table, { { "+", op_add, NULL }, + { "-", op_sub, NULL } } }, + { eval_unary, { { "*", op_mul, NULL }, + { "/", op_div, NULL }, + { "%", op_mod, NULL } } }, }; /* Current operator precedence level */ @@ -1264,6 +1267,10 @@ incomment = STRING_LITERAL; linestate = LS_DIRTY; cp += 1; + } else if (strncmp(cp, "R\"(", 3) == 0) { + incomment = RAW_STRING_LITERAL; + linestate = LS_DIRTY; + cp += 3; } else if (strncmp(cp, "\n", 1) == 0) { linestate = LS_START; cp += 1; @@ -1298,6 +1305,13 @@ } else cp += 1; continue; + case RAW_STRING_LITERAL: + if (strncmp(cp, ")\"", 2) == 0) { + incomment = NO_COMMENT; + cp += 2; + } else + cp += 1; + continue; case C_COMMENT: if (strncmp(cp, "*\\\r\n", 4) == 0) { incomment = FINISHING_COMMENT; @@ -1626,7 +1640,7 @@ if (end < start) abort(); /* bug */ n = (size_t)(end - start) + 1; - s = malloc(n); + s = (char *)malloc(n); if (s == NULL) err(2, "malloc"); snprintf(s, n, "%s", start); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/unifdef.txt new/unifdef-2.12/unifdef.txt --- old/unifdef-2.11/unifdef.txt 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/unifdef.txt 2020-02-14 17:58:51.000000000 +0100 @@ -51,9 +51,11 @@ not have any arguments since this leads to a syntax error. The unifdef utility understands just enough about C to know when one of - the directives is inactive because it is inside a comment, or affected by - a backslash-continued line. It spots unusually-formatted preprocessor - directives and knows when the layout is too odd for it to handle. + the directives is inactive because it is inside a comment, or cannot be + evaluated because it is split by a backslash-continued line. It spots + unusually-formatted preprocessor directives and passes them through + unchanged when the layout is too odd for it to handle. (See the BUGS + section below.) A script called unifdefall can be used to remove all conditional cpp(1) directives from a file. It uses unifdef -s and cpp -dM to get lists of @@ -162,7 +164,7 @@ The unifdef utility takes its input from stdin if there are no file argu- ments. You must use the -m or -M options if there are multiple input - files. You can specify inut from stdin or output to stdout with `-'. + files. You can specify inut from stdin or output to stdout with '-'. The unifdef utility works nicely with the -Dsym option of diff(1). @@ -214,22 +216,27 @@ Tony Finch <d...@dotat.at> rewrote it to support ANSI C. BUGS - Expression evaluation is very limited. + o Expression evaluation is very limited. - Character constants are not evaluated. String literals and character - constants in -f definition files are ignored rather than parsed as part - of a macro's replacement tokens. + o Character constants are not evaluated. String literals and character + constants in -f definition files are ignored rather than parsed as + part of a macro's replacement tokens. - Handling one line at a time means preprocessor directives split across - more than one physical line (because of comments or backslash-newline) - cannot be handled in every situation. + o Only the basic form of C++ raw string literals is recognized, like + R"(string)" without delimiters as in R"delimiter(string)delimiter". - Trigraphs are not recognized. + o Source files are processed one line at a time, so preprocessor direc- + tives split across more than one physical line (because of comments + or backslash-newline) cannot be handled in every situation. - There is no support for macros with different definitions at different - points in the source file. + o Trigraphs are not recognized. - The text-mode and ignore functionality does not correspond to modern - cpp(1) behaviour. + o There is no support for macros with different definitions at differ- + ent points in the source file. + + o The text-mode and ignore functionality does not correspond to modern + cpp(1) behaviour. + + Please send bug reports by email to <d...@dotat.at>. December 3, 2015 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/version.h new/unifdef-2.12/version.h --- old/unifdef-2.11/version.h 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/version.h 2020-02-14 17:58:51.000000000 +0100 @@ -1,2 +1,2 @@ -"@(#) $Version: unifdef-2.11 $\n" -"@(#) $Date: 2015-12-03 12:10:08 +0000 $\n" +"@(#) $Version: unifdef-2.12 $\n" +"@(#) $Date: 2020-02-14 16:37:16 +0000 $\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/version.sh new/unifdef-2.12/version.sh --- old/unifdef-2.11/version.sh 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/version.sh 2020-02-14 17:58:51.000000000 +0100 @@ -1,2 +1,2 @@ -V="unifdef-2.11" -D="2015-12-03 12:10:08 +0000" +V="unifdef-2.12" +D="2020-02-14 16:37:16 +0000" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/win32/unifdef.h new/unifdef-2.12/win32/unifdef.h --- old/unifdef-2.11/win32/unifdef.h 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/win32/unifdef.h 2020-02-14 17:58:52.000000000 +0100 @@ -52,11 +52,17 @@ /* used by err.c and getopt.c */ #define _getprogname() "unifdef" +/* + * The snprintf() workaround is unnecessary in Visual Studio 2015 or later + * but dogma dictates that #if directives are not allowed inside unifdef. + */ +#define snprintf c99_snprintf + /* win32.c */ -int replace(const char *old, const char *new); +int replace(const char *oldname, const char *newname); FILE *mktempmode(char *tmp, int mode); FILE *fbinmode(FILE *fp); -int snprintf(char *buf, size_t buflen, const char *format, ...); +int c99_snprintf(char *buf, size_t buflen, const char *format, ...); /* err.c */ void err(int, const char *, ...); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unifdef-2.11/win32/win32.c new/unifdef-2.12/win32/win32.c --- old/unifdef-2.11/win32/win32.c 2015-12-03 13:12:04.000000000 +0100 +++ new/unifdef-2.12/win32/win32.c 2020-02-14 17:58:52.000000000 +0100 @@ -31,11 +31,11 @@ * remove anything that might be in the way before renaming. */ int -replace(const char *old, const char *new) +replace(const char *oldname, const char *newname) { - if (remove(new) < 0) - warn("can't remove \"%s\"", new); - return (rename(old, new)); + if (remove(newname) < 0 && errno != ENOENT) + warn("can't remove \"%s\"", newname); + return (rename(oldname, newname)); } FILE * @@ -53,9 +53,13 @@ } /* - * Windows has _snprintf() but it does not work like real snprintf(). + * This is more long-winded than seems necessary because MinGW + * doesn't have a proper implementation of _vsnprintf_s(). + * + * This link has some useful info about snprintf() on Windows: + * http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */ -int snprintf(char *buf, size_t buflen, const char *format, ...) +int c99_snprintf(char *buf, size_t buflen, const char *format, ...) { va_list ap; int outlen, cpylen, tmplen; @@ -73,7 +77,7 @@ /* Paranoia about off-by-one errors in _snprintf() */ tmplen = outlen + 2; - tmp = malloc(tmplen); + tmp = (char *)malloc(tmplen); if (tmp == NULL) err(2, "malloc"); va_start(ap, format);