diff options
35 files changed, 138 insertions, 35 deletions
@@ -89,6 +89,9 @@ Other libraries: Ocamlbuild: - Add support for native dynlink. +All tools: +- PR#4857: add a -vnum option to display the version number and nothing else + Bug Fixes: - PR#4742: finalisation function raising an exception blocks other finalisations - PR#4775: compiler crash on crazy types (temporary fix) diff --git a/boot/ocamlc b/boot/ocamlc Binary files differindex 139afff68c..38b6bb9a75 100755 --- a/boot/ocamlc +++ b/boot/ocamlc diff --git a/boot/ocamldep b/boot/ocamldep Binary files differindex ec1dc9a8bb..14034fbf26 100755 --- a/boot/ocamldep +++ b/boot/ocamldep diff --git a/boot/ocamllex b/boot/ocamllex Binary files differindex 485d9d9165..d60895f3e0 100755 --- a/boot/ocamllex +++ b/boot/ocamllex diff --git a/byterun/startup.c b/byterun/startup.c index f954e3ee52..b69c04f220 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -249,6 +249,9 @@ static int parse_command_line(char **argv) if (!strcmp (argv[i], "-version")){ printf ("The Objective Caml runtime, version " OCAML_VERSION "\n"); exit (0); + }else if (!strcmp (argv[i], "-vnum")){ + printf (OCAML_VERSION "\n"); + exit (0); }else{ caml_verb_gc = 0x001+0x004+0x008+0x010+0x020; } diff --git a/camlp4/Camlp4Bin.ml b/camlp4/Camlp4Bin.ml index 8658d9f850..78fd273480 100644 --- a/camlp4/Camlp4Bin.ml +++ b/camlp4/Camlp4Bin.ml @@ -264,6 +264,8 @@ value initial_spec_list = "Print Camlp4 version and exit."); ("-version", Arg.Unit just_print_the_version, "Print Camlp4 version number and exit."); + ("-vnum", Arg.Unit just_print_the_version, + "Print Camlp4 version number and exit."); ("-no_quot", Arg.Clear Camlp4_config.quotations, "Don't parse quotations, allowing to use, e.g. \"<:>\" as token."); ("-loaded-modules", Arg.Set print_loaded_modules, "Print the list of loaded modules."); diff --git a/camlp4/mkcamlp4.ml b/camlp4/mkcamlp4.ml index e5853503de..6c6b4b245f 100644 --- a/camlp4/mkcamlp4.ml +++ b/camlp4/mkcamlp4.ml @@ -31,6 +31,8 @@ value (interfaces, options, includes) = | ["-I"; dir :: args] -> self (interf, opts, [dir; "-I" :: incl]) args | ["-version" :: _] -> do { printf "mkcamlp4, version %s@." version; exit 0 } + | ["-vnum" :: _] -> + do { printf "%s@." version; exit 0 } | [ arg :: args ] when check_suffix arg ".cmi" -> let basename = String.capitalize (Filename.chop_suffix (Filename.basename arg) ".cmi") in diff --git a/debugger/main.ml b/debugger/main.ml index f836bf9f0e..f5f0d8b556 100644 --- a/debugger/main.ml +++ b/debugger/main.ml @@ -161,6 +161,10 @@ let print_version () = printf "The Objective Caml debugger, version %s@." Sys.ocaml_version; exit 0; ;; +let print_version_num () = + printf "%s@." Sys.ocaml_version; + exit 0; +;; let speclist = [ "-c", Arg.Int set_checkpoints, @@ -175,6 +179,8 @@ let speclist = [ "<filename> Set the name of the communication socket"; "-version", Arg.Unit print_version, " Print version and exit"; + "-vnum", Arg.Unit print_version_num, + " Print version number and exit"; ] let main () = diff --git a/driver/main.ml b/driver/main.ml index 18480739f0..09aa89655e 100644 --- a/driver/main.ml +++ b/driver/main.ml @@ -127,6 +127,7 @@ module Options = Main_args.Make_bytecomp_options (struct let _use_runtime s = use_runtime := s let _v = print_version_and_library let _version = print_version_string + let _vnum = print_version_string let _w = (Warnings.parse_options false) let _warn_error = (Warnings.parse_options true) let _warn_help = Warnings.help_warnings diff --git a/driver/main_args.ml b/driver/main_args.ml index 8af9193289..578367f3bb 100644 --- a/driver/main_args.ml +++ b/driver/main_args.ml @@ -246,6 +246,10 @@ let mk_version f = "-version", Arg.Unit f, " Print version and exit" ;; +let mk_vnum f = + "-vnum", Arg.Unit f, " Print version number and exit" +;; + let mk_verbose f = "-verbose", Arg.Unit f, " Print calls to external commands" ;; @@ -405,6 +409,7 @@ module type Bytecomp_options = sig val _use_runtime : string -> unit val _v : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _verbose : unit -> unit val _w : string -> unit val _warn_error : string -> unit @@ -435,6 +440,7 @@ module type Bytetop_options = sig val _strict_sequence : unit -> unit val _unsafe : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _w : string -> unit val _warn_error : string -> unit val _warn_help : unit -> unit @@ -486,6 +492,7 @@ module type Optcomp_options = sig val _unsafe : unit -> unit val _v : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _verbose : unit -> unit val _w : string -> unit val _warn_error : string -> unit @@ -530,6 +537,7 @@ module type Opttop_options = sig val _S : unit -> unit val _unsafe : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _w : string -> unit val _warn_error : string -> unit val _warn_help : unit -> unit @@ -603,6 +611,7 @@ struct mk_use_runtime_2 F._use_runtime; mk_v F._v; mk_version F._version; + mk_vnum F._vnum; mk_verbose F._verbose; mk_vmthread F._vmthread; mk_w F._w; @@ -637,6 +646,7 @@ struct mk_strict_sequence F._strict_sequence; mk_unsafe F._unsafe; mk_version F._version; + mk_vnum F._vnum; mk_w F._w; mk_warn_error F._warn_error; mk_warn_help F._warn_help; @@ -692,6 +702,7 @@ struct mk_unsafe F._unsafe; mk_v F._v; mk_version F._version; + mk_vnum F._vnum; mk_verbose F._verbose; mk_w F._w; mk_warn_error F._warn_error; @@ -736,6 +747,7 @@ module Make_opttop_options (F : Opttop_options) = struct mk_strict_sequence F._strict_sequence; mk_unsafe F._unsafe; mk_version F._version; + mk_vnum F._vnum; mk_w F._w; mk_warn_error F._warn_error; mk_warn_help F._warn_help; diff --git a/driver/main_args.mli b/driver/main_args.mli index e0a7e2fa96..1c4abf5097 100644 --- a/driver/main_args.mli +++ b/driver/main_args.mli @@ -51,6 +51,7 @@ module type Bytecomp_options = val _use_runtime : string -> unit val _v : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _verbose : unit -> unit val _w : string -> unit val _warn_error : string -> unit @@ -82,6 +83,7 @@ module type Bytetop_options = sig val _strict_sequence : unit -> unit val _unsafe : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _w : string -> unit val _warn_error : string -> unit val _warn_help : unit -> unit @@ -133,6 +135,7 @@ module type Optcomp_options = sig val _unsafe : unit -> unit val _v : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _verbose : unit -> unit val _w : string -> unit val _warn_error : string -> unit @@ -177,6 +180,7 @@ module type Opttop_options = sig val _S : unit -> unit val _unsafe : unit -> unit val _version : unit -> unit + val _vnum : unit -> unit val _w : string -> unit val _warn_error : string -> unit val _warn_help : unit -> unit diff --git a/driver/optmain.ml b/driver/optmain.ml index 51a9162d63..1c7352c527 100644 --- a/driver/optmain.ml +++ b/driver/optmain.ml @@ -135,6 +135,7 @@ module Options = Main_args.Make_optcomp_options (struct let _unsafe = set fast let _v () = print_version_and_library () let _version () = print_version_string () + let _vnum () = print_version_string () let _verbose = set verbose let _w s = Warnings.parse_options false s let _warn_error s = Warnings.parse_options true s diff --git a/lex/main.ml b/lex/main.ml index 5540c97285..57b404904c 100644 --- a/lex/main.ml +++ b/lex/main.ml @@ -28,6 +28,11 @@ let print_version_string () = print_string Sys.ocaml_version ; print_newline(); exit 0 +let print_version_num () = + print_endline Sys.ocaml_version; + exit 0; +;; + let specs = ["-ml", Arg.Set ml_automata, " Output code that does not use the Lexing module built-in automata interpreter"; @@ -36,6 +41,7 @@ let specs = "-q", Arg.Set Common.quiet_mode, " Do not display informational messages"; "-v", Arg.Unit print_version_string, " Print version and exit"; "-version", Arg.Unit print_version_string, " Print version and exit"; + "-vnum", Arg.Unit print_version_num, " Print version number and exit"; ] let _ = diff --git a/man/ocaml.m b/man/ocaml.m index 299f3fa36e..f8ca062d0c 100644 --- a/man/ocaml.m +++ b/man/ocaml.m @@ -135,6 +135,9 @@ accesses an array or string outside of its bounds. .B \-version Print version string and exit. .TP +.B \-vnum +Print short version number and exit. +.TP .BI \-w \ warning-list Enable or disable warnings according to the argument .IR warning-list . diff --git a/man/ocamlc.m b/man/ocamlc.m index 8ef3ddfc96..fbddac15d9 100644 --- a/man/ocamlc.m +++ b/man/ocamlc.m @@ -476,7 +476,7 @@ invocations of the C compiler and linker in .B \-custom mode. Useful to debug C library problems. .TP -.B \-version +.BR \-vnum or \-version Print the version number of the compiler in short form (e.g. "3.11.0"), then exit. .TP diff --git a/man/ocamldebug.m b/man/ocamldebug.m index eb8619ba40..d527fe870a 100644 --- a/man/ocamldebug.m +++ b/man/ocamldebug.m @@ -6,7 +6,7 @@ ocamldebug \- the Objective Caml source-level replay debugger. .SH SYNOPSIS .B ocamldebug -.I "[options] program [arguments]" +.RI [\ options \ ]\ program \ [\ arguments \ ] .SH DESCRIPTION .B ocamldebug is the Objective Caml source-level replay debugger. @@ -69,7 +69,10 @@ for the format of .IR socket . .TP .B \-version -Print version and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .BR \-help \ or \ \-\-help Display a short usage summary and exit. diff --git a/man/ocamldep.m b/man/ocamldep.m index 9dfd55db95..d04e8cae2d 100644 --- a/man/ocamldep.m +++ b/man/ocamldep.m @@ -99,7 +99,10 @@ as a preprocessor for each source file. Under Unix, this option does nothing. .TP .B \-version -Print version and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .BR \-help \ or \ \-\-help Display a short usage summary and exit. diff --git a/man/ocamldoc.m b/man/ocamldoc.m index 19a7f03321..bb65a7fc37 100644 --- a/man/ocamldoc.m +++ b/man/ocamldoc.m @@ -243,7 +243,10 @@ For HTML, the file is used to create the whole "index.html" file. Verbose mode. Display progress information. .TP .B \-version -Print the version string and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .B \-warn\-error Treat Ocamldoc warnings as errors. diff --git a/man/ocamllex.m b/man/ocamllex.m index c3b3e308a9..e117dc474b 100644 --- a/man/ocamllex.m +++ b/man/ocamllex.m @@ -72,7 +72,10 @@ to standard output. They are suppressed if option is used. .TP .BR \-v \ or \ \-version -Print version and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .BR \-help \ or \ \-\-help Display a short usage summary and exit. diff --git a/man/ocamlmktop.m b/man/ocamlmktop.m index 8127d70d58..d84381e154 100644 --- a/man/ocamlmktop.m +++ b/man/ocamlmktop.m @@ -7,7 +7,7 @@ ocamlmktop \- Building custom toplevel systems .SH SYNOPSIS .B ocamlmktop [ -.B \-v +.BR \-v | \-version | \-vnum ] [ .BI \-cclib \ libname @@ -49,7 +49,10 @@ The following command-line options are recognized by .BR ocamlmktop (1). .TP .B \-v -Print the version number of the compiler. +Print the version string of the compiler and exit. +.TP +.BR \-vnum or \-version +Print the version number of the compiler in short form and exit. .TP .BI \-cclib\ \-l libname Pass the diff --git a/man/ocamlopt.m b/man/ocamlopt.m index 831f30d0d4..c021fab6e8 100644 --- a/man/ocamlopt.m +++ b/man/ocamlopt.m @@ -457,7 +457,7 @@ standard library directory, then exit. Print all external commands before they are executed, in particular invocations of the assembler, C compiler, and linker. .TP -.B \-version +.BR \-vnum or \-version Print the version number of the compiler in short form (e.g. "3.11.0"), then exit. .TP diff --git a/man/ocamlprof.m b/man/ocamlprof.m index 84d01b0631..f92ab8e442 100644 --- a/man/ocamlprof.m +++ b/man/ocamlprof.m @@ -7,10 +7,7 @@ ocamlprof \- The Objective Caml profiler .SH SYNOPSIS .B ocamlprof [ -.BI \-f \ dump-file -] -[ -.BI \-F \ text +.I options ] .I filename ... @@ -61,7 +58,10 @@ Compile the file as an interface file, even if its extension is not .mli. .TP .B \-version -Print the version number of ocamlprof and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .BR \-help \ or \ \-\-help Display a short usage summary and exit. diff --git a/man/ocamlrun.m b/man/ocamlrun.m index 6b7c5dfc95..d7e7f037f5 100644 --- a/man/ocamlrun.m +++ b/man/ocamlrun.m @@ -72,7 +72,10 @@ This is equivalent to setting in the OCAMLRUNPARAM environment variable (see below). .TP .B \-version -Print version and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .SH ENVIRONMENT VARIABLES diff --git a/man/ocamlyacc.m b/man/ocamlyacc.m index e3b69441fd..232b17273b 100644 --- a/man/ocamlyacc.m +++ b/man/ocamlyacc.m @@ -7,10 +7,15 @@ ocamlyacc \- The Objective Caml parser generator .SH SYNOPSIS .B ocamlyacc [ -.B -v -] -[ .BI \-b prefix +] [ +.B \-q +] [ +.B \-v +] [ +.B \-version +] [ +.B \-vnum ] .I filename.mly @@ -67,7 +72,10 @@ file .IR grammar .output. .TP .B \-version -Print version and exit. +Print version string and exit. +.TP +.B \-vnum +Print short version number and exit. .TP .B \- Read the grammar specification from standard input. The default diff --git a/ocamlbuild/options.ml b/ocamlbuild/options.ml index 9d3ed21cd3..0256d43acb 100644 --- a/ocamlbuild/options.ml +++ b/ocamlbuild/options.ml @@ -131,6 +131,8 @@ let spec = Arg.align [ "-version", Unit (fun () -> print_endline version; raise Exit_OK), " Display the version"; + "-vnum", Unit (fun () -> print_endline Sys.ocaml_version; raise Exit_OK), + " Display the version number"; "-quiet", Unit (fun () -> Log.level := 0), " Make as quiet as possible"; "-verbose", Int (fun i -> Log.level := i + 2), "<level> Set the verbosity level"; "-documentation", Set show_documentation, " Show rules and flags"; diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml index 3ed7039f06..26af27d9f3 100644 --- a/ocamldoc/odoc_args.ml +++ b/ocamldoc/odoc_args.ml @@ -212,6 +212,8 @@ let default_dot_generator = ref (None : doc_generator option) (** The default option list *) let options = ref [ "-version", Arg.Unit (fun () -> print_string M.message_version ; print_newline () ; exit 0) , M.option_version ; + "-vnum", Arg.Unit (fun () -> print_string M.config_version ; + print_newline () ; exit 0) , M.option_version ; "-v", Arg.Unit (fun () -> verbose := true), M.verbose_mode ; "-I", Arg.String (fun s -> include_dirs := (Misc.expand_directory Config.standard_library s) :: !include_dirs), M.include_dirs ; "-pp", Arg.String (fun s -> preprocessor := Some s), M.preprocess ; diff --git a/otherlibs/labltk/browser/main.ml b/otherlibs/labltk/browser/main.ml index e55ce989a5..181506960a 100644 --- a/otherlibs/labltk/browser/main.ml +++ b/otherlibs/labltk/browser/main.ml @@ -53,6 +53,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + printf "%s\n" Sys.ocaml_version; + exit 0; +;; + let usage ~spec errmsg = let b = Buffer.create 1024 in bprintf b "%s\n" errmsg; @@ -80,22 +85,9 @@ let _ = " Allow arbitrary recursive types"; "-version", Arg.Unit print_version, " Print version and exit"; + "-vnum", Arg.Unit print_version_num, " Print version number and exit"; "-w", Arg.String (fun s -> Shell.warnings := s), - "<flags> Enable or disable warnings according to <flags>:\n\ - \032 A/a enable/disable all warnings\n\ - \032 C/c enable/disable suspicious comment\n\ - \032 D/d enable/disable deprecated features\n\ - \032 E/e enable/disable fragile match\n\ - \032 F/f enable/disable partially applied function\n\ - \032 L/l enable/disable labels omitted in application\n\ - \032 M/m enable/disable overriden method\n\ - \032 P/p enable/disable partial match\n\ - \032 S/s enable/disable non-unit statement\n\ - \032 U/u enable/disable unused match case\n\ - \032 V/v enable/disable hidden instance variable\n\ - \032 X/x enable/disable all other warnings\n\ - \032 default setting is \"Ale\"\n\ - \032 (all warnings but labels and fragile match enabled)"; ] + "<flags> Enable or disable warnings according to <flags>"; ] and errmsg = "Command line: ocamlbrowser <options>" in if not (check ~spec Sys.argv) then fatal_error (usage ~spec errmsg); Arg.parse spec diff --git a/tools/Makefile.shared b/tools/Makefile.shared index d4e61befa4..b128ffbf3e 100644 --- a/tools/Makefile.shared +++ b/tools/Makefile.shared @@ -23,7 +23,7 @@ INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \ COMPFLAGS= -warn-error A $(INCLUDES) LINKFLAGS=$(INCLUDES) -all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib dumpobj +all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib dumpobj objinfo # scrapelabels addlabels .PHONY: all diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml index a2232dc15d..a86ae352fc 100644 --- a/tools/ocamlcp.ml +++ b/tools/ocamlcp.ml @@ -81,6 +81,7 @@ module Options = Main_args.Make_bytecomp_options (struct let _use_runtime s = option_with_arg "-use-runtime" s let _v = option "-v" let _version = option "-version" + let _vnum = option "-vnum" let _verbose = option "-verbose" let _w = option_with_arg "-w" let _warn_error = option_with_arg "-warn-error" diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml index e18d6b0a7d..72e03e91f9 100644 --- a/tools/ocamldep.ml +++ b/tools/ocamldep.ml @@ -279,6 +279,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + printf "%s@." Sys.ocaml_version; + exit 0; +;; + let _ = Clflags.classic := false; add_to_load_path Filename.current_dir_name; @@ -299,5 +304,7 @@ let _ = " (Windows) Use forward slash / instead of backslash \\ in file paths"; "-version", Arg.Unit print_version, " Print version and exit"; + "-vnum", Arg.Unit print_version_num, + " Print version number and exit"; ] file_dependencies usage; exit (if !error_occurred then 2 else 0) diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp index 80c1d9f4a5..737749c17f 100644 --- a/tools/ocamlmklib.mlp +++ b/tools/ocamlmklib.mlp @@ -52,6 +52,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + printf "%s\n" Sys.ocaml_version; + exit 0; +;; + let parse_arguments argv = let i = ref 1 in let next_arg () = @@ -116,6 +121,8 @@ let parse_arguments argv = verbose := true else if s = "-version" then print_version () + else if s = "-vnum" then + print_version_num () else if starts_with s "-F" then c_opts := s :: !c_opts else if s = "-framework" then @@ -160,6 +167,7 @@ Options are:\n\ -verbose Print commands before executing them\n\ -v same as -verbose\n\ -version Print version and exit\n\ + -vnum Print version number and exit\n\ -Wl,-rpath,<dir> Same as -dllpath <dir>\n\ -Wl,-rpath -Wl,<dir> Same as -dllpath <dir>\n\ -Wl,-R<dir> Same as -dllpath <dir>\n\ diff --git a/tools/ocamlprof.ml b/tools/ocamlprof.ml index 55f114c5ea..e561f60e62 100644 --- a/tools/ocamlprof.ml +++ b/tools/ocamlprof.ml @@ -459,6 +459,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + printf "%s@." Sys.ocaml_version; + exit 0; +;; + let main () = try Warnings.parse_options false "a"; @@ -475,6 +480,8 @@ let main () = "-m", Arg.String (fun s -> modes := s), "<flags> (undocumented)"; "-version", Arg.Unit print_version, " Print version and exit"; + "-vnum", Arg.Unit print_version_num, + " Print version number and exit"; ] process_anon_file usage; exit 0 with x -> diff --git a/toplevel/opttopmain.ml b/toplevel/opttopmain.ml index 388e725786..bd27abb760 100644 --- a/toplevel/opttopmain.ml +++ b/toplevel/opttopmain.ml @@ -53,6 +53,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + Printf.printf "%s\n" Sys.ocaml_version; + exit 0; +;; + module Options = Main_args.Make_opttop_options (struct let set r () = r := true let clear r () = r := false @@ -75,6 +80,7 @@ module Options = Main_args.Make_opttop_options (struct let _S = set keep_asm_file let _unsafe = set fast let _version () = print_version () + let _vnum () = print_version_num () let _w s = Warnings.parse_options false s let _warn_error s = Warnings.parse_options true s let _warn_help = Warnings.help_warnings diff --git a/toplevel/topmain.ml b/toplevel/topmain.ml index 803624c5e2..4bf9922a11 100644 --- a/toplevel/topmain.ml +++ b/toplevel/topmain.ml @@ -50,6 +50,11 @@ let print_version () = exit 0; ;; +let print_version_num () = + Printf.printf "%s\n" Sys.ocaml_version; + exit 0; +;; + module Options = Main_args.Make_bytetop_options (struct let set r () = r := true let clear r () = r := false @@ -69,6 +74,7 @@ module Options = Main_args.Make_bytetop_options (struct let _strict_sequence = set strict_sequence let _unsafe = set fast let _version () = print_version () + let _vnum () = print_version_num () let _w s = Warnings.parse_options false s let _warn_error s = Warnings.parse_options true s let _warn_help = Warnings.help_warnings diff --git a/yacc/main.c b/yacc/main.c index fe7ad8895c..feb2dbdac5 100644 --- a/yacc/main.c +++ b/yacc/main.c @@ -191,6 +191,9 @@ void getargs(int argc, char **argv) printf ("The Objective Caml parser generator, version " OCAML_VERSION "\n"); exit (0); + }else if (!strcmp (argv[i], "-vnum")){ + printf (OCAML_VERSION "\n"); + exit (0); }else{ vflag = 1; } |