[m-rev.] for review: fix library intialisers / finalisers
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed May 17 13:16:37 AEST 2006
On 16-May-2006, Julien Fischer <juliensf at cs.mu.OZ.AU> wrote:
> + io.write_strings(DepStream, [
> + "\t$(MKLIBINIT) -k ", "$(", MakeVarName, ".cs)", " >> ",
> + InitFileName, "\n"
> + ], !IO),
> +
and later
> +# Program used to create the .init file for a library.
> +# This is usually just mkinit invoked with the `-k' option.
> +MKLIBINIT = mkinit
Wouldn't it make more sense to have
MKLIBINIT = mkinit -k
and then delete the -k from after the reference to $(MKLIBINIT) ?
> - do_path_search();
> - output_headers();
> + if (output_lib_init == MR_TRUE) {
> + output_lib_init_file(); /* Output a .init file. */
> + } else {
> + output_init_program(); /* Output a _init.c file. */
> + }
The condition is a bug; it should be
if (output_lib_init)
> - if (need_initialization_code) {
> - printf("#define MR_MAY_NEED_INITIALIZATION\n\n");
> + if (num_errors > 0) {
> + fputs("/* Force syntax error, since there were */\n", stdout);
> + fputs("/* errors in the generation of this file */\n", stdout);
> + fputs("#error \"You need to remake this file\"\n", stdout);
> + if (output_file_name != NULL) {
> + (void) fclose(stdout);
> + (void) remove(output_file_name);
> + }
> + return EXIT_FAILURE;
> + }
> +
> + return EXIT_SUCCESS;
How do you force a syntax error in a .init file?
I think this could should be in output_init_program, and some more tailored
technique should be employed in output_lib_init_file.
Otherwise that looks fine, though I don't know about the -use-mmc-make to
check the changes to that part of the diff in detail.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list