]> git.draconx.ca Git - cdecl99.git/log
cdecl99.git
2 weeks agoRelease 1.3. master v1.3
Nick Bowler [Fri, 5 Apr 2024 04:09:27 +0000 (00:09 -0400)]
Release 1.3.

2 weeks agolibcdecl: Mark pthread_once as weak when needed.
Nick Bowler [Fri, 5 Apr 2024 04:01:49 +0000 (00:01 -0400)]
libcdecl: Mark pthread_once as weak when needed.

When the "lock" module was removed we forgot to add pthread_once to
the list of pthreads symbols marked weak, leading to build failures
on systems which don't provide this symbol in libc.

2 weeks agoBump dxcommon to pull in _Alignas fix for FreeBSD.
Nick Bowler [Thu, 4 Apr 2024 04:35:45 +0000 (00:35 -0400)]
Bump dxcommon to pull in _Alignas fix for FreeBSD.

2 weeks agotests: Remove stray semicolons from errthread test.
Nick Bowler [Thu, 4 Apr 2024 01:11:11 +0000 (21:11 -0400)]
tests: Remove stray semicolons from errthread test.

At toplevel (outside of any C function) it is not valid to have
extra semicolons, even though most compilers don't actually care.

2 weeks agoRemove dist-xz Automake option.
Nick Bowler [Wed, 3 Apr 2024 01:21:01 +0000 (21:21 -0400)]
Remove dist-xz Automake option.

There is very little point in forcing dist-xz in the Automake options,
since it merely changes the formats produced by plain 'make dist'.
This just causes unnecessary failures when running 'make dist' on
systems without an xz program (gzip is much more widely available).

One can still explicitly run 'make dist-xz' when cutting a distribution
if this compression format is desired.

2 weeks agoUpdate NEWS.
Nick Bowler [Wed, 3 Apr 2024 01:09:27 +0000 (21:09 -0400)]
Update NEWS.

We've accumulated a bunch of improvements and now is probably a
good point to start preparing a new release.

7 weeks agoBetter probe for __int64 support.
Nick Bowler [Thu, 29 Feb 2024 03:52:00 +0000 (22:52 -0500)]
Better probe for __int64 support.

In an expression like sizeof (unsigned garbage), the VAX C compiler
warns but otherwise ignores the garbage identifier, treating it the
same as sizeof (unsigned).  Thus, the AC_CHECK_TYPES probe gives a
false positive result on this compiler.

The test can be improved by using the fourth argument to add a real
object declaration to the test program.

8 weeks agotests: Use 32-bit arithmetic for seed expansion.
Nick Bowler [Fri, 23 Feb 2024 03:26:01 +0000 (22:26 -0500)]
tests: Use 32-bit arithmetic for seed expansion.

To facilitate a future port to older C implementations, replace
splitmix64 in the seed expansion with a very similar algorithm
based purely on 32-bit arithmetic.

This changes the generated random sequences for a particular seed
but means there is no need to implement a 64-bit multiplier for
such a trivial purpose.

8 weeks agolibcdecl: Avoid overalignment of string tables.
Nick Bowler [Fri, 23 Feb 2024 01:41:23 +0000 (20:41 -0500)]
libcdecl: Avoid overalignment of string tables.

For whatever reason, on x86_64 gcc allocates any static array at least
32 bytes in size with 32 byte alignment.  In the case of things like
constant string tables, this ends up wasting a bunch of space for no
obvious reason.

Adding suitable _Alignas directives works to prevent overalignment.

8 weeks agolibcdecl: Merge some output strings.
Nick Bowler [Thu, 22 Feb 2024 04:14:33 +0000 (23:14 -0500)]
libcdecl: Merge some output strings.

A couple of conditional parts of the English output can be merged into a
single print with a single string which is offset by some amount.  This
gives a modest size reduction.

8 weeks agolibcdecl: Use an explicit name for T_LEX_ERROR.
Nick Bowler [Thu, 22 Feb 2024 03:31:01 +0000 (22:31 -0500)]
libcdecl: Use an explicit name for T_LEX_ERROR.

The name of this token doesn't have to be anything in particular,
just something that won't appear in a real error message.  So we
can use a short string to reduce the string table size.

8 weeks agolibcdecl: Use gperf %7bit option for keyword matching.
Nick Bowler [Thu, 22 Feb 2024 02:38:26 +0000 (21:38 -0500)]
libcdecl: Use gperf %7bit option for keyword matching.

The scanner ensures all input to the keyword matching function consists
exclusively of alphanumeric characters, hyphens and underscores.

Since gperf supports only ISO-646 variants it should be safe to enable
7bit mode, which reduces the size of its generated tables substantially.

8 weeks agolibcdecl: Remove glibc snprintf workaround.
Nick Bowler [Thu, 22 Feb 2024 02:30:23 +0000 (21:30 -0500)]
libcdecl: Remove glibc snprintf workaround.

Since we don't use snprintf in the library anymore, we can remove
the glibc bug workaround when calling cdecl__strlcpy in the parser
error handler.

8 weeks agolibcdecl: Avoid asserts in output declarator traversal.
Nick Bowler [Wed, 21 Feb 2024 07:02:57 +0000 (02:02 -0500)]
libcdecl: Avoid asserts in output declarator traversal.

There is not a strong reason for an assert here.  With the assertion
removed, the consequence of an unexpected declarator type is that
nothing will be output for that declarator.  This is an acceptable
behaviour in and of itself, so let's just go with that.

8 weeks agolibcdecl: Further optimize symbol name lookup.
Nick Bowler [Wed, 21 Feb 2024 03:36:08 +0000 (22:36 -0500)]
libcdecl: Further optimize symbol name lookup.

We can combine the mapping and string tables into a single static
allocation, which allows everything to be offset from a single
base address which is slightly more efficient.

Since we are not fitting these offsets in 8 bits, and are nowhere
near exceeding 16 bits, just use uint_least16_t for the mapping table
unconditionally instead of trying to come up with a new preprocessor
conditional string that works with the new calculation.

2 months agoFix incremental rebuild after deleted scan.c.
Nick Bowler [Wed, 31 Jan 2024 04:20:13 +0000 (23:20 -0500)]
Fix incremental rebuild after deleted scan.c.

It is important that the .stamp.c rule is checked first, before the
.l.c or .y.c rules (which do nothing) in order to trigger a rebuild
if scan.c or parse.c are inadvertently deleted.

