]> git.draconx.ca Git - cdecl99.git/log
cdecl99.git
12 years agoAdd note about old-style function declarations to the manual.
Nick Bowler [Wed, 30 Nov 2011 01:35:05 +0000 (20:35 -0500)]
Add note about old-style function declarations to the manual.

12 years agoMake is_abstract a proper library function.
Nick Bowler [Wed, 30 Nov 2011 01:08:54 +0000 (20:08 -0500)]
Make is_abstract a proper library function.

This function is generally useful.  Add it to the public API.

12 years agoReduce "set +x" noise in (un)install targets.
Nick Bowler [Tue, 29 Nov 2011 03:03:07 +0000 (22:03 -0500)]
Reduce "set +x" noise in (un)install targets.

By judicious use of subshells, we can eliminate the need to call
"set +x" explicitly, which should (slightly) reduce the noise of the
(un)install targets.

12 years agoGenerate the specifier switch statement automatically.
Nick Bowler [Sun, 20 Nov 2011 20:17:52 +0000 (15:17 -0500)]
Generate the specifier switch statement automatically.

We already have a list of specifier names, so use them!

12 years agoSeparate specifier handling from the output routines.
Nick Bowler [Sun, 20 Nov 2011 16:37:00 +0000 (11:37 -0500)]
Separate specifier handling from the output routines.

This moves all the code to handle redundant specifiers and multiple
orderings to the parser, so that the output routines just have to
print them out in order.

This will allow the output routines to be used by test generators.

12 years agoUse #n in strtab.sed.
Nick Bowler [Sun, 23 Oct 2011 16:35:51 +0000 (12:35 -0400)]
Use #n in strtab.sed.

This feature allows us to make all makefile rules which call sed scripts
the same.  This may help reduce code duplication in the makefile later.

12 years agoMake CDECL_SPEC_TYPE non-zero.
Nick Bowler [Sat, 22 Oct 2011 23:53:38 +0000 (19:53 -0400)]
Make CDECL_SPEC_TYPE non-zero.

This allows us to meaningfully OR together the various CDECL_SPEC_
constants.  A bit of code assumes that CDECL_SPEC_TYPE is zero, so that
needs to be fixed.

12 years agoUpdate Gnulib to latest version.
Nick Bowler [Sat, 22 Oct 2011 18:17:31 +0000 (14:17 -0400)]
Update Gnulib to latest version.

12 years agoMangle spliced makefile lines in Gnulib correctly.
Nick Bowler [Sat, 22 Oct 2011 17:37:27 +0000 (13:37 -0400)]
Mangle spliced makefile lines in Gnulib correctly.

Otherwise, target and variable mangling may only apply to the first
line.

12 years agoAdd some examples to the manual.
Nick Bowler [Sat, 22 Oct 2011 16:06:10 +0000 (12:06 -0400)]
Add some examples to the manual.

12 years agoImplement --help.
Nick Bowler [Sat, 8 Oct 2011 14:53:33 +0000 (10:53 -0400)]
Implement --help.

12 years agoAdd support for translated long options.
Nick Bowler [Tue, 4 Oct 2011 22:14:05 +0000 (18:14 -0400)]
Add support for translated long options.

12 years agoIdentify nonterminals in the manual's grammar in an alternate way.
Nick Bowler [Tue, 4 Oct 2011 02:02:28 +0000 (22:02 -0400)]
Identify nonterminals in the manual's grammar in an alternate way.

Some output devices won't render .Va text differently from .Li text when
displaying the man page.  This unfortunately means that nonterminals
look exactly the same as terminals in the grammar.  Add brackets
around nonterminals (which are otherwise unused in the grammar) so
that it is readable on these devices, too.

12 years agoFix typos in manual.
Nick Bowler [Tue, 4 Oct 2011 01:51:09 +0000 (21:51 -0400)]
Fix typos in manual.

Apparently I was too drunk to spell "declaration" when I wrote this.

12 years agoDon't call cdecl_free internally.
Nick Bowler [Tue, 4 Oct 2011 01:24:49 +0000 (21:24 -0400)]
Don't call cdecl_free internally.

Use an exported wrapper function to avoid a local PLT entry in the
shared object.

