Commit graph

53 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
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
David Given
c1aca7dae5 First milestone of replacing the build system.
--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
2013-05-12 20:45:55 +01:00
ceriel
4556d261d8 ??? 2002-04-04 12:33:15 +00:00
ceriel
cebde164bb Prevent warning about unused labels 1997-04-02 10:42:06 +00:00
ceriel
c2607fdf0f Added non-correcting error recovery stuff 1997-02-21 11:27:57 +00:00
ceriel
a8b1f8e347 Header file was included twice 1995-11-01 15:59:33 +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
5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel
2b54fa3a19 Fix: also redefine LLsafeerror 1994-06-23 09:58:30 +00:00
ceriel
958aced01b Generate octal char constants instead of ints for LLsets 1994-04-12 13:53:38 +00:00
ceriel
ca4461dc4c Added LL_MAXTOKNO 1992-11-19 15:37:52 +00:00
ceriel
df1ed9426d Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:28:58 +00:00
ceriel
9e2361fc8f bug fix in generating prototypes 1991-12-03 10:56:40 +00:00
ceriel
7ec968fb03 Always also produce ANSI-C, depending on __STDC__ and __cplusplus 1991-12-02 09:15:04 +00:00
ceriel
505494c560 Improved for lint 1991-11-27 13:38:51 +00:00
ceriel
35260bae58 produce ANSI C under -a option 1991-11-26 15:38:41 +00:00
ceriel
6fa0e5bfb0 Changed copyright notice, made installation less dependent on ACK 1991-11-23 10:41:43 +00:00
ceriel
03e1bea097 Added some tests and changed ordering mechanism 1991-11-01 10:37:26 +00:00
ceriel
b1fdacb99c relaxed the ;-terminator requirement for parameters 1991-08-23 16:23:07 +00:00
ceriel
1903555355 fixed bug with -j option 1991-02-28 14:48:17 +00:00
ceriel
8401d7b9ec Did not handle quotes in C comments right 1990-08-23 15:53:13 +00:00
ceriel
e361a5777b remove LLlex #define 1990-02-07 10:53:05 +00:00
ceriel
da48891d6e allow for multiple parsers within one program 1990-01-29 13:45:42 +00:00
ceriel
9ad5d4b5e0 generate ; after label 1989-11-17 13:15:48 +00:00
ceriel
cf65fbe6a1 a simple optimization added 1989-10-18 09:22:47 +00:00
ceriel
2deb5cafce remove empty-producing nonterminals 1988-08-23 16:05:19 +00:00
ceriel
1c801f86eb minor mod: name change 1988-06-24 14:28:13 +00:00
ceriel
71834855e8 generate #define for LL_LEXI in every file 1988-06-24 14:21:07 +00:00
ceriel
e1f7d20251 modified generation of token mapping somewhat 1988-06-24 11:48:10 +00:00
ceriel
d20bfe4f68 some tables are static now 1988-06-24 09:32:15 +00:00
ceriel
4934f830fc Added code to generate dense switches 1988-06-22 16:23:36 +00:00
ceriel
e0a4fd1989 some cosmetic changes 1988-06-16 15:06:09 +00:00
ceriel
9dccd59665 Added patch for bad fseeks 1988-03-23 18:04:08 +00:00
ceriel
3ea06a4a2a ran out of another static list; made length dynamic 1987-08-07 14:35:21 +00:00
ceriel
6439f09220 fixed a subtle bug: in some obscure cases involving conflict resolvers and
defaults, wrong code was generated
1987-08-05 12:52:15 +00:00
ceriel
25dd5857c2 minor changes to many files 1987-06-03 19:05:14 +00:00
ceriel
985a52b415 some bug fixes 1987-05-12 18:23:09 +00:00
ceriel
4805d67ca1 -only generate warnings when there are conflict resolvers but no conflicts,
-handle "onerror" differently
1987-04-13 16:11:50 +00:00
ceriel
717af548d5 improved userhook handling, requiring a change in LLnext and LLskip 1987-03-17 22:50:40 +00:00
ceriel
21b427d4df made just a little bit more robust 1987-03-12 22:29:25 +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
74b078c3f1 just for fun: do not call empty rules. 1987-02-05 19:14:55 +00:00
ceriel
c501c762cf removed the -n flag, but not its effect. The generated parser will
call LLmessage(-1) when saying "garbage at end of input".
1986-12-10 09:32:57 +00:00
ceriel
ee27adc926 Added nflag, that allows the LLmessage(-1) call, to indicate garbage
at end of program.
1986-10-29 11:27:47 +00:00
ceriel
f055d610d3 Completely new version, generating a much faster parser. 1985-11-25 15:47:51 +00:00
ceriel
aab6140bfa different interface. 1985-10-03 17:19:14 +00:00