Make considers suffix rules in the same order as the .SUFFIXES list.
Presently, this list is generated by Automake so we are at the mercy of
whatever order they happen to be in, which is perl sort order.  As far
as I can see it has always been this way, so the rebuild for scan.c has
probably never worked (but parse.c is OK, since .y sorts later).

Automake puts user-specified SUFFIXES first, so adding .stamp there
should suffice to resolve the problem.

2 months agolibcdecl: Fix TLS cleanup on Windows.
Nick Bowler [Sat, 27 Jan 2024 04:50:19 +0000 (23:50 -0500)]
libcdecl: Fix TLS cleanup on Windows.

The DllMain entry point is pretty much designed for this purpose and
works in all versions of Windows that support threads.  This is the
technique used by pthreads-win32.  But it only works for DLLs.

For static linking into executables, there is a special table of
function pointers that are called by the runtime in pretty much the
same situations as DllMain.  This apparently works starting around
Windows XP timeframe, and is the technique used by libwinpthread.

We combine both techniques so at least the DLL cleanup works even
on very old versions of Windows.  The static library cleanup will
work on contemporary versions.

To test this, we need to restructure the thread test program to link
against a real (uninstalled) DLL with the test entry points.

2 months agolibcdecl: Try unsigned __int64 for a 64-bit type.
Nick Bowler [Sat, 27 Jan 2024 03:59:21 +0000 (22:59 -0500)]
libcdecl: Try unsigned __int64 for a 64-bit type.

Windows compilers provide __int64 which may be available even if
long long is not.  While we don't yet build out of the box on
these compilers, let's try to avoid having the library ABI degrade
to 32-bit unsigned long when the build failures are fixed.

2 months agoAdd AM_PROG_AR to configure.ac.
Nick Bowler [Sat, 27 Jan 2024 03:56:01 +0000 (22:56 -0500)]
Add AM_PROG_AR to configure.ac.

Without this, Automake fails to build static libraries with the
Microsoft compiler tools.

2 months agoBump dxcommon for testsuite line ending workaround.
Nick Bowler [Sat, 27 Jan 2024 03:46:12 +0000 (22:46 -0500)]
Bump dxcommon for testsuite line ending workaround.

When running the testsuite against compiled Windows executables,
we need to deal with test output that may have either DOS or UNIX
line endings.

2 months agotests: Avoid backslashes in awk variable assignment.
Nick Bowler [Sat, 27 Jan 2024 02:40:11 +0000 (21:40 -0500)]
tests: Avoid backslashes in awk variable assignment.

Backslashes in awk command-line variable assignments are normally
interpreted as beginning escape sequences, which is not what we
want to do for the error message prefix test.

Just exchanging backslashes with some other character (let's pick
forward slashes) should be more than sufficient for this test, to
ensure that the program name prefixes error messages.

2 months agotests: Don't use #n in sed scripts.
Nick Bowler [Sat, 27 Jan 2024 02:00:15 +0000 (21:00 -0500)]
tests: Don't use #n in sed scripts.

For whatever reason at least some versions of the MinGW/MSYS port of GNU
sed doesn't seem to handle scripts staring with #n.  No big deal, we can
just use the -n option explicitly instead.

2 months agotests: Limit automatic random seed to 8 digits.
Nick Bowler [Sat, 27 Jan 2024 01:52:25 +0000 (20:52 -0500)]
tests: Limit automatic random seed to 8 digits.

In the event that the test_strtoumax can only convert 32-bit types for
whatever reason, attempting to pass values >= 2**32 spits an error.

We don't need this kind of excess range for the automatic random seed.
Just truncate it to 8 digits which will always fit in 32 bits.

2 months agolibcdecl: Use a different pthread_once workalike for Windows.
Nick Bowler [Thu, 25 Jan 2024 04:19:16 +0000 (23:19 -0500)]
libcdecl: Use a different pthread_once workalike for Windows.

Replace the windows-once implementation from gnulib with a different
one adapted from the pthreads-win32 library.  This version uses less
static data and does not allocate any Windows resources in the normal
(uncontended) case.

2 months agolibcdecl: Punt gnulib lock module.
Nick Bowler [Wed, 24 Jan 2024 06:19:59 +0000 (01:19 -0500)]
libcdecl: Punt gnulib lock module.

This module is total overkill for what we need, which is to provide
one-time library initialization.  Except for the pthread_in_use
detection, this module does not appear to work around any particular
portability problem with POSIX pthread_once or standard C call_once.

On the other hand, on GNU/Linux the unused code this module links in
represents almost 5% of the size of the entire library (which includes
eight pointless PLT entries).

We have to make a local copy of the pthread_in_use macro definition,
as it is no longer imported into the project.  Further improvements
may be possible to specialize this test for our use case, but for
now stick with the Gnulib version which is known to work on a lot
of different systems.

2 months agolibcdecl: Punt gnulib tls module.
Nick Bowler [Tue, 23 Jan 2024 06:40:24 +0000 (01:40 -0500)]
libcdecl: Punt gnulib tls module.

It seems like the gnulib tls module doesn't actually help much.  Drop
it, and implement suitable shims directly in the error handling code.

It does not look like gnulib performs any feature tests regarding the
TLS functionality: it simply goes and uses the appropriate functions
for the selected API (posix, isoc, windows or none).

With the exception of destructor callbacks, all of these TLS APIs are
essentially identical.

Changing this doesn't fix the problem with TLS destructors on Windows
but it does delete almost 2 kilobytes of disfunctional gnulib code
that purports to implement TLS destructors without actually doing so.

2 months agolibcdecl: Actually test threading support.
Nick Bowler [Tue, 23 Jan 2024 02:02:04 +0000 (21:02 -0500)]
libcdecl: Actually test threading support.

Nothing actually runs libcdecl's error messaging in multiple threads to
check if it actually works.  Let's fix that with a new test application.

It does mostly work, but it turns out that we leak memory on Windows
because gnulib doesn't actually implement TLS destructors in a useful
way (on the other hand, using --enable-threads=posix should work even
on Windows with a suitable Windows pthreads library implementation).

3 months agoDon't run configure tests for threading if disabled.
Nick Bowler [Fri, 19 Jan 2024 05:14:02 +0000 (00:14 -0500)]
Don't run configure tests for threading if disabled.

If the user passes --disable-threads, we shouldn't run all the
configure tests to probe threading system characteristics.

Like with the conditional NLS bits, we create a local "dx-threadlib"
module which uses conditional dependencies to pull in the actual
threading modules.

