Commit Graph

4 Commits

Author SHA1 Message Date
Peter Wang
544f3bf095 Use musl getopt implementation.
LICENSE:
    Mention files derived from musl library.

runtime/process_getopt:
    Process files from ../getopt/*.[ch] to produce
    mercury_getopt.h, mercury_getopt.c, mercury_getopt_long.c.

runtime/mercury_getopt.h:
runtime/mercury_getopt.c:
runtime/mercury_getopt_long.c:
    Add files generated by process_getopt.

runtime/Mmakefile:
    Update list of source files.

util/Mmakefile:
    Use musl getopt if the system C library does not have getopt().

tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
tests/debugger/browser_test.exp3:
tests/hard_coded/runtime_opt.exp:
    Update expected error messages to match new getopt() output.

changed exp output
2019-06-10 13:30:49 +10:00
Fergus Henderson
779b47f4f2 Various bug fixes and cleanups for the code in the runtime directory.
Estimated hours taken: 2

Various bug fixes and cleanups for the code in the runtime directory.

runtime/mercury_bootstrap.h:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
runtime/mercury_type_info.h:
	Move #defines that are there just for backwards compatibility
	into mercury_bootstrap.h.

runtime/process_getopt:
	Add MR_ prefixes to the names `_GETOPT_H', `no_arguments',
	and `required_argument' which are defined by mercury_getopt.h,
	to make mercury_getopt.h macro-namespace-clean.

runtime/mercury_getopt.h:
	Apply the new version of the process_getopt script.

runtime/mercury_imp.h:
	Make mercury_bootstrap the first header file that is #included,
	in case some of the macros defined in it are used in declarations
	in other header files.

runtime/mercury_memory.h:
	Delete duplicate definitions of MAX_REAL_REG, NUM_SPECIAL_REG,
	and MAX_VIRTUAL_REG -- these are all already defined in
	mercury_memory_zones.h.

runtime/mercury_memory_zones.h:
	Delete definition of NUM_SPECIAL_REG, since mercury_regorder.h
	already defines MR_NUM_SPECIAL_REG, which should be used instead
	of NUM_SPECIAL_REG.  The value of NUM_SPECIAL_REG was long
	obsolete.

runtime/mercury_regorder.h:
	Fix some bugs in the definition of MR_min_sol_hp_rec -- it was
	using `mr40', which is undefined, instead of `mr(40)'.
	Also add some comments.

runtime/mercury_regs.h:
	Fix a bug: use MR_NUM_SPECIAL_REGS instead of NUM_SPECIAL_REGS.
	Note that this bug fix unfortunately breaks backwards compatibility,
	at least for procedures with more than 32 arguments, since it
	affects the mapping from r(N) to the fake_reg array.
	However, there was no alternative, since the old mapping was
	broken: for example, the old mapping used the same fake_reg
	slot for both r(41) and MR_global_hp.

runtime/mercury_bootstrap.h:
	Change MR_GRADE_PART_0 from `redofr' to `v1', and document that
	that part of the grade is a binary compatibility version number.
	The reason for changing the grade is to ensure that the change
	in binary backwards compatibility resulting from the changes
	to runtime/mercury_regs.h will cause link errors rather
	than just random behaviour for procedures with >32 arguments.

runtime/mercury_agc_debug.c:
	Use MR_NUM_SPECIAL_REGS instead of NUM_SPECIAL_REGS.
	Also add some XXX comments, since all of the places where
	NUM_SPECIAL_REGS was used are broken anyway -- they should be
	using MAX_FAKE_REG instead of MAX_REAL_REG + NUM_SPECIAL_REG.
	But I think the current definition is put there for efficiency,
	even though it's known to be broken for procedures with >32
	arguments, so I didn't change the code to use MAX_FAKE_REG.
1998-11-09 14:35:40 +00:00
Zoltan Somogyi
45bdceb363 Add the files as produced by process_getopt.
Estimated hours taken: 1

runtime/mercury_getopt.c:
runtime/mercury_getopt1.c:
	Add the files as produced by process_getopt.

runtime/process_getopt:
runtime/mercury_getopt.h:
	Avoid a warning if the environment already defines __GNU_LIBRARY__,
	and prevent this from omitting the entire bodies of the source files
	:-(.

util/getopt.h:
	A copy of the old mercury_getopt.h for mkinit.c

util/mkinit.c:
	Include getopt.h instead of mercury_getopt.h, since we want getopt(),
	not MR_getopt().
1998-08-11 06:23:29 +00:00
Zoltan Somogyi
137ce69e7a Bring the handling of MERCURY_OPTION into the 90s (a bit late :-).
Estimated hours taken: 5

Bring the handling of MERCURY_OPTION into the 90s (a bit late :-).

Get rid of lack-of-prototype warnings from getopt.h.

runtime/getopt.[ch]:
runtime/getopt1.c:
runtime/GETOPT:
runtime/GETOPT/getopt.[ch]:
runtime/GETOPT/getopt1.c:
	Move these files to a new subdirectory, GETOPT. This should avoid
	the nuisance warnings one gets when stdlib.h picks up the getopt.h
	in the runtime directory by accident. (The GETOPT directory should
	never need to be included in -I search paths.)

runtime/mercury_getopt.[ch]:
runtime/mercury_getopt1.c:
	Copies of the files in GETOPT, slightly modified to make sure that
	(1) every external symbol they define starts with MR_, and (2)
	we get a minimal number of compilation errors (as of now, 3 warnings
	about casting away const).

	These files are not to be modified by humans.

runtime/process_getopt:
	This is the script that creates mercury_getopt{.h,.c,1.c} from the
	files in GETOPT.

runtime/mercury_wrapper.c:
	Get rid of the -s<area><size> notation, which can hard to remember,
	and replace it with long options such as --heap-size=1024.

	Print an error message and stop if MERCURY_OPTIONS contains anything
	other than options.

	Refer to everything from mercury_getopt.h with a name that starts with
	MR_.

runtime/Mmakefile:
	Mention the new source files.

doc/user_guide.texi:
	Document the new options.

NEWS:
	Mention the new options.
1998-08-10 07:18:25 +00:00