Commit graph

56 commits

Author SHA1 Message Date
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 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 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 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
George Koehler a20b87ca01 In ego, put both words and double-words in reg_float.
The size of a reg_float isn't in the descr file, so ego doesn't know.
PowerPC and SPARC are the only arches with floating-point registers in
their descr files.  PowerPC and SPARC registers can hold both 4-byte
and 8-byte floats, so I want ego to do both sizes.

This might break our SPARC code expander because ego doesn't know that
8-byte values take 2 registers in SPARC.  (So ego might allocate too
many registers and deallocate too much stack space.)  We don't build
the SPARC code expander, and its descr file is already wrong: its list
of register save costs is too short, so ego will read past the end of
the array.

This commit doesn't fix the problem with ego and PowerPC ncg.  Right
now, ncg refuses to put 4-byte floats in registers, but ego expects
them to get registers and deallocates their stack space.  So ncg emits
programs that use the deallocated space, and the values of 4-byte
floats become corrupt.
2017-02-16 19:55:52 -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
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 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 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 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
ceriel c1738933d7 Fix: wrong offsets for locals when < -32768 1995-11-08 11:08:09 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel af5ad235c9 Small change in register allocation criteria 1992-09-01 11:13:42 +00:00
ceriel 45d0d9f68f Removed # in commands 1992-06-26 12:54:57 +00:00
ceriel d20534521e be consistent in naming of itemtab.h 1991-12-12 16:02:59 +00:00
ceriel 35dc8e74d0 Improved lint entry 1991-10-29 09:26:01 +00:00
ceriel 51f8a3b798 cleanup better 1991-10-21 13:59:48 +00:00
ceriel d9f98bc411 New installation mechanism 1991-08-27 10:18:09 +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 335377da7a changed lint flags, use ms_ego, changed allocation strategy for loops 1990-12-18 11:14:34 +00:00
ceriel 3fb20f5201 made produced itemtab.h file more readable 1990-08-20 15:32:29 +00:00
ceriel eb50492a1f #ifdeffed strange test 1990-08-01 14:34:53 +00:00
ceriel 23f2646704 use general as pointer flag added 1989-03-07 10:24:32 +00:00
ceriel 86ace8a020 Fixed lintflags 1989-02-09 11:33:11 +00:00
ceriel 102a2b1061 don't optimize when ms_gto 1987-10-02 12:52:29 +00:00
ceriel 81b1d21c35 Initial revision 1987-04-13 10:32:47 +00:00
ceriel 4fd846804a Seemed to prefer reg_any registers, which caused addresses of procedures
to end up in data registers on the m68020. This is temporarily fixed,
but actually, the descriptor files could be somewhat more general.
1987-04-03 15:38:52 +00:00
ceriel 6eaf182cee Added Rcs Id 1987-03-10 11:49:39 +00:00
ceriel 815166e421 Added copyright notice 1987-03-09 19:15:41 +00:00
ceriel 1583b4191a Added an exit from main 1987-03-09 13:14:32 +00:00
ceriel bc1fb58cd6 SHARE --> SHR 1987-03-02 12:42:38 +00:00
ceriel 17ddf81681 replaced some %D's 1987-02-09 17:28:22 +00:00
ceriel 876369b2f1 Added standard entries 1987-01-13 10:30:06 +00:00
bal 66ab97d2b0 bug fixed: lifetime of an item was too short; it should also cover
any live/dead message prior to its initial live-message.
1985-02-18 15:14:22 +00:00
bal 31eab814f2 Debugging procedure print_allocs now writes to stderr. 1985-01-30 10:52:33 +00:00
bal 7f9dd27dc8 bug fixed: assemble_allocs() did generate whole_procedure allocations.
These allocations were initialized with a very low profit. Consequently
account_regsave rejected these allocations.
Solution: repl_allocs() updates the al_profits field of the
whole_procedure allocation.
1985-01-30 10:47:47 +00:00
bal fefe15a844 init_regcnt renamed initregcnt to avoid name conflict.
bug fixed in routine fits_in(): test on nil-pointer.
routine choose_location(): interface with tmplocal() changed, second
parameter now is a long, so a cast is added.
1985-01-23 16:07:09 +00:00
bal 3d2c33e277 rules for itemtab.h and makeitems added. 1985-01-23 15:50:17 +00:00
bal 2ea3be322d clean_items renamed cleanitems to avoid name conflict.
clean_timeset renamed cleantimeset to avoid name conflict.
bugs fixed: calls to fscanf() with a pointer-to-short as argument
should provide a "%hd" instead of "%d".
1985-01-23 15:45:58 +00:00
bal ffb167e8b2 lay-out enhanced; flags (CFLAGS etc.) inherited from central Makefile;
entry for compiling this phase with ack -O created.
1984-12-21 14:41:47 +00:00
bal 8d659c015f Bug fixed: fill_item() should initialize item->it_desirable to TRUE. 1984-12-04 14:41:20 +00:00
bal 9b72991e27 regsave_cost() return void instead of short. 1984-12-04 13:04:27 +00:00
bal 8db2c12881 regsave_cost() returns void instead of short. 1984-12-04 13:03:49 +00:00
bal 0778ce4a9a Macros for B_DIST, B_USECNT and B_MARK removed, as these fields are
no longer used.
Declarations of nrinstrs and instrmap marked "extern" to satisfy ack compiler.
1984-11-30 10:52:05 +00:00