We additionally have to monkey patch gl_MBRTOWC which hoists the
threading library probes out of the conditional, not so great
(we have disabled the multithread support in gnulib's mbrtowc
replacement anyway) -- this can be done in the new module too.

3 months agocdecl99: Avoid gnulib setlocale_null bits.
Nick Bowler [Fri, 19 Jan 2024 03:58:48 +0000 (22:58 -0500)]
cdecl99: Avoid gnulib setlocale_null bits.

As this is a single-threaded application which does nothing exciting
regarding locales, we shouldn't need the setlocale_null replacement.
This performs a pile of configure tests related to the thread safety
of setlocale(x, NULL), which includes possibly pulling in threading
libraries and a bunch of other nonsense.

To do this, we replace hard-locale (the only module using this) with
an inline function using setlocale directly (inline is much better,
because there is only one call site).

3 months agolibcdecl: Replace uintmax_t with unsigned (long) long.
Nick Bowler [Thu, 18 Jan 2024 05:17:06 +0000 (00:17 -0500)]
libcdecl: Replace uintmax_t with unsigned (long) long.

Using uintmax_t in a public header file is problematic.  The most
obvious problem is that we need to include either <inttypes.h> or
<stdint.h> to get it, and the current unconditional inclusion of
<stdint.h> breaks on e.g., HP-UX 11 which only has <inttypes.h>

The less obvious problem is that uintmax_t can depend on compiler
configuration, e.g., the Sun compiler for a 32-bit host provides a
32-bit uintmax_t in C89 mode.

Instead, just change it to "unsigned long long" if supported, otherwise
"unsigned long".  It is very likely to be binary compatible with prior
releases, since as far as I am aware prior releases don't actually build
on any implementation where it would not be the case.

3 months agotests: Work around awk line length limitations.
Nick Bowler [Tue, 16 Jan 2024 03:39:56 +0000 (22:39 -0500)]
tests: Work around awk line length limitations.

Some versions of awk (e.g., HP-UX 11) struggle with long lines, which is
a problem for the script which checks the excessive function parameter
output.

To fix this, let's try using tr, which should hopefully not care too
much about line length, to produce short lines that can be checked.

3 months agotests: Avoid shell limitations in huge input tests.
Nick Bowler [Tue, 16 Jan 2024 00:52:04 +0000 (19:52 -0500)]
tests: Avoid shell limitations in huge input tests.

It seems that the very large here-documents used in the excessive
specifier/declarator tests can be problematic on some ksh versions.

Normal compression tools handle this data very well, so instead of
using the shell to generate it it should be just fine to just use
gunzip to do this and skip the tests if that cannot be done for
whatever reason.

3 months agolibcdecl: Silence GCC -Wunused-function warnings in the scanner.
Nick Bowler [Mon, 15 Jan 2024 04:28:01 +0000 (23:28 -0500)]
libcdecl: Silence GCC -Wunused-function warnings in the scanner.

Use the GCC unused attribute to avoid warnings in the scanner, and use
the flex yyIN_HEADER macro so the static declarations don't leak out to
other files (where GCC will give warnings about missing definitions).

While we do this, fix a typo and remove an unneeded declaration which
were both caught by this warning.

3 months agolibcdecl: Fix spacing after pointer qualifiers (again).
Nick Bowler [Sun, 14 Jan 2024 05:42:20 +0000 (00:42 -0500)]
libcdecl: Fix spacing after pointer qualifiers (again).

Some renderings of pointer qualifiers have an unwanted trailing space,
for example:

  > type const pointer to array of int
  int (* const )[]

This exact bug was fixed before, more than 10 years ago, but as no test
case was added it took some time to notice the problem when the fix was
inadvertently deleted.  This time, we fix it again, and also add some
test cases to verify the output.

3 months agotests: Fix overquoting of SIMPLE_DECLS group names.
Nick Bowler [Sat, 13 Jan 2024 08:09:48 +0000 (03:09 -0500)]
tests: Fix overquoting of SIMPLE_DECLS group names.

The m4_car macro expands to a quoted string, so we need to use it
unquoted in order to maintain a consistent amount of m4 quoting
for the arguments expanded in both the test group name and in the
test data.

A bunch of group names had extra brackets which are now gone.  Adjust
all the test cases to consistently use extra quotes rather than
quadrigraphs for array syntax.

3 months agocdecl99: Simplify main command output.
Nick Bowler [Fri, 12 Jan 2024 05:27:09 +0000 (00:27 -0500)]
cdecl99: Simplify main command output.

When the separate command functions were merged everything was combined
into one relatively complex printf call.  Profiling on GNU/Linux showed
a surprising amount of time spent printing.

Restructure the code to just print the two cases separately.  The result
is easier to understand, compiles to less code, and is slightly faster,
so what's not to like?

3 months agolibcdecl: Fix parsing of int (x(*)()) etc.
Nick Bowler [Fri, 12 Jan 2024 03:50:20 +0000 (22:50 -0500)]
libcdecl: Fix parsing of int (x(*)()) etc.

An incomplete earlier fix for misparsing "int (x*)" didn't correct the
issue for more complex abstract declarators like (*)() or (*)[1][2][3].
The function simplification step is erroneously applied even though
there is no valid parse of "int (x(*)[])" in which x is an identifier
declarator.

In the prior release 1.2, int (x(*)) happens to be parsed correctly but
int (x(*)[]) produces a bogus result.  Since the release, the behaviour
was changed to spit out a syntax error for both, so there is a bit of
regression here.

The randomdecl test rarely generates these so the problem can show up
intermittently.  Add some more conditions so we don't try to simplify
these declarations, and new dedicated test cases to check these.

3 months agolibcdecl: Fix parsing of very long parameter lists.
Nick Bowler [Thu, 11 Jan 2024 04:08:14 +0000 (23:08 -0500)]
libcdecl: Fix parsing of very long parameter lists.

The way the parameter parser rules are currently arranged requires
shifting every parameter symbol before any part of the parameter
list is reduced.  Thus, functions with a lot of parameters (about
5000 or more) can lead to a parse error since the symbol stack is
exhausted (even if there would otherwise be enough memory to
allocate this many parameter items).

Technically this kind of failure is permitted by the C language, as
implementations do not need to support functions with more than 127
parameters.  However, it is better to avoid arbitrary limits like
this and it is not a big problem to do so.

Collecting the parameters in reverse order allows the list elements
to be reduced as they are encountered, which avoids excessive use
of the symbol stack.  The final list has to then be reversed again
prior to returning from the parser.  This is actually how the prior
release 1.2 worked so this is technically a regression fix.