12 years agoGenerate gettext catalog only from source files.
Nick Bowler [Thu, 29 Sep 2011 13:44:36 +0000 (09:44 -0400)]
Generate gettext catalog only from source files.

Otherwise the catalog is considered out of date even from a freshly
unpacked tarball.

12 years agoStart on a facility to translate error codes into strings.
Nick Bowler [Thu, 29 Sep 2011 03:23:12 +0000 (23:23 -0400)]
Start on a facility to translate error codes into strings.

This will be needed to port the remaining error messages over.

12 years agoStart implementing proper error handling.
Nick Bowler [Thu, 29 Sep 2011 01:57:23 +0000 (21:57 -0400)]
Start implementing proper error handling.

Since the library shouldn't be printing its own error messages, we need
a mechanism to propagate error details to the caller.  Implement a
system using thread-local storage which tracks the most recent errors.

12 years agoDocument libcdecl's slice of the C namespaces.
Nick Bowler [Thu, 29 Sep 2011 01:03:50 +0000 (21:03 -0400)]
Document libcdecl's slice of the C namespaces.

Now that we rename gnulib symbols, this should actually be true.
Document it.

12 years agoUpdate timestamps on generated header files before distributing them.
Nick Bowler [Thu, 29 Sep 2011 00:03:35 +0000 (20:03 -0400)]
Update timestamps on generated header files before distributing them.

Otherwise we risk breaking VPATH builds from the tarball, as make may
attempt to regenerate the headers.

12 years agoAdd installdirs rule for .mo files.
Nick Bowler [Thu, 29 Sep 2011 00:05:55 +0000 (20:05 -0400)]
Add installdirs rule for .mo files.

12 years agoUse (un)install-local to (un)install .mo files.
Nick Bowler [Thu, 29 Sep 2011 00:05:49 +0000 (20:05 -0400)]
Use (un)install-local to (un)install .mo files.

These install rules do not depend on any other installed file, so
there's no need to use the -hook versions which guarantee ordering.
Use -local instead.

12 years agoAdd uninstall rule for .mo files.
Nick Bowler [Thu, 22 Sep 2011 22:58:45 +0000 (18:58 -0400)]
Add uninstall rule for .mo files.

This was apparently forgotten because distcheck seems to not notice when
you leave crap in the install tree.

12 years agoAdd missing copyright headers.
Nick Bowler [Thu, 22 Sep 2011 22:46:35 +0000 (18:46 -0400)]
Add missing copyright headers.

12 years agoAdd -no-undefined to libcdecl LDFLAGS.
Nick Bowler [Thu, 22 Sep 2011 01:46:42 +0000 (21:46 -0400)]
Add -no-undefined to libcdecl LDFLAGS.

This is now true, so setting this allows shared libraries to be built
on Woe32.

12 years agoAvoid gratuitous library dependencies linking gnulib.
Nick Bowler [Thu, 22 Sep 2011 00:58:27 +0000 (20:58 -0400)]
Avoid gratuitous library dependencies linking gnulib.

libcdecl doesn't use the readline module at all, but libtool happily
pulls it in as a dependency.  Handle library dependencies manually to
avoid this problem.

12 years agoTell xgettext about _ and N_ markings.
Nick Bowler [Thu, 22 Sep 2011 00:29:24 +0000 (20:29 -0400)]
Tell xgettext about _ and N_ markings.

Gnulib uses these, and we will too.

12 years agoFix build with NLS disabled.
Nick Bowler [Wed, 21 Sep 2011 23:11:39 +0000 (19:11 -0400)]
Fix build with NLS disabled.

When NLS is disabled, we should not install any .mo files but we still
need to distribute the .po files.  However, ALL_LINGUAS was not being
set in this case, so the POFILES was not set if NLS is disabled, causing
a distcheck failure.

Also fix a build error in this case due to a missing #include.

12 years agoInclude config.h in all C source files.
Nick Bowler [Wed, 21 Sep 2011 23:13:50 +0000 (19:13 -0400)]
Include config.h in all C source files.

Some source files failed to include config.h, which is needed for
some things to work.

