Commit graph

26 commits

Author SHA1 Message Date
George Koehler
8bb395b147 LLgen: use size_t, reduce warnings, other small changes
Use C89 size_t for sizes from sizeof() or to malloc() or realloc().
Remove obsolete (unsigned) casts.  Sizes were unsigned int in
traditional C but are size_t in C89.

Silence some clang warnings.  Add the second pair of round brackets in
`while ((ff = ff->ff_next))` to silence -Wparentheses.  Change
`if (nc_first(...))/*nothing*/;` to `(void)nc_first(...);` to silence
-Wempty-body.  The code in compute.c nc_first() had the form
`if (x) if (y) s; else t;`.  The old indentation (before 10717cc)
suggests that the "else" belongs to the 2nd "if", so add braces like
`if (x) { if (y) s; else t; }` to silence -Wdangling-else.

Shuffle extern function declarations.  Add missing declaration for
LLparse().  Stop declaring RENAME(); it doesn't exist.  Move some
declarations from main.c to extern.h, so the C compiler may check that
the declarations are compatible with the function definitions.

Assume that standard C89 remove() is available and doesn't need the
UNLINK() wrapper.

In lib/incl, don't need to include <stdio.h> nor <stdlib.h> to use
assert().

Remove alloc.h.  If you don't clean your build, then an outdated
BUILDDIR/obj/util/LLgen/headers/alloc.h will survive but should not
cause harm, because nothing includes it.  Don't need to remove alloc.h
from util/LLgen/distr.sh, because it isn't there.

Run the bootstrap to rebuild LLgen.c, Lpars.c, tokens.c.
2019-10-22 15:32:23 -04:00
carl
10717cc791 Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
- Remove support for generating K&R code.
- Remove mkstemp and replace by tmpnam (more portable but less safe)
2019-02-19 00:54:23 +08:00
David Given
65e544c35a Don't prototype strcpy as it makes OSX sad. 2019-02-10 12:28:42 +01:00
George Koehler
87a2315037 strcmp, strncmp are in <string.h>
*Important:*  Do `make clean` to work around a problem and prevent
infinite rebuilds, https://github.com/davidgiven/ack/issues/68

I edit tokens.g in util/LLgen/src, so I regenerate tokens.c.  The
regeneration script bootstrap.sh can't find LLgen, but I can run the
same command by typing the path to llgen.
2017-11-14 17:35:35 -05:00
David Given
fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
ceriel
8ea5d257c4 improved error reporting, added -DNON_CORRECTING 1997-02-21 15:44:44 +00:00
ceriel
c2607fdf0f Added non-correcting error recovery stuff 1997-02-21 11:27:57 +00:00
ceriel
a44bbb3977 Fixed a couple of minor bugs 1996-11-19 13:27:56 +00:00
ceriel
525eb1f1a4 Fixed typo 1995-07-31 09:17:14 +00:00
ceriel
7b6d8fbe56 Added copyright notice 1995-07-31 09:10:42 +00:00
ceriel
d1435f4fc6 Added an option to strip the grammar from its actions 1995-02-24 12:10:44 +00:00
ceriel
5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel
6fa0e5bfb0 Changed copyright notice, made installation less dependent on ACK 1991-11-23 10:41:43 +00:00
ceriel
4a34358b6a keep comments in actions; they may be significant (for lint) 1990-08-07 10:48:02 +00:00
ceriel
da48891d6e allow for multiple parsers within one program 1990-01-29 13:45:42 +00:00
ceriel
25dd5857c2 minor changes to many files 1987-06-03 19:05:14 +00:00
ceriel
5537abbdfb Added copyright notice 1987-03-10 01:26:51 +00:00
ceriel
3f6a8abe1b adapted to allow for user intervention before error recovery 1987-02-16 21:38:52 +00:00
ceriel
87af36724b Avoid a bug in the C-optimizer of 4.1 BSD. 1986-11-07 17:54:30 +00:00
ceriel
aac1207beb Error messages are printed differently now. A '%' in an error message
used to cause difficulties.
1986-10-22 15:30:46 +00:00
ceriel
c19358ee50 Bug fix involving '\\'. 1986-10-22 13:36:22 +00:00
ceriel
f055d610d3 Completely new version, generating a much faster parser. 1985-11-25 15:47:51 +00:00
ceriel
4d48191bcc The input routine used to skip space. This "feature" has been removed
because it is also used to read strings, in which space is significant.
1984-10-31 15:26:09 +00:00
ceriel
dd1bcb3f60 The routine LLmessage did not insert tokens properly.
This is corrected now.
1984-10-09 09:33:37 +00:00
ceriel
317ab99ecf Changed RCSid 1984-10-08 17:11:03 +00:00
ceriel
a21f936651 Initial revision 1984-10-08 14:14:53 +00:00