Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/tradcpp/dist Import tradcpp 0.5.3
details: https://anonhg.NetBSD.org/src/rev/fff627aa275b
branches: trunk
changeset: 369680:fff627aa275b
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Aug 27 21:46:47 2022 +0000
description:
Import tradcpp 0.5.3
diffstat:
external/bsd/tradcpp/dist/.hg_archival.txt | 4 +
external/bsd/tradcpp/dist/.hgtags | 9 +
external/bsd/tradcpp/dist/CHANGES | 91 +
external/bsd/tradcpp/dist/Makefile | 11 +
external/bsd/tradcpp/dist/TODO | 37 +
external/bsd/tradcpp/dist/array.c | 115 ++
external/bsd/tradcpp/dist/array.h | 279 +++++
external/bsd/tradcpp/dist/bool.h | 41 +
external/bsd/tradcpp/dist/config.h | 174 +++
external/bsd/tradcpp/dist/directive.c | 733 +++++++++++++
external/bsd/tradcpp/dist/directive.h | 49 +
external/bsd/tradcpp/dist/eval.c | 767 ++++++++++++++
external/bsd/tradcpp/dist/eval.h | 32 +
external/bsd/tradcpp/dist/files.c | 441 ++++++++
external/bsd/tradcpp/dist/files.h | 40 +
external/bsd/tradcpp/dist/inlinedefs.h | 39 +
external/bsd/tradcpp/dist/macro.c | 1313 +++++++++++++++++++++++++
external/bsd/tradcpp/dist/macro.h | 51 +
external/bsd/tradcpp/dist/main.c | 1113 +++++++++++++++++++++
external/bsd/tradcpp/dist/mode.h | 66 +
external/bsd/tradcpp/dist/output.c | 203 +++
external/bsd/tradcpp/dist/output.h | 31 +
external/bsd/tradcpp/dist/place.c | 395 +++++++
external/bsd/tradcpp/dist/place.h | 69 +
external/bsd/tradcpp/dist/tests/Makefile | 45 +
external/bsd/tradcpp/dist/tests/subdir/test.h | 1 +
external/bsd/tradcpp/dist/tests/t01.c | 1 +
external/bsd/tradcpp/dist/tests/t01.good | 1 +
external/bsd/tradcpp/dist/tests/t02.c | 2 +
external/bsd/tradcpp/dist/tests/t02.good | 1 +
external/bsd/tradcpp/dist/tests/t03.c | 2 +
external/bsd/tradcpp/dist/tests/t03.good | 1 +
external/bsd/tradcpp/dist/tests/t04.c | 2 +
external/bsd/tradcpp/dist/tests/t04.good | 1 +
external/bsd/tradcpp/dist/tests/t05.c | 2 +
external/bsd/tradcpp/dist/tests/t05.good | 1 +
external/bsd/tradcpp/dist/tests/t06.c | 2 +
external/bsd/tradcpp/dist/tests/t06.good | 1 +
external/bsd/tradcpp/dist/tests/t07.c | 3 +
external/bsd/tradcpp/dist/tests/t07.good | 1 +
external/bsd/tradcpp/dist/tests/t08.c | 41 +
external/bsd/tradcpp/dist/tests/t08.good | 21 +
external/bsd/tradcpp/dist/tests/t09.c | 6 +
external/bsd/tradcpp/dist/tests/t10.c | 3 +
external/bsd/tradcpp/dist/tests/t10.good | 2 +
external/bsd/tradcpp/dist/tests/t11.c | 2 +
external/bsd/tradcpp/dist/tests/t11.good | 1 +
external/bsd/tradcpp/dist/tests/t12.c | 2 +
external/bsd/tradcpp/dist/tests/t12.good | 1 +
external/bsd/tradcpp/dist/tests/t13.c | 4 +
external/bsd/tradcpp/dist/tests/t13.good | 2 +
external/bsd/tradcpp/dist/tests/t14.c | 4 +
external/bsd/tradcpp/dist/tests/t14.good | 3 +
external/bsd/tradcpp/dist/tests/t15.c | 3 +
external/bsd/tradcpp/dist/tests/t15.good | 2 +
external/bsd/tradcpp/dist/tests/t16.c | 11 +
external/bsd/tradcpp/dist/tests/t16.good | 11 +
external/bsd/tradcpp/dist/tests/t17.c | 2 +
external/bsd/tradcpp/dist/tests/t17.good | 1 +
external/bsd/tradcpp/dist/tests/t18.c | 2 +
external/bsd/tradcpp/dist/tests/t19.c | 3 +
external/bsd/tradcpp/dist/tests/t19.good | 1 +
external/bsd/tradcpp/dist/tests/t20.c | 1 +
external/bsd/tradcpp/dist/tests/t21.c | 3 +
external/bsd/tradcpp/dist/tests/t21.good | 2 +
external/bsd/tradcpp/dist/tests/t22.c | 2 +
external/bsd/tradcpp/dist/tests/t22.good | 1 +
external/bsd/tradcpp/dist/tests/t23.c | 8 +
external/bsd/tradcpp/dist/tests/t23.good | 4 +
external/bsd/tradcpp/dist/tests/t24.c | 67 +
external/bsd/tradcpp/dist/tests/t24.good | 5 +
external/bsd/tradcpp/dist/tests/t25.c | 4 +
external/bsd/tradcpp/dist/tests/t25.good | 1 +
external/bsd/tradcpp/dist/tests/t26.c | 4 +
external/bsd/tradcpp/dist/tests/t26.good | 3 +
external/bsd/tradcpp/dist/tests/t27.c | 29 +
external/bsd/tradcpp/dist/tests/t27.good | 24 +
external/bsd/tradcpp/dist/tests/t28.c | 53 +
external/bsd/tradcpp/dist/tests/t28.good | 2 +
external/bsd/tradcpp/dist/tests/t29.c | 4 +
external/bsd/tradcpp/dist/tests/t30.c | 2 +
external/bsd/tradcpp/dist/tests/t30.good | 1 +
external/bsd/tradcpp/dist/tests/t31.c | 6 +
external/bsd/tradcpp/dist/tests/t31.good | 3 +
external/bsd/tradcpp/dist/tests/t32.c | 21 +
external/bsd/tradcpp/dist/tests/t32.good | 12 +
external/bsd/tradcpp/dist/tests/t33.c | 6 +
external/bsd/tradcpp/dist/tests/t33.good | 3 +
external/bsd/tradcpp/dist/tests/t34.c | 5 +
external/bsd/tradcpp/dist/tests/t34.good | 1 +
external/bsd/tradcpp/dist/tests/t35.c | 6 +
external/bsd/tradcpp/dist/tests/t35.good | 1 +
external/bsd/tradcpp/dist/tests/t36.c | 7 +
external/bsd/tradcpp/dist/tests/t36.good | 4 +
external/bsd/tradcpp/dist/tests/t37.c | 19 +
external/bsd/tradcpp/dist/tests/t37.good | 9 +
external/bsd/tradcpp/dist/tests/t38.c | 11 +
external/bsd/tradcpp/dist/tests/t38.good | 8 +
external/bsd/tradcpp/dist/tests/t39.c | 21 +
external/bsd/tradcpp/dist/tests/t39.good | 11 +
external/bsd/tradcpp/dist/tests/t40.c | 6 +
external/bsd/tradcpp/dist/tests/t40.good | 1 +
external/bsd/tradcpp/dist/tests/tradcpp.sh | 36 +
external/bsd/tradcpp/dist/tradcpp.1 | 361 ++++++
external/bsd/tradcpp/dist/union.h | 36 +
external/bsd/tradcpp/dist/utils.c | 246 ++++
external/bsd/tradcpp/dist/utils.h | 78 +
external/bsd/tradcpp/dist/version.h | 33 +
108 files changed, 7469 insertions(+), 0 deletions(-)
diffs (truncated from 7901 to 300 lines):
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/.hg_archival.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/.hg_archival.txt Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,4 @@
+repo: 67fa1db0651cd970068d0660e1b695e30b04f904
+node: 9aa91d3fe3a39cb8af08f231ba22a3aa1bbd57eb
+branch: default
+tag: release-0.5.3
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/.hgtags
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/.hgtags Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,9 @@
+8a955e3dda2ce67fd729944f4e19316d005c0731 posted-20101220
+1e4eef5bf88d70a98396b175cd0891a41d79388e release-0.1
+3ad1cd80f5a07b0ce19131f3e58f2560e4a30d9d release-0.2
+31fc4251ec3bd624af9d00592b7a9ec9d22a611a release-0.3
+85b66cc0344e6222c92b8dd324542ec6f64239e9 release-0.3.1
+281317d304782fe3d60f4786a1480fe5ce485ebd release-0.4
+557824449ec7df3d63b491efbf53c9b73589346d release-0.5
+ab06d46bf5cc46cdacba18d82a6b380bfe09d81e release-0.5.1
+18b872f362175fd78ddf1f12ee24f85ef19b6254 release-0.5.2
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/CHANGES
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/CHANGES Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,91 @@
+release 0.5.3 (20190121)
+ - Fix markup typo in the man page.
+ - Abort on line numbering or column numbering overflow. Line
+ numbers are limited to values that fit in "unsigned int". Also
+ reject input lines longer than 2^32-1 characters. It seems
+ reasonable to presume that any input that violates these
+ constraints is someone screwing around and not a serious attempt
+ to compile or preprocess anything useful. Done in response to
+ n2129, but without getting into any of the silliness found there.
+ - Recognize __ia64__ for IA64 builds.
+ - Recognize __aarch64__ for 64-bit ARM builds, as sent in by
+ various people.
+ - Recognize __riscv__ and __riscv64__ for risc-v builds.
+
+release 0.5.2 (20160904)
+ - Fix typo in -U usage message, noticed by Joerg.
+ - Add a -debuglog option to send an execution trace to a file.
+ Intended to be used when debugging imake templates and other
+ complex input, not for debugging tradcpp itself.
+
+release 0.5.1 (20150612)
+ - Fix a stupid regression in 0.5 that causes it to not recognize a
+ pile of options.
+ - Fix output corruption caused by mishandling which macros are
+ currently in use. In particular, "curmacro" is only valid while
+ we're parsing a macro name and arguments, and can change once we
+ start expanding, so don't use it to clear the in-use flag. This
+ problem has been around all along but was only just exposed.
+ - Also don't set curmacro to null after calling expand_domacro as
+ that can cause us to think a macro name we just read is defined().
+ This one was introduced in 0.5.
+ - Don't use "remove" as a local variable as gcc 4.1 gets upset
+ about it vs. remove(3) in stdio.h.
+
+release 0.5 (20150612)
+ - Don't report unclosed comments as "No newline at end of file".
+ - Don't rely on <stdbool.h> existing, as (predictably) it doesn't
+ work on Solaris.
+ - Similarly, don't rely on C11 anonymous unions as the Solaris
+ compiler vomits on them.
+ - Typo fix in man page from Jason McIntyre; and change "Usage" to
+ "usage" in usage for pedantic reasons, from Igor Sobrado.
+ - Accept "-" as either input or output file name to mean stdin or
+ stdout respectively. Suggested by Jonathan Gray.
+ - Fix output spacing behavior to match gcc when newlines appear in or
+ while looking for macro arguments. Partly from Joerg Sonnenberger.
+ - Implement __FILE__ and __LINE__ macros. Mostly from Joerg Sonnenberger.
+ - Implement #line. Partly from Joerg Sonnenberger.
+ - Declare usage() with PF(). From wiz.
+
+release 0.4 (20130713)
+ - Fix stupid build problem introduced in 0.3.1.
+ - Accept and ignore -m32, which imake issues willy-nilly on a bunch
+ of platforms. I thought this had already been done, but apparently
+ not.
+ - Don't use the <err.h> functions. There are still people out there
+ using legacy systems missing them.
+ - Sort out some more issues pertaining to handling quoted strings.
+ - Add some more tests.
+
+release 0.3.1 (20130709)
+ - Don't leak memory and assert if a bad command-line option comes
+ after a -D or a -include foo.
+ - Since imake is a principal application for tradcpp and imake carefully
+ hides what it's doing when you run it, when rejecting an invalid option
+ be sure to report *what* that option is.
+
+release 0.3 (20130616)
+ - Don't eval the control expression of the first #if of a block when
+ already in a false block; it might not be valid. Reported by
+ Baptiste Daroussin.
+ - Don't recognize comments within character constants.
+ - Don't recognize macro argument parentheses or commas within strings,
+ or within character constants either.
+
+release 0.2 (20130611)
+ - auto-recognize more builtin PowerPC and mips macros
+ - pass -Wunused (partly from Baptiste Daroussin)
+ - allow absolute paths in include files (partly from Baptiste Daroussin)
+ - don't use getprogname() in the name of portability
+ - add tests arising from December 2010 tech-toolchain thread (one
+ from der Mouse, one of mine)
+ - clean out usage of sys/cdefs.h macros and don't use the implementation
+ namespace
+ - make -Wcomment work again
+ - fix handling of relative includes
+ - provide a man page
+ - other minor improvements
+
+release 0.1 (20130610)
+ - first release, works with at least some imake templates
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/Makefile Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1.1.1 2022/08/27 21:46:47 dholland Exp $
+
+PROG= tradcpp
+SRCS= main.c \
+ files.c directive.c eval.c macro.c output.c \
+ place.c array.c utils.c
+WARNS= 5
+
+#DBG=-g
+
+.include <bsd.prog.mk>
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/TODO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/TODO Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,37 @@
+not implemented:
+ - mode.input_allow_dollars.
+ - column counts do not take tabstops into account.
+ - mode.output_linenumbers.
+ - mode.do_depend.
+ - mode.do_macrolist.
+ - mode.do_trace.
+ - warns.endiflabels. (they cause errors)
+ - warns.unused.
+ - the -iremap option.
+ - $CPP_RESTRICTED
+ - other environment variables
+
+tidy up:
+ - get rid of inlinedefs.h
+ - use of places in and below macro.c is pretty bogus.
+ - macro code should be reworked.
+ - place_changefile is manky and wastes memory. Also, in an ideal
+ world we'd remember the place #line changed the name and refer
+ to it when printing errors.
+
+fix:
+ - "#if 0 && 1/0" should not crash; fix eval method.
+ - quote characters and comment delimiters that are emitted by
+ macros are not recognized. See:
+ t34 (should produce a quote and FOO Q)
+ t35 (similarly, this test may be redundant once it's fixed)
+ t36 (C(3) should produce nothing)
+ t37 (BC foo EC should produce nothing)
+ Joerg says comments like in t36 should be stripped exactly
+ twice, once when the macro is defined and again when it's
+ expanded. Note that gcc's cpp -traditional is getting t37
+ wrong, and it gets t36 wrong with -C.
+ - remove the intentionally undocumented -p option and generate
+ proper linenumber output. (also, in this code what happens if
+ a comment spans files? I bet currently it will emit the line
+ number into the comment.)
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/array.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/array.c Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,115 @@
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#define ARRAYINLINE
+#include "array.h"
+
+struct array *
+array_create(void)
+{
+ struct array *a;
+
+ a = domalloc(sizeof(*a));
+ array_init(a);
+ return a;
+}
+
+void
+array_destroy(struct array *a)
+{
+ array_cleanup(a);
+ dofree(a, sizeof(*a));
+}
+
+void
+array_init(struct array *a)
+{
+ a->num = a->max = 0;
+ a->v = NULL;
+}
+
+void
+array_cleanup(struct array *a)
+{
+ arrayassert(a->num == 0);
+ dofree(a->v, a->max * sizeof(a->v[0]));
+#ifdef ARRAYS_CHECKED
+ a->v = NULL;
+#endif
+}
+
+void
+array_setsize(struct array *a, unsigned num)
+{
+ unsigned newmax;
+ void **newptr;
+
+ if (num > a->max) {
+ newmax = a->max;
+ while (num > newmax) {
+ newmax = newmax ? newmax*2 : 4;
+ }
+ newptr = dorealloc(a->v, a->max * sizeof(a->v[0]),
+ newmax * sizeof(a->v[0]));
+ a->v = newptr;
+ a->max = newmax;
+ }
+ a->num = num;
+}
+
+void
+array_insert(struct array *a, unsigned index_)
+{
+ unsigned movers;
+
+ arrayassert(a->num <= a->max);
+ arrayassert(index_ < a->num);
+
+ movers = a->num - index_;
+
+ array_setsize(a, a->num + 1);
+
+ memmove(a->v + index_+1, a->v + index_, movers*sizeof(*a->v));
+}
+
+void
+array_remove(struct array *a, unsigned index_)
+{
+ unsigned movers;
+
+ arrayassert(a->num <= a->max);
+ arrayassert(index_ < a->num);
+
+ movers = a->num - (index_ + 1);
+ memmove(a->v + index_, a->v + index_+1, movers*sizeof(*a->v));
+ a->num--;
+}
diff -r 2c0179d8de11 -r fff627aa275b external/bsd/tradcpp/dist/array.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tradcpp/dist/array.h Sat Aug 27 21:46:47 2022 +0000
@@ -0,0 +1,279 @@
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
Home |
Main Index |
Thread Index |
Old Index