12 years agoInclude config.h in scan.l.
Nick Bowler [Wed, 21 Sep 2011 23:12:52 +0000 (19:12 -0400)]
Include config.h in scan.l.

This is required for things to work.  Unfortunately, %top{...} appears
to be the only bit where config.h can be put in a flex scanner, as
headers are included before the first %{...} block is output.  Thus, the
include ends up in the scan.h header file.  Nevertheless, this should
not be a problem since config.h only defines macros.

12 years agoRewrite Gnulib symbols to be in libcdecl's namespace.
Nick Bowler [Wed, 21 Sep 2011 04:51:17 +0000 (00:51 -0400)]
Rewrite Gnulib symbols to be in libcdecl's namespace.

The gnulib symbols are not properly prefixed for libcdecl internal
symbols (e.g. cdecl__blah).  This *will* cause problems when statically
linking against both libcdecl and another library that uses the same
gnulib modules.

Unfortunately, there's no simple way to determine what symbols need
prefixing without compiling all the gnulib objects.  The results can't
be distributed either, because they depend on the configuration.  So,
limited to simple tools and portable make rules, we hack together a
"new" config.h at build time that defines object-like macros to rewrite
the symbols, carefully ensuring that header dependencies are correct.

12 years agoSplit gnulib_headers into 3 variables.
Nick Bowler [Wed, 21 Sep 2011 04:31:15 +0000 (00:31 -0400)]
Split gnulib_headers into 3 variables.

This will be useful for symbol mangling, where additional header files
may need to be added to various points in the dependency chain.

12 years agoMove all Gnulib CLEANFILES variables to the end of the makefile.
Nick Bowler [Mon, 19 Sep 2011 22:44:47 +0000 (18:44 -0400)]
Move all Gnulib CLEANFILES variables to the end of the makefile.

This makes the clean procedure independent of the configuration.

12 years agoHandle gl_LIBOBJS/gl_LTLIBOBJS correctly.
Nick Bowler [Mon, 19 Sep 2011 22:43:34 +0000 (18:43 -0400)]
Handle gl_LIBOBJS/gl_LTLIBOBJS correctly.

These AC_SUBSTed variables reference objects whose sources are located
in lib, thus they need to be rewritten like other AC_SUBSTed variables.

These objects also need the header dependencies like other objects.

12 years agoEliminate use of BUILT_SOURCES from Gnulib.
Nick Bowler [Mon, 19 Sep 2011 03:01:18 +0000 (23:01 -0400)]
Eliminate use of BUILT_SOURCES from Gnulib.

As with recursive make, BUILT_SOURCES is harmful because of inadequate
dependency information.  We can achieve a similar effect with by using
order-only dependencies:  These force the headers to be up-to-date
before anything that might require them is built: but rebuilds are only
triggered based on the accurate dependency information generated by the
normal mechanisms.

Unfortunately, order-only dependencies are a GNU make feature, so we use
a hack which should fall back to ordinary dependencies on other make
implementations.  The worst effect of using ordinary dependencies will
be that files might be needlessly rebuilt when a header changes.

12 years agoIntegrate Gnulib non-recursively.
Nick Bowler [Mon, 19 Sep 2011 01:46:14 +0000 (21:46 -0400)]
Integrate Gnulib non-recursively.

With a little bit of mangling, it's possible to make the makefile
fragment produced by gnulib-tool suitable for use in our non-recursive
makefile.

12 years agoEnable i18n in Bison.
Nick Bowler [Thu, 15 Sep 2011 01:10:19 +0000 (21:10 -0400)]
Enable i18n in Bison.

This makes us require library initialization.  To avoid requiring an
explicit call, we implicitly initialize the library when it is first
required.  Bring in Gnulib's threading library to do this in a
thread-safe manner when available.

12 years agoInitial README.
Nick Bowler [Thu, 15 Sep 2011 22:33:41 +0000 (18:33 -0400)]
Initial README.

12 years agoAllow bootstrap tools to be overridden via environment variables.
Nick Bowler [Sun, 18 Sep 2011 23:32:54 +0000 (19:32 -0400)]
Allow bootstrap tools to be overridden via environment variables.

Useful if you want to use a different installed version of autoreconf,
for instance.