Expand some test cases to cover this behaviour.  We actually don't
have any tests targeting the parameter ordering (although randomdecl
and crossparse quickly catches it) so add some of those too.

3 months agolibcdecl: Fix parsing of very long declarator lists.
Nick Bowler [Thu, 11 Jan 2024 03:28:01 +0000 (22:28 -0500)]
libcdecl: Fix parsing of very long declarator lists.

The way the toplevel declaration parser is currently arranged requires
shifting every declarator symbol before any part of the full declarator
list is reduced.  Thus, very long declarations (with about 5000 or more
full declarators) can lead to a parse error since the symbol stack is
exhausted (even if there would otherwise be enough memory to allocate
this many declarator items).

Technically this kind of failure is permitted by the C language, as
implementations are not required to support declarations of this size.
However, it is better to avoid arbitrary limits like this and it is not
a big problem to do so.

Simply collecting the declarators in reverse order allows for the list
elements to be reduced as they are encountered, which avoids excessive
use of the symbol stack.  However in this case the order matters, so
the final list must be reversed before it is returned from the parser.

Add a new test case to cover this behaviour.

3 months agolibcdecl: Fix parsing of very long specifier lists.
Nick Bowler [Thu, 11 Jan 2024 01:09:46 +0000 (20:09 -0500)]
libcdecl: Fix parsing of very long specifier lists.

Most of the current parser rules that deal with specifiers are arranged
such that all the relevant specifier symbols are shifted before any part
of the specifier list is reduced.  Thus, very long specifier lists (with
about 10000 or more specifiers) can lead to a parse error as the symbol
is exhausted (even if there would otherwise be enough memory to allocate
this many specifier items).

Since the C language allows certain specifiers to be repeated any number
of times, there are actually valid declarations with so many specifiers.

Simply collecting the specifiers in reverse order allows for the list
elements to be reduced as they are encountered, which avoids excessive
use of the symbol stack.  The order in which specifiers are parsed
does not matter and we can return these lists in any order.

Add a new test case to cover this behaviour.

3 months agolibcdecl: Move another error message into the string table.
Nick Bowler [Tue, 9 Jan 2024 04:56:39 +0000 (23:56 -0500)]
libcdecl: Move another error message into the string table.

The "array length must be positive" error message seems to have been
missed when all the error messages were combined, so let's move it
in now for a modest size reduction.

3 months agolibcdecl: Remove error code argument from cdecl__err.
Nick Bowler [Tue, 9 Jan 2024 02:21:53 +0000 (21:21 -0500)]
libcdecl: Remove error code argument from cdecl__err.

All callers of this internal function use the same error code
(CDECL__ENOPARSE), so removing this from the internal interface
can save a little bit of code.

Or at least it would except that this simplification makes GCC
decide to inline yyerror in the parser, which has a significantly
worse opposite effect.  It's not so pretty, but let's mark yyerror
"noinline" as a workaround so that deleting this code actually
results in less code...

3 months agolibcdecl: Explicitly declare most scanner functions static.
Nick Bowler [Sun, 7 Jan 2024 16:02:06 +0000 (11:02 -0500)]
libcdecl: Explicitly declare most scanner functions static.

We use barely any of the exported functions generated by flex.  As this
is going into a library the compiler can't eliminate any of these, even
if they are totally unused.

Just marking all unused functions static is sufficient to reduce the
size of the scanner by about 20% without any significant change to the
code.

3 months agolibcdecl: Remove unused YY_INPUT from scanner.
Nick Bowler [Sun, 7 Jan 2024 14:54:31 +0000 (09:54 -0500)]
libcdecl: Remove unused YY_INPUT from scanner.

We only scan strings so the code that uses YY_INPUT is never actually
executed, but it still takes space in the library and creates symbol
references to various file I/O functions that have to be resolved at
runtime.

We can provide a stub YY_INPUT to suppress all of this.

3 months agotests: Improve RNG compatibility with old compilers.
Nick Bowler [Sun, 7 Jan 2024 01:42:03 +0000 (20:42 -0500)]
tests: Improve RNG compatibility with old compilers.

Some C89 compilers with 32-bit longs won't automatically widen integer
constants to (unsigned) long long in order to represent values that
don't fit in an (unsigned) long, even if those compilers otherwise
support 64-bit long long.

The "ll" and "ull" suffixes seem to get things working.

3 months agotests: Remove some unneeded C99 syntax.
Nick Bowler [Sat, 6 Jan 2024 21:59:33 +0000 (16:59 -0500)]
tests: Remove some unneeded C99 syntax.

A couple compound literals, designated initializers, and trailing
commas in enum declarations remain in the test suite.  This is not
needed, we can use C89 syntax easily here.

3 months agoAvoid gnulib getline module.
Nick Bowler [Fri, 5 Jan 2024 05:17:24 +0000 (00:17 -0500)]
Avoid gnulib getline module.

Outside of the test suite, we only use getline in one location.  Instead
of pulling in gnulib's replacement implementation and its dependencies,
adjust the do_getline funciton to directly incorporate a pure standard
C fallback.

Since there is also some getline use in the test suite, rearrange the
code a bit so that we can also include do_getline in the tests.

The gnulib configure tests for getline seem to be complete overkill.
According to the gnulib documentation, the portability problems which
gnulib solves are:

 (a) The function is missing on some platforms.
 (b) On FreeBSD 8, getline crashes if passed a null pointer and a
     nonzero size.
 (c) On AIX 7.1, there is no declaration in <stdio.h>.
 (d) Some unspecified system has an unrelated getline function
     which may erroneously satisfy link tests.

It is unclear to me that gnulib actually solves (c) in a reasonable way.
On AIX 7.2, getline is properly declared in <stdio.h> but gnulib rejects
it anyway and substitutes its own reimplementation as if it didn't exist
at all.  Presumably the exact same thing happens on AIX 7.1.

So I don't see any reason for the annoying runtime tests just to check
if we have issue (d) and linked an irrelevant getline.  Although it's
hard to know for sure since I don't know what system has this problem,
surely it is good enough to just check that getline is properly declared
in <stdio.h> and that we can successfully link against it.  This check
can be implemented with just one single AC_LINK_IFELSE invocation.

I feel that issue (b) is much more sensible to work around in the source
code (by initializing the size to zero), that way we don't need to probe
for it at all or reject this implementation.

