Commit graph

93 commits

Author SHA1 Message Date
David Given 25b6712e63 Rework all the ackbuilder scripts not to use wildcards, because we can't expand
them without luaposix, which isn't available (easily) on OSX or Windows.
2022-07-14 23:57:54 +02:00
George Koehler fc1476c88b Add -DDEBUG to enable assertions in util/ego
Our build enables assertions in some other ACK tools (like assemblers
and LLgen), but disabled them in ego until now.  Bug #203 becomes a
failed assertion in ego's SR phase:

    sr: util/ego/sr/sr_reduce.c:483: fix_header: Assertion
    `INSTR(e) == ps_end' failed.

Comment out 2 assertions in util/ego/share, because they fail on
systems with 4-byte int, 8-byte long.
2019-11-14 17:17:24 -05:00
George Koehler 17bc9cdef7 More void, fewer clang warnings in util/ego
Most warnings are for functions implicitly returning int.  Change most
of these functions to return void.  (Traditional K&R C had no void
type, but C89 has it.)

Add prototypes to most function declarations in headers.  This is
easy, because ego declares most of its extern functions, and the
comments listed most parameters.  There were a few outdated or missing
declarations, and a few .c files that failed to include an .h with the
declarations.

Add prototypes to a few function definitions in .c files.  Most
functions still have traditional K&R definitions.  Most STATIC
functions still don't have prototypes, because they have no earlier
declaration where I would have added the prototype.

Change some prototypes in util/ego/share/alloc.h.  Functions newmap()
and oldmap() handle an array of pointers to something; change the
array's type from `short **` to `void **`.  Callers use casts to go
between `void **` and the correct type, like `line_p *`.  Function
oldtable() takes a `short *`, not a `short **`; I added the wrong type
in 5bbbaf4.

Make a few other changes to silence warnings.  There are a few places
where clang wants extra parentheses in the code.

Edit util/ego/ra/build.lua to add the missing dependency on ra*.h; I
needed this to prevent crashes from ra.
2019-11-01 15:27:16 -04:00
George Koehler 36f16b0cb8 Cut down some clang warnings
Edit C code to reduce warnings from clang.  Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().

Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c.  Such changes don't silence warnings; I make
such changes while I silence warnings in the same file.  In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.

Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning.  I wrongly added the `const` in d347207.

For warnings about implicit declarations of functions, the fix is to
declare the function before calling it.  For example, my OpenBSD
system needs <sys/wait.h> to declare wait().

In util/int, add "whatever.h" to declare more functions.  Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
2019-10-30 18:36:38 -04:00
David Given d37749750d More common symbol fixing. 2019-02-10 14:03:55 +01:00
David Given 9e2d45b301 Rename all files called 'aux.*' to something else; Windows can't handle them. 2019-02-09 00:02:41 +01:00
David Given d1cbb9cf60 Crudely bounds check some naked fscanf("%s") parsing. Fixes #79, mostly. 2018-06-02 20:51:41 +02:00
George Koehler 12643f1740 Solve some gcc warnings in ego.
Some of these are from gcc -Wimplicit
2018-03-08 18:51:07 -05:00
George Koehler a7bb4ec4b1 Fixes for compiling ego with -DTRACE
- In share/debug.c, undo my mistake in commit 9037d13 by changing
   vfprintf back to fprintf in OUTTRACE.

 - In ud/ud.c, move the trace output from stdout to stderr, because
   stdout has ego's output file, which becomes opt2's input file.  If
   trace output goes to stdout, it gets prepended to the output file,
   and opt2 errors with "wrong input file".

I also edit both build.lua files so ego depends on its header files;
this part isn't needed for -DTRACE.

One can now use -DTRACE by adding it to the cflags in both build.lua
files.
2018-03-01 13:19:38 -05:00
George Koehler 0a6d3de7fe Use prototypes in ego/cs, ego/sp. 2018-02-05 16:09:30 -05:00
George Koehler d99a0682fc Switch ego to libc <assert.h>
I also tried, in types.h, to switch ego to libc <stdbool.h>, but that
causes an infinite loop in the IL phase.
2017-11-15 19:48:53 -05:00
George Koehler 9037d137f5 Add prototypes, void in util/ego/share
This uncovers a problem in il/il_aux.c: it passes 3 arguments to
getlines(), but the function expects 4 arguments.  I add FALSE as the
4th argument.  TRUE would fill in the list of mesregs.  IL uses
mesregs during phase 1, but this call to getlines() is in phase 2.
TRUE would leak memory unless I added a call to Ldeleteset(mesregs).
So I pass FALSE.

Functions passed to go() now have a `void *` parameter because
no_action() now takes a `void *`.
2017-11-15 17:19:56 -05:00
George Koehler 5bbbaf4919 Use size_t and void with memory allocation in ego.
alloc.h now needs to #include <stdlib.h> to find type size_t and
function free().
2017-11-14 20:35:18 -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 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
George Koehler b1d1b5e1f8 Fix bugs with memory allocation in ego.
cf/cf_loop.c and share/put.c tried to read the next pointer in an
element of a linked list after freeing the element.  ud/ud_copy.c
tried to read beyond the end of the _defs_ array: it only has
_nrexpldefs_ elements, not _nrdefs_ elements.

These bugs caused core dumps on OpenBSD.  Its malloc() put _defs_ near
the end of a page, so reading beyond the end crossed into an unmapped
page.  Its free() wrote junk bytes and changed the next pointer to
0xdfdfdfdfdfdfdfdf.
2016-09-09 23:37:43 -04:00
David Given f67c98e239 Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
2016-09-02 23:00:38 +02:00
David Given 612e38f1c6 Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
2016-09-02 22:17:51 +02:00
David Given 2a95b1c5e3 Forgot to check a file in. 2016-08-22 22:45:32 +02:00
David Given 5bae29a00c ego now builds and is used.
This needed lots of refactoring to ego --- not all platforms have ego descr
files, and ego will just crash if you invoke it without one. I think originally
it was never intended that these platforms would be used at -O2 or above.

Plats now only specify the ego descr file if they have one.
2016-08-21 22:01:19 +02:00
David Given 671bf250f5 Run through clang-format. 2016-08-21 19:46:19 +02:00
David Given a4f136f999 Run through clang-format. 2016-08-21 18:51:36 +02:00
David Given e9233b4712 Build ego.
--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk
2013-05-15 21:14:06 +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
dtrg ee72886e54 Renamed 'switch' variable to avoid conflict with a keyword in modern awks. 2010-08-01 10:35:04 +00:00
dtrg 6a0dd9377d Removed a dynamically generated file from the distribution. 2007-02-25 22:49:22 +00:00
dtrg b611731ec3 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg f371b251d2 Rationalised use of #includes to be more standards-compliant. 2006-07-22 00:46:16 +00:00
dtrg 86e20aa483 Added a concrete definition of nrglobals, because this was not always happening
otherwise.
2006-07-22 00:44:52 +00:00
ceriel 2985469116 Fix: wrong offsets for locals when < -32768, installation error for 'show' 1995-11-08 11:09:14 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel 0c60f4c22f Fixed several lint complaints 1993-11-16 11:35:23 +00:00
ceriel 549dfcc99d Fixed: functions were implicitly declared extern and later static 1993-10-07 17:47:26 +00:00
ceriel a56e1f25ff Was wrong when compiled with ANSI compiler 1992-07-22 13:49:15 +00:00
ceriel 50e8baa624 Removed # in commands, removed call to _cleanup() 1992-06-26 12:42:31 +00:00
ceriel 8394d5a4e1 Added 'extern' 1991-12-12 16:01:46 +00:00
ceriel d747702ae9 Corrected lintlib entry 1991-10-29 09:24:48 +00:00
ceriel e8d165a4a6 cleanup better 1991-10-21 13:26:50 +00:00
ceriel 64eacb4c9f Do not install lintlib by default: maybe lint is not installed yet 1991-10-09 19:12:52 +00:00
ceriel 2b7aae3b44 Added support for volatile 1991-10-02 13:03:31 +00:00
ceriel e5052d73e4 fix: make directory lib.bin/ego 1991-09-13 10:07:37 +00:00
ceriel 3bbf316395 Added Makefile to do a 'make distr' 1991-09-10 09:55:38 +00:00
ceriel 8caa154b25 new installation mechanism 1991-09-06 15:37:13 +00:00
ceriel d9f98bc411 New installation mechanism 1991-08-27 10:18:09 +00:00
ceriel 9f565afcc2 removed unused variable 1991-06-26 17:29:58 +00:00
ceriel ac83fe3815 Removed WORDLENGTH generation program; no longer assume that the machine
on which we compile is the machine on which we run
1991-03-05 13:06:00 +00:00
ceriel 27d53b0d33 Changed #include's 1991-03-05 12:44:05 +00:00
ceriel 2c31a9b1ac removed -i flag 1991-02-19 16:51:50 +00:00
ceriel 1139272435 Changed types in core allocation routines, changed lint flags 1990-12-17 14:55:03 +00:00
ceriel f936a3f35a time optimization is default now 1990-08-01 14:33:08 +00:00