12 years agoAdd nodefault to flex options.
Nick Bowler [Sun, 18 Sep 2011 23:31:32 +0000 (19:31 -0400)]
Add nodefault to flex options.

We don't rely on this behaviour, and the default rule causes gcc to emit
a warning with -D_FORTIFY_SOURCE=2.  Just kill it.

12 years agoAdd WTFPL2 license document.
Nick Bowler [Sun, 18 Sep 2011 23:29:31 +0000 (19:29 -0400)]
Add WTFPL2 license document.

Parts of Cdecl99 are released under the terms of this license, thus it
should be included.

12 years agoFool autoreconf and automake into ignoring gettext.
Nick Bowler [Thu, 15 Sep 2011 01:01:58 +0000 (21:01 -0400)]
Fool autoreconf and automake into ignoring gettext.

Since we define our own makefile rules for gettext, having the autotools
magically perform special actions is counterproductive.

12 years agoEnable conditional dependencies in gnulib.
Nick Bowler [Wed, 14 Sep 2011 23:56:07 +0000 (19:56 -0400)]
Enable conditional dependencies in gnulib.

Seems to shave about 10% off total configure time on my machine.

12 years agoAdd never-interactive flex option.
Nick Bowler [Wed, 14 Sep 2011 23:52:14 +0000 (19:52 -0400)]
Add never-interactive flex option.

This eliminates the (non-ANSI) fileno and isatty calls.  Our input is
always a fixed buffer.

12 years agoInitial i18n infrastructure.
Nick Bowler [Wed, 14 Sep 2011 23:51:24 +0000 (19:51 -0400)]
Initial i18n infrastructure.

12 years agoUse AM_CPPFLAGS for mandatory preprocessor flags.
Nick Bowler [Wed, 14 Sep 2011 01:10:39 +0000 (21:10 -0400)]
Use AM_CPPFLAGS for mandatory preprocessor flags.

CPPFLAGS is meant to be overridable by the user.  Don't use it.

12 years agoUse symlinks for gnulib's m4 files.
Nick Bowler [Wed, 14 Sep 2011 01:10:01 +0000 (21:10 -0400)]
Use symlinks for gnulib's m4 files.

This is nice because it makes it really obvious (when working from git)
what files came directly from gnulib.

12 years agoUse .Pp for paragraph breaks in man pages.
Nick Bowler [Sun, 11 Sep 2011 23:29:12 +0000 (19:29 -0400)]
Use .Pp for paragraph breaks in man pages.

Blank lines are apparently invalid.

12 years agoUse .Va instead of .Fa in man pages when appropriate.
Nick Bowler [Sun, 11 Sep 2011 23:28:57 +0000 (19:28 -0400)]
Use .Va instead of .Fa in man pages when appropriate.

".Va" means "variable name", which is more appropriate than "function
argument" for variables.  Nevertheless, they're probably typeset the
same way, anyway.

12 years agoRe-word description of nonterminals in man page.
Nick Bowler [Sun, 11 Sep 2011 23:28:35 +0000 (19:28 -0400)]
Re-word description of nonterminals in man page.

There's no reason to assume that "function arguments" are typeset with
an underline.  So re-word that sentence to avoid directly stating
typographical conventions by using an example instead.

12 years agoAbort on "impossible" condition.
Nick Bowler [Sun, 11 Sep 2011 23:27:44 +0000 (19:27 -0400)]
Abort on "impossible" condition.

A corrupt or otherwise invalid cdecl structure could make the
explain_prologue function fail to return a value.  Add an assertion to
catch that.

12 years agoMake semicolons after declarations optional.
Nick Bowler [Wed, 20 Jul 2011 00:18:02 +0000 (20:18 -0400)]
Make semicolons after declarations optional.

They're annoying, don't make sense for type names, weren't required by
cdecl, and don't actually do anything productive.

12 years agoAdd cdecl__ prefix to flex/bison functions.
Nick Bowler [Tue, 19 Jul 2011 23:13:23 +0000 (19:13 -0400)]
Add cdecl__ prefix to flex/bison functions.

Now all global symbols are prefixed.

12 years agoCombine English specifiers properly.
Nick Bowler [Tue, 19 Jul 2011 23:10:00 +0000 (19:10 -0400)]
Combine English specifiers properly.