Funnily enough there is an unmentioned bug in the AIX 7.2 getline which
is not the reason it gets rejected by gnulib: passing a buffer size of
exactly one byte causes it to return 0 immediately instead of actually
reading input and enlarging the buffer.  Work around that problem too
in the rendertest application (the only place that can hit it).

3 months agotests: Consolidate error messaging a bit.
Nick Bowler [Fri, 5 Jan 2024 04:31:27 +0000 (23:31 -0500)]
tests: Consolidate error messaging a bit.

Use a wrapper function in the test applications to print error messages
similar to the main application.  This function automatically prepends
the program name and automatically appends a newline.

This is in preparation to share some code between the main application
and the test suite.  But it also allows the RNG initialization to print
a properly prefixed error message.

3 months agotests: link cdeclerr test with $(LTLIBINTL)
Nick Bowler [Thu, 4 Jan 2024 03:21:10 +0000 (22:21 -0500)]
tests: link cdeclerr test with $(LTLIBINTL)

Otherwise this test fails to link when NLS is enabled but needs
to be linked against an external libintl.

3 months agotests: Fix gen-typegen.awk on AIX.
Nick Bowler [Wed, 3 Jan 2024 03:13:31 +0000 (22:13 -0500)]
tests: Fix gen-typegen.awk on AIX.

With AIX 7.2 awk, assigning $0 in an END action does not update NF,
leaving it with its prior value from the last record:

  aix72% echo a b c | awk 'END { $0 = "x"; print NF; }'
  3

In the case of gen-typegen.awk, this does not result in any syntax
errors in the generated typegen.h file.  However, the resulting
randomdecl executable fails to produce any declarations with more
than one type specifier in any given specifier list.

Fortunately the randomdecl sanity test caught this problem, because the
_Imaginary and _Complex specifiers were not being generated (as these
are the only type specifiers that never appear by themselves).

Work around the problem by using split instead.

3 months agotests: Fix randomdecl RNG initialization regression.
Nick Bowler [Tue, 2 Jan 2024 04:54:33 +0000 (23:54 -0500)]
tests: Fix randomdecl RNG initialization regression.

Recent changes broke the RNG initialization so that instead of actually
using the user-supplied seed, uninitialized garbage is used instead.

3 months agoBump dxcommon to pull in AIX fixes.
Nick Bowler [Tue, 2 Jan 2024 04:40:30 +0000 (23:40 -0500)]
Bump dxcommon to pull in AIX fixes.

And apply a similar fix to the testsuite to avoid the use of
awk -f -, which does not work on AIX 7.2.

3 months agotests: Avoid dependency on strtoumax.
Nick Bowler [Thu, 28 Dec 2023 06:59:08 +0000 (01:59 -0500)]
tests: Avoid dependency on strtoumax.

Pretty easy to implement string-to-integer conversion in the tests
now that we have some helpers to do so that can be shared with the
main library code.

There is very little advantage to this change in the test programs,
as the reduced-range fallback is pretty much fine here.  However,
as there are no other users, getting rid of this also allows us to
remove the configure probes for strtoumax and its alternatives.

3 months agolibcdecl: Implement portable alternative to strtoumax.
Nick Bowler [Wed, 27 Dec 2023 01:52:01 +0000 (20:52 -0500)]
libcdecl: Implement portable alternative to strtoumax.

It's not really OK for the scanner to use a strtoumax fallback with
limited range, as this means the library can't actually parse its own
output in general.  This causes test failures on systems which don't
have a suitable function in the C library.

Try hard to have a compact implementation, letting the scanner do as
much of the job as possible to reduce the amount of extra checks that
have to happen later.  For the ELF shared library case, the result seems
to be pretty good overall: with GCC, the size savings from the no-longer-
needed PLT entry are similar to the amount of extra code added.

As a bonus, this also avoids any unwanted locale dependency, since the
C standard permits strtoumax et al. to do weird things outside of the
"C" locale, although I'm not sure to what extent any real-world systems
take advantage of that freedom.

3 months agolibcdecl: Fix scanning of hexadecimal constants.
Nick Bowler [Wed, 27 Dec 2023 01:34:20 +0000 (20:34 -0500)]
libcdecl: Fix scanning of hexadecimal constants.

Due to an oversight, hexadecimal constants such as 0X1234 are not
parsed correctly, scanning as two tokens: the integer 0, and the
identifier X1234.

A mistake in the same area also scans plain 0x as two tokens in
the same way, rather than returning a syntax error (although
there should not be any valid parses if such tokens are returned,
so this is a minor issue).

Fix both of these problems, and add a new internal test case
which directly verifies the scanner output for a selection of
integer constants.

3 months agotests: Remove test_print_decl etc. from the common library.
Nick Bowler [Thu, 28 Dec 2023 04:11:05 +0000 (23:11 -0500)]
tests: Remove test_print_decl etc. from the common library.

These functions are only used by one test application, and are now
causing some grief as they force the output routines from libcdecl
to be linked into every test application.

Just move this into the randomdecl application.

3 months agoBump dxcommon to pull in testsuite fixes.
Nick Bowler [Sat, 23 Dec 2023 21:55:11 +0000 (16:55 -0500)]
Bump dxcommon to pull in testsuite fixes.

3 months agolibcdecl: Prefer __inline in public header with GCC.
Nick Bowler [Thu, 21 Dec 2023 16:02:51 +0000 (11:02 -0500)]
libcdecl: Prefer __inline in public header with GCC.

If the library is built using GCC with default options, the configure
tests for inline will determine it is supported, and the installed
headers will use it.

But that doesn't mean the user is running the compiler in the exactly
the same mode when including the headers.  If they then use GCC in
strict C89 mode, "inline" is not recognized as a keyword and compilation
will fail.  We can avoid this problem by just always using __inline on
GCC, with a fallback to the configure-detected result.

4 months agocdecl99: Combine some printing calls.
Nick Bowler [Tue, 19 Dec 2023 13:31:23 +0000 (08:31 -0500)]
cdecl99: Combine some printing calls.

Replace some occurrences of multiple consecutive calls to printing
functions with a single equivalent printf, in cases where doing so
reduces the size of gcc output.

4 months agotests: Avoid use of AT_TESTED.
Nick Bowler [Tue, 19 Dec 2023 13:22:08 +0000 (08:22 -0500)]
tests: Avoid use of AT_TESTED.

This macro doesn't seem to handle systems with non-empty EXEEXT
properly.  All it does is prevent the testsuite from working.
We don't need such gratuitous failures, just log the output of
cdecl99 --version at the start of the test run and move on.

