Commit graph

145 commits

Author SHA1 Message Date
David Given 6778fd05f9 Finally make build on Windows, at least locally. 2022-07-15 22:56:11 +02:00
David Given 98d37492ec Better llgen windowsification. 2022-07-15 00:43:34 +02:00
David Given e7626705f6 Try and make llgen work on Windows. 2022-07-15 00:34:38 +02:00
David Given 99ec64a7a0 Add support for specifying the output directory (avoiding nasty cd tricks when
using it in build scripts).
2022-07-14 01:15:29 +02:00
David Given 8b0a3ac473 Attempt to make work on OSX, and update the build matrix. 2022-06-20 00:18:16 +02:00
Tee-Kiah Chia 9c7ce04cec Fix static buffer overflow in genname( ) in LLgen
This should fix at least some instances of the "undefined
reference to `LLnc_recover'" error that happens in some
builds (https://github.com/davidgiven/ack/issues/218).

The bug was that genname( ) used a static `namebuf' buffer
and did not properly check for overflow when writing into
it.  The result was that the `non_corr' variable was
sometimes overwritten with a non-zero value when it should
be zero, causing bogus results later.

This proposed patch makes genname( ) dynamically allocate
and resize a buffer for holding a target file name.

I also take this chance to fix a typo in correct_prefix().
2021-03-16 17:59:29 +00:00
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 b3814af1ba * Bugfix of "rename" across volumes, now simply copies the file instead. 2019-03-17 23:19:16 +08: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 020e910560 Remember that we need to update the generated file in LLgen, as it's not
self-bootstrapping...
2019-02-10 12:38:33 +01:00
David Given 65e544c35a Don't prototype strcpy as it makes OSX sad. 2019-02-10 12:28:42 +01:00
George Koehler 33c0573598 Remove code to calculate memory usage with sbrk().
In many systems, malloc() can allocate outside the brk area.  The
calculation with sbrk() misses those allocations.  When LLgen or ncgg
reported the memory usage, the value was probably too low.
2018-11-14 16:13:54 -05: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 64f2fa9d46 Stop using mktemp() --- on Haiku, it always generates the same filenames,
pretty much guaranteeing temporary file overwrites on parallel builds. Use
mkstemp() instead which creates the files atomically.
2017-08-06 13:22:05 +02:00
David Given 7435c06ff4 Non-standard stdlib prototypes are not our friend (and not OSX's friend, which
implements strcpy() &co as macros).
2016-11-24 20:48:51 +01: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
George Koehler 0131ca4d46 Delete 689 undead files.
These files "magically reappeared" after the conversion from CVS to
Mercurial.  The old CVS repository deleted these files but did not
record *when* it deleted these files.  The conversion resurrected these
files because they have no history of deletion.  These files were
probably deleted before year 1995.  The CVS repository begins to record
deletions around 1995.

These files may still appear in older revisions of this Mercurial
repository, when they should already be deleted.  There is no way to fix
this, because the CVS repository provides no dates of deletion.

See http://sourceforge.net/mailarchive/message.php?msg_id=29823032
2012-09-20 22:26:32 -04:00
David Given b6dfaefeff Removed file that the CVS conversion procedure left in (when it shouldn't have). 2011-03-20 20:47:10 +00:00
dtrg 26a9b76507 Added pregenerated versions of the LLgen source files (to ease
bootstrapping issues).
2007-02-24 02:01:57 +00:00
dtrg 7068d0d301 Modified to use rename() instead of link()/unlink() to rename files. 2006-07-25 23:24:20 +00:00
dtrg e864bf235e Split LLgen off to be self-contained, and not necessarily part of the ACK. Replaced its build system with one based on pm. Rewrote the README. Updated the license text to match the overriding license common to all the ACK. 2006-02-04 00:57:04 +00:00
dtrg dd57d79b1b Modernised usage of system header files. 2006-02-04 00:37:19 +00:00
dtrg 71a92846dd Modernised usage of system header files. 2006-02-03 22:23:37 +00:00
dtrg c39e85da63 Modernised usage of system header files. Changed the patch buffer (which allowed the library path to be modified with a hex editor) to an environment variable instead. 2006-02-03 22:23:11 +00:00
ceriel 8f69a0ca44 Fix 2002-09-11 13:32:57 +00:00
ceriel 1e32788ad1 Added missing files to .distr 2002-09-11 13:17:00 +00:00
ceriel ee2c7069e4 Prevent double fclose 2002-08-26 14:27:15 +00:00
ceriel 4556d261d8 ??? 2002-04-04 12:33:15 +00:00
ceriel d6e0e461f7 Corrected Makefile 1997-09-04 15:49:46 +00:00
ceriel f8fd2aa273 Removed superfluous ; 1997-06-16 13:07:37 +00:00
ceriel cebde164bb Prevent warning about unused labels 1997-04-02 10:42:06 +00:00
ceriel 8ea5d257c4 improved error reporting, added -DNON_CORRECTING 1997-02-21 15:44:44 +00:00
ceriel 13fea7102b Updated 1997-02-21 12:23:04 +00:00
ceriel c2607fdf0f Added non-correcting error recovery stuff 1997-02-21 11:27:57 +00:00
ceriel a44875cf00 bug fix: code referred to token attribute of wrong token! 1997-02-17 15:14:55 +00:00
ceriel a44bbb3977 Fixed a couple of minor bugs 1996-11-19 13:27:56 +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 d1435f4fc6 Added an option to strip the grammar from its actions 1995-02-24 12:10:44 +00:00
ceriel 68cebfb733 do not allow ',' as separator in parameter declarations; this results in bad C-code 1994-12-20 12:47:48 +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 7e30c7d648 Fixed for empty parameter lists 1993-05-10 14:02:52 +00:00
ceriel ca4461dc4c Added LL_MAXTOKNO 1992-11-19 15:37:52 +00:00
ceriel 06e487359b Changed mechanism for coputing amount of memory used 1992-06-26 12:38:10 +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