If $1 is NULL in post_specs, then $3 won't get attached to the list.

12 years agoAdd man pages.
Nick Bowler [Tue, 19 Jul 2011 00:59:15 +0000 (20:59 -0400)]
Add man pages.

12 years agoAdd support for parsing English-like declarations.
Nick Bowler [Wed, 13 Jul 2011 23:53:37 +0000 (19:53 -0400)]
Add support for parsing English-like declarations.

I think that makes the parser almost feature-complete.

12 years agoFix return value of typespec checks.
Nick Bowler [Sat, 16 Jul 2011 17:30:10 +0000 (13:30 -0400)]
Fix return value of typespec checks.

Returning -1 here means "true"; we actually want to return "false".

12 years agoForbid arrays of functions.
Nick Bowler [Fri, 15 Jul 2011 00:34:42 +0000 (20:34 -0400)]
Forbid arrays of functions.

12 years agoFix error name of ellipsis token.
Nick Bowler [Thu, 14 Jul 2011 23:40:39 +0000 (19:40 -0400)]
Fix error name of ellipsis token.

So it says unexpected ... instead of unexpected .

12 years agoFix rendering of non-prototype function declarations.
Nick Bowler [Thu, 14 Jul 2011 23:21:55 +0000 (19:21 -0400)]
Fix rendering of non-prototype function declarations.

When there are no parameters, the closing parenthesis was not printed.
Fix that up.

12 years agoAvoid modifying the input command string.
Nick Bowler [Wed, 13 Jul 2011 00:41:15 +0000 (20:41 -0400)]
Avoid modifying the input command string.

This gives the individual command functions access to the entire
(unadultered) input from the user.

12 years agoFix yyerror's signature.
Nick Bowler [Tue, 12 Jul 2011 22:20:12 +0000 (18:20 -0400)]
Fix yyerror's signature.

This only worked because we ignore those parameters.

12 years agoAdd support for --execute and --file options.
Nick Bowler [Sun, 10 Jul 2011 16:48:27 +0000 (12:48 -0400)]
Add support for --execute and --file options.

For useful non-interactive invocation.

12 years agoSplit up interactive/noninteractive loops.
Nick Bowler [Sun, 10 Jul 2011 16:25:37 +0000 (12:25 -0400)]
Split up interactive/noninteractive loops.

Readline isn't well suited for non-interactive loops since it tends to
print stuff to standard output.  So use two loops: a readline-based one
and a getline-based one.

12 years agoAdd support for outputting declarations as C code.
Nick Bowler [Sat, 9 Jul 2011 00:00:44 +0000 (20:00 -0400)]
Add support for outputting declarations as C code.

This permits us to define a nifty "simplify" function.

12 years agoAdd support for imaginary types.
Nick Bowler [Fri, 8 Jul 2011 01:04:19 +0000 (21:04 -0400)]
Add support for imaginary types.

Somehow these got forgotten.

12 years agoReject mixed type names / declarations.
Nick Bowler [Thu, 7 Jul 2011 23:45:04 +0000 (19:45 -0400)]
Reject mixed type names / declarations.

Things like int,; make little sense.  Reject it.

12 years agoMove advance/advance_ into common code.
Nick Bowler [Thu, 7 Jul 2011 23:35:56 +0000 (19:35 -0400)]
Move advance/advance_ into common code.

These will be useful for other output routines.

12 years agoUse the reentrant scanner API.
Nick Bowler [Thu, 7 Jul 2011 22:33:44 +0000 (18:33 -0400)]
Use the reentrant scanner API.

12 years agoAdd initial support for non-interactive modes to cdecl99.
Nick Bowler [Thu, 7 Jul 2011 22:32:07 +0000 (18:32 -0400)]
Add initial support for non-interactive modes to cdecl99.

12 years agoValidate function return types.
Nick Bowler [Thu, 7 Jul 2011 02:31:48 +0000 (22:31 -0400)]
Validate function return types.

12 years agoCheck specifiers for type names.
Nick Bowler [Thu, 7 Jul 2011 01:44:12 +0000 (21:44 -0400)]
Check specifiers for type names.