4 months agocdecl99: Optimize print_version a bit.
Nick Bowler [Wed, 13 Dec 2023 03:01:31 +0000 (22:01 -0500)]
cdecl99: Optimize print_version a bit.

Instead of a whole bunch of separate print calls, convert print_version
to a single call to a printing function, with a single string argument.
Compilers do not seem to coalesce multiple consecutive prints together,
so doing it explicitly gives a modest reduction in code size.

Wrap that all up into a new set of macros so that the same trick can
also be shared with the test applications.

4 months agocdecl99: Better "help" output on some old systems.
Nick Bowler [Thu, 7 Dec 2023 02:35:26 +0000 (21:35 -0500)]
cdecl99: Better "help" output on some old systems.

Some very old printf implementations return 0 on success instead of the
number of bytes written.  We should never see a return of 0 normally,
so we can improve the output to be less of a garbled mess by printing
a newline if that happens (same as the error case).  This is a simple
tweak that should have virtually no impact on modern systems.

4 months agocdecl99: Fix "help" command on ULTRIX.
Nick Bowler [Thu, 7 Dec 2023 02:12:04 +0000 (21:12 -0500)]
cdecl99: Fix "help" command on ULTRIX.

ULTRIX 4.5 nawk does not always interpret a nonempty string as "true",
so install a workaround to the gen-cmdlist.awk script for this issue.

And fix the test suite which purports to test this command but failed
to notice that no useful help was printed.

4 months agotests: Try not to split fields in randomdecl sanity test.
Nick Bowler [Wed, 6 Dec 2023 06:17:56 +0000 (01:17 -0500)]
tests: Try not to split fields in randomdecl sanity test.

HP-UX 11 awk will simply exit with an error if any input line has more
than 199 fields.  To avoid this happening in the randomdecl sanity test,
set FS to some garbage because we don't actually use any of the field
variables in this script.

4 months agoExplicitly require gnulib stdbool module.
Nick Bowler [Wed, 6 Dec 2023 05:33:06 +0000 (00:33 -0500)]
Explicitly require gnulib stdbool module.

It seems that updating gnulib has caused this to not always be pulled
in, in particular the header is no longer generated on HP-UX 11, leading
to build failures.

4 months agoWork around some ULTRIX make bugs.
Nick Bowler [Wed, 6 Dec 2023 04:05:17 +0000 (23:05 -0500)]
Work around some ULTRIX make bugs.

ULTRIX 4.5 make fails during rule lookup when it tries to build a
target in a nonexistent directory that might have inference rules
associated with it (i.e., ends with a defined suffix), for example:

  % echo 'nonexistent/baz.o: ;' | make -f -
  Directory nonexistent/: Make: Cannot open.  Stop.

We can work around this problem by using a prerequisite to create the
output directory instead of trying to create it directly in the rule.
Automake actually does this already for its own rules, so let's try
to hook the same mechanism.

Pull in similar fixes from dxcommon.

4 months agoSkip Bison api.token.raw probe if Bison is not found.
Nick Bowler [Wed, 6 Dec 2023 01:34:20 +0000 (20:34 -0500)]
Skip Bison api.token.raw probe if Bison is not found.

Printing the api.token.raw probe when Bison was not found at all gives
strange configure output, let's just make the whole check conditional.

4 months agoBump dxcommon to get help output improvements.
Nick Bowler [Tue, 5 Dec 2023 05:49:34 +0000 (00:49 -0500)]
Bump dxcommon to get help output improvements.

As well as a nice size reduction on modern platforms, basically
everything is working on ULTRIX 4.5 now too, cool.

4 months agotests: Avoid using awk -v option.
Nick Bowler [Tue, 5 Dec 2023 05:37:35 +0000 (00:37 -0500)]
tests: Avoid using awk -v option.

Traditional awk implementations do not support -v, and this is also
the case with ULTRIX 4.5 nawk.  The tests that use -v don't actually
need to use it, so it doesn't hurt to fix this.

4 months agotests: Work around some ancient printf bugs.
Nick Bowler [Tue, 5 Dec 2023 05:34:27 +0000 (00:34 -0500)]
tests: Work around some ancient printf bugs.

Some very old printf implementations (e.g., on ULTRIX 4.5) do not
support negative precision with %.*s conversions in order to behave
as if the precision was omitted.

It is easy to change the rendertest program to avoid this problem,
so let's change it.

4 months agotests: Better output filter in randomdecl sanity test.
Nick Bowler [Mon, 4 Dec 2023 05:14:47 +0000 (00:14 -0500)]
tests: Better output filter in randomdecl sanity test.

Instead of a big sed program producing thousands of lines to then
extract the unique ones, use an awk program that follows the same
basic concept but only prints any particular line once.

4 months agoUse awk over printf when generating atlocal.
Nick Bowler [Mon, 4 Dec 2023 03:57:38 +0000 (22:57 -0500)]
Use awk over printf when generating atlocal.

We use awk extensively already and it will do the job here.  SVr4
printf does not implement the POSIX behaviour of repeating the output
when there are more arguments than needed for the given format string.

4 months agoFix tests build on compilers without _Bool.
Nick Bowler [Mon, 4 Dec 2023 02:17:46 +0000 (21:17 -0500)]
Fix tests build on compilers without _Bool.

For these test programs, there is no advantage to using _Bool over
just plain "int" or whatever.

4 months agoFix parser build on compilers without _Bool.
Nick Bowler [Sun, 3 Dec 2023 20:14:38 +0000 (15:14 -0500)]
Fix parser build on compilers without _Bool.

Although we have a perfectly fine replacement for compilers that do
not implement _Bool, we have to have #include <stdbool.h> in order
to get it, which was missing from the parser header.

4 months agolibcdecl: Add _Bool fallback to public header.
Nick Bowler [Sun, 3 Dec 2023 22:31:26 +0000 (17:31 -0500)]
libcdecl: Add _Bool fallback to public header.

Even though we have a fallback for _Bool when building the library,
it is missing in some source files that include cdecl.h.  But more
importantly, it is not available to downstream users of the installed
header file.

As far as I'm aware, all compilers which support _Bool in any mode also
support it in strict C89 mode, so it should be sufficient to just use
_Bool if configure detected support for it.  We integrate the newfangled
bake-config script so that the installed header embeds this config.

There is also one inline function which returns _Bool.  We can just
change it to return int instead, since there is no ABI implication.

