diff --git a/compiler/make.build.m b/compiler/make.build.m index 380fe0740..3bc290d5c 100644 --- a/compiler/make.build.m +++ b/compiler/make.build.m @@ -273,11 +273,11 @@ unredirect_output(Globals, ModuleName, ErrorOutputStream, !Info, !IO) :- ), ( ErrorFileRes = ok(ErrorFileOutputStream), - globals.lookup_int_option(Globals, output_compile_error_lines, - LinesToWrite), + globals.lookup_maybe_int_option(Globals, + output_compile_error_lines, MaybeLinesToWrite), io.output_stream(CurrentOutputStream, !IO), with_locked_stdout(!.Info, - make_write_error_streams(TmpErrorLines, LinesToWrite, + make_write_error_streams(TmpErrorLines, MaybeLinesToWrite, ErrorFileOutputStream, CurrentOutputStream), !IO), io.close_output(ErrorFileOutputStream, !IO), @@ -300,27 +300,33 @@ unredirect_output(Globals, ModuleName, ErrorOutputStream, !Info, !IO) :- ), io.file.remove_file(TmpErrorFileName, _, !IO). -:- pred make_write_error_streams(list(string)::in, int::in, +:- pred make_write_error_streams(list(string)::in, maybe(int)::in, io.text_output_stream::in, io.text_output_stream::in, io::di, io::uo) is det. -make_write_error_streams(InputLines, LinesToWrite, +make_write_error_streams(InputLines, MaybeLinesToWrite, FullOutputStream, PartialOutputStream, !IO) :- list.foldl(write_line_nl(FullOutputStream), InputLines, !IO), - list.split_upto(LinesToWrite, InputLines, - InputLinesToWrite, InputLinesNotToWrite), - list.foldl(write_line_nl(PartialOutputStream), InputLinesToWrite, !IO), ( - InputLinesNotToWrite = [] + MaybeLinesToWrite = no, + list.foldl(write_line_nl(PartialOutputStream), InputLines, !IO) ; - InputLinesNotToWrite = [_ | _], - io.output_stream_name(FullOutputStream, FullOutputFileName, !IO), - % We used to refer to the "error log" being truncated, but - % the compiler's output can also contain things that are *not* - % error messages, with progress messages being one example. - io.format(PartialOutputStream, - "... output log truncated, see `%s' for the complete log.\n", - [s(FullOutputFileName)], !IO) + MaybeLinesToWrite = yes(LinesToWrite), + list.split_upto(LinesToWrite, InputLines, + InputLinesToWrite, InputLinesNotToWrite), + list.foldl(write_line_nl(PartialOutputStream), InputLinesToWrite, !IO), + ( + InputLinesNotToWrite = [] + ; + InputLinesNotToWrite = [_ | _], + io.output_stream_name(FullOutputStream, FullOutputFileName, !IO), + % We used to refer to the "error log" being truncated, but + % the compiler's output can also contain things that are *not* + % error messages, with progress messages being one example. + io.format(PartialOutputStream, + "... output log truncated, see `%s' for the complete log.\n", + [s(FullOutputFileName)], !IO) + ) ). :- pred write_line_nl(io.text_output_stream::in, string::in, diff --git a/compiler/make.module_dep_file.m b/compiler/make.module_dep_file.m index 8fb421400..9419c3b79 100644 --- a/compiler/make.module_dep_file.m +++ b/compiler/make.module_dep_file.m @@ -908,7 +908,7 @@ make_module_dependencies_fatal_error(Globals, OldOutputStream, ErrorStream, % Display the contents of the `.err' file, then remove it % so we don't leave `.err' files lying around for nonexistent modules. - globals.set_option(output_compile_error_lines, int(10000), + globals.set_option(output_compile_error_lines, maybe_int(no), Globals, UnredirectGlobals), unredirect_output(UnredirectGlobals, ModuleName, ErrorStream, !Info, !IO), module_name_to_file_name(Globals, $pred, ext_user(ext_user_err), diff --git a/compiler/options.m b/compiler/options.m index c3874b325..b2f9cfe58 100644 --- a/compiler/options.m +++ b/compiler/options.m @@ -1327,7 +1327,7 @@ optdef(oc_verbosity, verbose_recompilation, bool(no)). optdef(oc_verbosity, find_all_recompilation_reasons, bool(no)). optdef(oc_verbosity, verbose_make, bool(yes)). optdef(oc_verbosity, verbose_commands, bool(no)). -optdef(oc_verbosity, output_compile_error_lines, int(15)). +optdef(oc_verbosity, output_compile_error_lines, maybe_int(yes(15))). optdef(oc_verbosity, report_cmd_line_args, bool(no)). optdef(oc_verbosity, report_cmd_line_args_in_doterr, bool(no)). optdef(oc_verbosity, statistics, bool(no)). @@ -4458,8 +4458,10 @@ options_help_verbosity(Stream, !IO) :- "\tFind all the reasons why a module needs to be recompiled,", "\tnot just the first. Implies `--verbose-recompilation'.", "--output-compile-error-lines ", + "--no-output-compile-error-lines>", "\tWith `--make', output the first lines of the `.err'", "\tfile after compiling a module (default: 15).", + "\tSpecifying --no-output-compile-error-lines removes the limit.", "--report-cmd-line-args-doterr", "\tReport the command line arguments.", "--report-cmd-line-args-in-doterr", diff --git a/doc/user_guide.texi b/doc/user_guide.texi index 445b01e51..3269b34ef 100644 --- a/doc/user_guide.texi +++ b/doc/user_guide.texi @@ -7103,10 +7103,12 @@ not just the first. Implies @samp{--verbose-recompilation}. @sp 1 @item --output-compile-error-lines @var{n} +@item --no-output-compile-error-lines @findex --output-compile-error-lines @findex --make With @samp{--make}, output the first @var{n} lines of the @samp{.err} file after compiling a module (default: 15). +Specifying --no-output-compile-error-lines removes the limit. @sp 1 @item --report-cmd-line-args