Type names cannot have storage-class or function specifiers.

12 years agoValidate declspecs in function parameters.
Nick Bowler [Thu, 7 Jul 2011 00:51:31 +0000 (20:51 -0400)]
Validate declspecs in function parameters.

12 years agoDon't gratuitously reject inline specifiers.
Nick Bowler [Thu, 7 Jul 2011 00:39:47 +0000 (20:39 -0400)]
Don't gratuitously reject inline specifiers.

We actually do support functions now, so we need to handle inline.
Turns out the last user of the old output routines (the code that
prints "inline") didn't actually work properly, so port it over to
the new interface.

12 years agoReject declarations of void objects.
Nick Bowler [Thu, 7 Jul 2011 00:38:57 +0000 (20:38 -0400)]
Reject declarations of void objects.

12 years agoInitial support for function declarators.
Nick Bowler [Wed, 6 Jul 2011 23:58:35 +0000 (19:58 -0400)]
Initial support for function declarators.

Wow.  That was way harder than I thought it would be.

12 years agoAdd missing copyright headers.
Nick Bowler [Wed, 6 Jul 2011 23:51:39 +0000 (19:51 -0400)]
Add missing copyright headers.

12 years agoKill the "horizontal" declarator chain.
Nick Bowler [Wed, 6 Jul 2011 02:43:42 +0000 (22:43 -0400)]
Kill the "horizontal" declarator chain.

The "next" pointer in declarators is used in exactly one place: the list
of declarators of a declaration.  Move this chain to the toplevel so
that we get a list of declarations instead: now every struct cdecl has
exatly one declarator.

This helps eliminate the nasty hack in "explain" to print multiple
declarators.

12 years agoMake an explicit null declarator type.
Nick Bowler [Wed, 6 Jul 2011 01:12:59 +0000 (21:12 -0400)]
Make an explicit null declarator type.

Now that we have a child pointers in every declarator, this is way
cleaner than abusing the identifier type.

12 years agoFix broken include guard.
Nick Bowler [Tue, 5 Jul 2011 23:20:37 +0000 (19:20 -0400)]
Fix broken include guard.

12 years agoAdd a child pointer to cdecl_declarator.
Nick Bowler [Tue, 5 Jul 2011 22:23:52 +0000 (18:23 -0400)]
Add a child pointer to cdecl_declarator.

This eliminates the need for separate child pointers for each
declarator type.

12 years agoFix pointer declarators.
Nick Bowler [Tue, 5 Jul 2011 22:23:01 +0000 (18:23 -0400)]
Fix pointer declarators.

Support for parsing pointer types like int ** was broken a while back.
Fix it up.

12 years agoSplit advance into two parts.
Nick Bowler [Tue, 5 Jul 2011 00:17:51 +0000 (20:17 -0400)]
Split advance into two parts.

We need to avoid printing spaces after things on occasion.  This makes
the code a little simpler, too.

12 years agoAdd support for empty declarators.
Nick Bowler [Mon, 4 Jul 2011 22:11:51 +0000 (18:11 -0400)]
Add support for empty declarators.

This allows the parser to recognize type names which are required for
function prototypes, as well as actual declarations.  This also makes it
easy to let the user ask for an explanation of types.  For instance:

  explain int *(*[])[];

prints

  type array of pointer to array of pointer to int.

12 years agoUse assert(0) instead of abort for exceptional cases.
Nick Bowler [Mon, 4 Jul 2011 22:11:48 +0000 (18:11 -0400)]
Use assert(0) instead of abort for exceptional cases.

assert prints helpful context info to stderr.  These cases should never
be reached except by programmer error.

12 years agoAdd support for explaining multiple declarators.
Nick Bowler [Mon, 4 Jul 2011 22:10:49 +0000 (18:10 -0400)]
Add support for explaining multiple declarators.

12 years agoFix error handling in explain.
Nick Bowler [Mon, 4 Jul 2011 22:10:30 +0000 (18:10 -0400)]
Fix error handling in explain.

On a memory allocation failure, we leak the decl allocated by the
parser.  Fix that up.

12 years agoAdd support for array declarators.
Nick Bowler [Sat, 25 Jun 2011 13:45:16 +0000 (09:45 -0400)]
Add support for array declarators.