4 months agoDon't build locale/wcwidth junk if NLS is disabled.
Nick Bowler [Sun, 3 Dec 2023 21:54:07 +0000 (16:54 -0500)]
Don't build locale/wcwidth junk if NLS is disabled.

These functions are only used for NLS support, so it is silly to
compile them if NLS is disabled for any reason.

To do this, we create a local "dx-nls" gnulib module which can in
turn use conditional dependencies to pull in all the (now optional)
modules.

It is necessary to update gnulib in order for this to actually work,
as otherwise uniwidth/width is still compiled for some reason, and
it looks like this has been fixed upstream.

4 months agoMigrate gnulib patches to new common helper macro.
Nick Bowler [Fri, 1 Dec 2023 03:46:58 +0000 (22:46 -0500)]
Migrate gnulib patches to new common helper macro.

Using the new DX_PATCH_GNULIB macro allows m4 to implement the patches
that were previously being done in bootstrap, as well as removing the
repeated runtime test to work around the solaris underquoting problem
in threadlib.m4.

This also changes MinGW builds to use native Windows threads by default.

4 months agoAvoid the use of for loop declarations.
Nick Bowler [Thu, 30 Nov 2023 01:56:44 +0000 (20:56 -0500)]
Avoid the use of for loop declarations.

This C99 syntax is now almost entirely contained to test programs;
at this point using such syntax is just an obstacle to a successful
build rather than anything useful.

It is now possible to build with gcc in C89 mode, and probably some
other pre-C99 compilers.

One annoyance is the reference code for the RNG uses such declarations.
We avoid changing the reference code and instead arrange for the test
to be skipped unless compiler support is available.

4 months agotests: Use TAP helpers in rng-test.
Nick Bowler [Thu, 30 Nov 2023 01:42:07 +0000 (20:42 -0500)]
tests: Use TAP helpers in rng-test.

I imagine the helpers were avoided originally to avoid extra files in
the distribution, but they're there anyway now so there seems to be
no reason not to use them.

4 months agoBump dxcommon to fix "make install" with old shells.
Nick Bowler [Wed, 22 Nov 2023 04:49:04 +0000 (23:49 -0500)]
Bump dxcommon to fix "make install" with old shells.

The translation installation rules were busted on HP-UX /bin/sh,
heirloom-sh, probably old Solaris and maybe others.

4 months agoAdd a basic "make installcheck" function.
Nick Bowler [Wed, 22 Nov 2023 01:25:04 +0000 (20:25 -0500)]
Add a basic "make installcheck" function.

Add a very simple post-install test which simply attempts to compile,
link and run a test program against the installed header and library.

5 months agoTrivial manual fixes.
Nick Bowler [Sun, 19 Nov 2023 04:01:41 +0000 (23:01 -0500)]
Trivial manual fixes.

For literal strings, we need to use \- instead of just - as some troff
processors turn plain "-" into "proper" unicode hyphens (as opposed to
hyphen-minus), which breaks copy+paste and searching.

Ensure that .Os follows .Dt in the mdoc prologue as apparently not doing
this results in broken manpage headings with groff 1.23.

5 months agolibcdecl: Prefer memchr over strchr in the scanner.
Nick Bowler [Sun, 19 Nov 2023 01:05:23 +0000 (20:05 -0500)]
libcdecl: Prefer memchr over strchr in the scanner.

Since nothing else in the library uses strchr, but we do use memchr
elsewhere, using memchr instead avoids a comparatively expensive PLT
entry.  We already know the string length so the only real difference
is the additional argument marshalling.

5 months agolibcdecl: Fully remove snprintf requirement from the library.
Nick Bowler [Sat, 18 Nov 2023 21:41:44 +0000 (16:41 -0500)]
libcdecl: Fully remove snprintf requirement from the library.

There is only one remaining unconditional snprintf usage in the library,
which implements the cdecl__strlcpy function.  Replacing this with an
alternate implementation means we no longer need snprintf at all except
when NLS is enabled (in that case, we assume snprintf is available --
possibly provided by GNU libintl).

So we can drop quite a lot of gnulib code potentially going into the
library.  The usual gnulib behaviour is to substitute complete re-
implementations for almost any possible problem, even ones that are
totally irrelevant to the usage at hand.

Bumping dxcommon removes snprintf from the applications too so we can
drop all of this nonsense.  On systems that used the snprintf fallback,
this reduces the overall library size by about 30%.

5 months agolibcdecl: reduce snprintf reliance for error reporting.
Nick Bowler [Wed, 15 Nov 2023 03:43:00 +0000 (22:43 -0500)]
libcdecl: reduce snprintf reliance for error reporting.

Add a fallback formatting method using the main libcdecl rendering
functions which works in the NLS-disabled case.

We don't need to avoid snprintf if NLS is enabled, as GNU libintl
will provide a usable snprintf if the system does not.

5 months agolibcdecl: Simplify loop in cdecl__normalize_specs.
Nick Bowler [Thu, 26 Oct 2023 01:28:17 +0000 (21:28 -0400)]
libcdecl: Simplify loop in cdecl__normalize_specs.

Restructure the code a bit to make this loop a bit more straightforward.

5 months agolibcdecl: Avoid snprintf for integer conversions.
Nick Bowler [Thu, 26 Oct 2023 00:59:16 +0000 (20:59 -0400)]
libcdecl: Avoid snprintf for integer conversions.

To reduce the library dependency on gnulib replacements, implement the
conversion of uintmax_t to decimal by simple repeated division.  This
way avoids any need to worry about whether the C library can actually
perform 64-bit decimal conversions properly.

5 months agotests: Add sanity check for truncated output.
Nick Bowler [Wed, 25 Oct 2023 01:21:49 +0000 (21:21 -0400)]
tests: Add sanity check for truncated output.

Nothing really verifies that output truncation of the cdecl_declare
and cdecl_explain functions actually works as expected.

Add a new test program and a couple invocations to at least cover
the basic functionality.

8 months agoExpand some sections of the libcdecl manual.
Nick Bowler [Fri, 28 Jul 2023 06:04:52 +0000 (02:04 -0400)]
Expand some sections of the libcdecl manual.

- Clarify that the memory management details wrt. cdecl_parse_decl and
  cdecl_parse_english are unspecified.

- Add more detail to the description of cdecl_explain and cdecl_declare.

- Clarify that it is allowed to pass a 'struct cdecl' with a NULL
  specifiers list to cdecl_declare.

8 months agocdecl99: Combine all the main command implementations.
Nick Bowler [Fri, 28 Jul 2023 06:01:53 +0000 (02:01 -0400)]
cdecl99: Combine all the main command implementations.

The explain, simplify and declare (or type) commands are all virtually
identical.  The primary difference is just which parser mode to use,
and which output mode to use, with the various combinations giving
the various commands.

Other than some very slight tweak to the formatting to handle "simplify"
with multiple full declarators, we can just implement one function that
does all three operations: a pretty nice cleanup.

8 months agolibcdecl: Fix output regression with multiple declarators.
Nick Bowler [Fri, 28 Jul 2023 04:22:11 +0000 (00:22 -0400)]
libcdecl: Fix output regression with multiple declarators.

It turns out that the cdecl99 program implemented the simplify command
using the undocumented behaviour of calling cdecl_declare with NULL
specifiers to output just the declarator part.

Recent changes to the library partially broke that usage by printing an
extra space in this case.  This went unnoticed as the simplify command
is only lightly tested and nothing checks its behaviour with multiple
declarators.

Fortunately it is very easy to restore the old behaviour in the library,
and to add a test case to verify this behaviour.

8 months agolibcdecl: Work around GNU libc snprintf bug.
Nick Bowler [Fri, 28 Jul 2023 04:00:12 +0000 (00:00 -0400)]
libcdecl: Work around GNU libc snprintf bug.

Apparently, with GNU libc (even contemporary versions), you cannot simply
pass an arbitrarily-large length.  It appears that glibc internally adds
the provided length to the provided destination pointer, and if that
calculation overflows, then the actual output is silently truncated.

I believe this to be an error in glibc; the only thing the specification
for snprintf says about the length n is that output characters beyond
the "n-1st" are discarded, which doesn't imply that it is invalid to
for a program to pass large length values.  But it doesn't really
matter, we just have to deal with this behaviour since it exists.

This only affects the parser syntax error path, since 41ff7ec97691
("libcdecl: Simplify Bison error message reporting.") changed that to
use cdecl__strlcpy with a large size (INT_MAX).  The normal output path
always passes an actual buffer length.  The bison-generated syntax error
code does not track buffer lengths, but it does ensure the buffer is
large enough so we can use strlen to infer a suitable length.

A new test case is added to sortof directly test the issue, without
the fix it reliably fails for me on 32-bit x86, as the stack above 2G.
The invalid character test also fails because of this issue, but for a
subtly different reason.

8 months agolibcdecl: Perform all parser allocations via cdecl__alloc_item.
Nick Bowler [Tue, 25 Jul 2023 00:56:56 +0000 (20:56 -0400)]
libcdecl: Perform all parser allocations via cdecl__alloc_item.

The cdecl__alloc_item function internally does some basic initialization
and handles error reporting, so by using it consistently we can avoid
some of this stuff being repeated throughout the parser actions, which
gives a slight reduction in the size of the parser.

As this function allocates a fixed-sized union of all the parse tree
structures, this means a small amount of runtime memory may be wasted
for the smaller ones, but it should be less than 12 bytes per allocation.

8 months agolibcdecl: Replace ALLOC_STRUCT with specialized macros.
Nick Bowler [Mon, 24 Jul 2023 23:57:56 +0000 (19:57 -0400)]
libcdecl: Replace ALLOC_STRUCT with specialized macros.

While there is some appeal to this generic "do everything" macro,
it depends on a bunch of modern C syntax (variadic macros, compound
literals, designated initializers) which is not always correctly
implemented.  We've already had to work around at least one compiler
bug in the code directly related to this macro.

Using specialized macros for each kind of allocation works better
on older implementations, and moreover we seem to get more compact
code out of modern ones too, probably because compound literals
initialize all members and we don't always need that.

8 months agolibcdecl: Factor out toplevel parser actions.
Nick Bowler [Mon, 24 Jul 2023 04:10:22 +0000 (00:10 -0400)]
libcdecl: Factor out toplevel parser actions.

Using a separate rule so there is just one semantic action for the
start symbol seems to give a slight code size improvement.

8 months agolibcdecl: Fix memory leak when parsing e.g., int () int.
Nick Bowler [Mon, 24 Jul 2023 03:46:36 +0000 (23:46 -0400)]
libcdecl: Fix memory leak when parsing e.g., int () int.

After the parser reduces the start symbol, it can still fail if the
scanner returns additional tokens.  In this case, nobody frees the
parse tree that was already output by the previously-executed parser
actions.

Solve this by simply freeing the output tree in the caller on error.

We make a slight adjustment to the "interactive" test case so that it
will tickle this particular issue.  When using "leak sanitizer", the
leak will be found and a nonzero exit status will be substituted,
failing the test.

The existing "command error messages" test also notices the problem when
using "leak sanitizer", but not because of the exit status: it only sees
text printed to stderr in the wrong format.

8 months agolibcdecl: Don't dynamically allocate null declarators.
Nick Bowler [Sun, 23 Jul 2023 19:37:32 +0000 (15:37 -0400)]
libcdecl: Don't dynamically allocate null declarators.

Since identifiers now come with their own declarator allocations,
nothing actually modifies any part of an allocated null declarator.

And since null declarators are always the same (with all members zero),
we don't even need to allocate them at all.  Just use a single static
allocation and make every reference to a null declarator point to that.

Then we just need to not free null declarators in the various places
where that currently happens.

8 months agolibcdecl: Combine identifier and struct allocation.
Nick Bowler [Sun, 23 Jul 2023 19:06:29 +0000 (15:06 -0400)]
libcdecl: Combine identifier and struct allocation.

Whenever the parser uses an identifier token, it is always to stuff
it into a newly-allocated declarator or declspec structure.

So we can reduce the amount of work that needs to be done in the
parser actions by by pre-allocating a declarator structure in the
scanner.  By using a union, we can also use this same allocation
for the declspec case.

And by happy accident, some of the structure members are identical
between both cases, and GCC at least recognizes that it doesn't need
to do anything to copy e.g., declarator.u.ident to declspec.ident
within the union.

8 months agoFree working memory in crossparse test.
Nick Bowler [Sun, 23 Jul 2023 17:15:16 +0000 (13:15 -0400)]
Free working memory in crossparse test.

When reading from a file, the getline buffer is not explicitly freed by
the test application, which shows up as leaked memory in memory debugging
tools.  Let's fix that so we don't mistake that for an actual leak in
the library.

8 months agocdecl99: Remove some unused variable declarations.
Nick Bowler [Sun, 23 Jul 2023 16:47:55 +0000 (12:47 -0400)]
cdecl99: Remove some unused variable declarations.