Currently there is a (I think quite reasonable) restriction that the
array length either be unspecified, a positive integer constant, an
identifier, or *.

12 years agoAdd support for pointer declarators.
Nick Bowler [Sat, 25 Jun 2011 13:41:41 +0000 (09:41 -0400)]
Add support for pointer declarators.

12 years agoFix comment about automatic generation in typenames.sed.
Nick Bowler [Sat, 25 Jun 2011 13:34:09 +0000 (09:34 -0400)]
Fix comment about automatic generation in typenames.sed.

Last I checked, typenames.sed is not validtypes.sed.

12 years agoRestrict the contexts in which typedef names can appear.
Nick Bowler [Sat, 25 Jun 2011 12:52:17 +0000 (08:52 -0400)]
Restrict the contexts in which typedef names can appear.

This should resolve a rather nasty ambiguity in the C grammar:

  [declaration] -> [declaration-specifiers] ;
                -> [type-specifier] [declaration-specifiers] ;
                -> int [declaration-specifiers] ;
                -> int [type-specifier] ;
                -> int [typedef-name] ;
                -> int [identifier] ;
                -> int x ;

versus

  [declaration] -> [declaration-specifiers] [init-declarator-list] ;
                -> [type-specifier] [init-declarator-list] ;
                -> int [init-declarator-list] ;
                -> int [init-declarator] ;
                -> int [declarator] ;
                -> int [direct-declarator] ;
                -> int [identifier] ;
                -> int x ;

The standard resolves this ambiguity by having a constraint that is not
part of the context-free grammar.  This ambiguity gets really nasty with
things like int f (x); -- is it a declaration of x with two type
specifiers or a declaration of f (a function with one parameter) with
with one type specifier?

A side-effect of this change is that the parser will now reject
declarations without any type specifiers at all, which probably makes
the error messages a bit less informative.

12 years agoFix VPATH builds from git.
Nick Bowler [Sat, 25 Jun 2011 00:26:25 +0000 (20:26 -0400)]
Fix VPATH builds from git.

In such builds, C source files (that are normally distributed) get
generated, which means they end up in the build tree.  Building them
subsequently fails because headers (in the source tree) are not found.

12 years agoSplit out qualifier explanations from explain_post_specs.
Nick Bowler [Fri, 24 Jun 2011 13:42:53 +0000 (09:42 -0400)]
Split out qualifier explanations from explain_post_specs.

They'll be needed on their own for pointer explanations.

12 years agoFix the distribution.
Nick Bowler [Fri, 24 Jun 2011 00:50:02 +0000 (20:50 -0400)]
Fix the distribution.

Now make distcheck passes.

12 years agoInitial support for explaining declarations.
Nick Bowler [Fri, 24 Jun 2011 00:24:50 +0000 (20:24 -0400)]
Initial support for explaining declarations.

This should support everything that the parser currently does.

12 years agoAdd a function to turn a typemap into a string.
Nick Bowler [Fri, 24 Jun 2011 00:24:32 +0000 (20:24 -0400)]
Add a function to turn a typemap into a string.

12 years agoAllow (and ignore) underscores in the list of type names.
Nick Bowler [Thu, 23 Jun 2011 00:30:53 +0000 (20:30 -0400)]
Allow (and ignore) underscores in the list of type names.

This allows the "true" keywords to be used in the list.

12 years agoKill typemap_is_valid.
Nick Bowler [Thu, 23 Jun 2011 00:30:52 +0000 (20:30 -0400)]
Kill typemap_is_valid.

Just do the check when building the map in the first place.  This
enables more useful error messages, too: the case where there are no
type specifiers at all is certainly worth diagnosing separately from
other kinds of nonsense.

12 years agoAdd initial command parser.
Nick Bowler [Thu, 23 Jun 2011 00:30:50 +0000 (20:30 -0400)]
Add initial command parser.

12 years agoImplement the interactive cdecl99 loop.
Nick Bowler [Thu, 23 Jun 2011 00:30:41 +0000 (20:30 -0400)]
Implement the interactive cdecl99 loop.

Bring in gnulib for getopt_long and readline support.