diff --git a/manifest/main.ml b/manifest/main.ml index c47564e325d430a50d82f33755433479ea81a5b6..1d4507e35e511f981f73e90436d714781599b465 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -3465,6 +3465,15 @@ include Tezos_raw_protocol_%s.Main final_protocol_versions then E else S "-no-hash-check"); + (match disable_warnings with + | [] -> E + | l -> + H + [ + S "-warning"; + S (Flags.disabled_warnings_to_string l); + ]); + H [S "-warn-error"; S "+a"]; S "."; ]; ] diff --git a/src/lib_protocol_compiler/compiler.ml b/src/lib_protocol_compiler/compiler.ml index 0a4cdea7611fc27cafc6f2f0dbc04788c3e25699..5f1a0b2fbf6ef98a41ba7d592f9a7603fa9621fa 100644 --- a/src/lib_protocol_compiler/compiler.ml +++ b/src/lib_protocol_compiler/compiler.ml @@ -23,11 +23,9 @@ (* *) (*****************************************************************************) -let warnings = Defaults.warnings +let default_warnings = Defaults.warnings -let extra_warnings = "-6-7-9-29" - -let warn_error = "-a+8" +let default_warn_error = "-a+8" let () = Clflags.unsafe_string := false @@ -167,8 +165,13 @@ type driver = { link_shared : string -> string list -> unit; } +let parse_options errflag s = + Option.iter Location.(prerr_alert none) (Warnings.parse_options errflag s) + let main {compile_ml; pack_objects; link_shared} = Random.self_init () ; + parse_options false default_warnings ; + parse_options true default_warn_error ; let anonymous = ref [] and static = ref false and register = ref false @@ -201,6 +204,14 @@ let main {compile_ml; pack_objects; link_shared} = Format.printf "%s\n" Tezos_version.Bin_version.version_string ; Stdlib.exit 0), " Display version information" ); + ( "-warning", + Arg.String (fun s -> parse_options false s), + " Enable or disable ocaml warnings according to . This \ + extends the default: " ^ default_warnings ); + ( "-warn-error", + Arg.String (fun s -> parse_options true s), + " Enable or disable ocaml error status according to . \ + This extends the default: " ^ default_warn_error ); ] in let usage_msg = @@ -214,30 +225,31 @@ let main {compile_ml; pack_objects; link_shared} = Arg.usage args_spec usage_msg ; Stdlib.exit 1 in - let announced_hash, protocol = + let stored_hash_opt, protocol = match Lwt_main.run (Tezos_base_unix.Protocol_files.read_dir source_dir) with | Ok (hash, proto) -> (hash, proto) | Error err -> Format.eprintf "Failed to read TEZOS_PROTOCOL: %a" pp_print_trace err ; exit 2 in - let real_hash = Protocol.hash protocol in + let computed_hash = Protocol.hash protocol in if !hash_only then ( - Format.printf "%a@." Protocol_hash.pp real_hash ; + Format.printf "%a@." Protocol_hash.pp computed_hash ; exit 0) ; let hash = - match announced_hash with - | None -> real_hash - | Some hash - when !check_protocol_hash && not (Protocol_hash.equal real_hash hash) -> + match stored_hash_opt with + | None -> computed_hash + | Some stored_hash + when !check_protocol_hash + && not (Protocol_hash.equal computed_hash stored_hash) -> Format.eprintf "Inconsistent hash for protocol in TEZOS_PROTOCOL.@\n\ - Found: %a@\n\ - Expected: %a@." + Computed hash: %a@\n\ + Stored in TEZOS_PROTOCOL: %a@." Protocol_hash.pp - hash + computed_hash Protocol_hash.pp - real_hash ; + stored_hash ; exit 2 | Some hash -> hash in @@ -281,12 +293,6 @@ let main {compile_ml; pack_objects; link_shared} = Clflags.nopervasives := true ; Clflags.no_std_include := true ; Clflags.include_dirs := [Filename.dirname functor_file] ; - let parse_options errflag s = - Option.iter Location.(prerr_alert none) (Warnings.parse_options errflag s) - in - parse_options false warnings ; - parse_options false extra_warnings ; - parse_options true warn_error ; load_embedded_cmis tezos_protocol_env ; let packed_protocol_object = compile_ml ~for_pack functor_file in let register_objects = diff --git a/src/proto_000_Ps9mPmXa/lib_protocol/dune b/src/proto_000_Ps9mPmXa/lib_protocol/dune index e0d08dff55ecd42e553e5f6d228b56a72bad819a..32ac6bee9b9f7d71771e0b58b65ec4b44f723e29 100644 --- a/src/proto_000_Ps9mPmXa/lib_protocol/dune +++ b/src/proto_000_Ps9mPmXa/lib_protocol/dune @@ -68,7 +68,12 @@ (deps data.ml services.ml main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_000_Ps9mPmXa_functor) diff --git a/src/proto_001_PtCJ7pwo/lib_protocol/dune b/src/proto_001_PtCJ7pwo/lib_protocol/dune index e19deb1649c831ebde958999637df67db08808c3..cf4058affb71cdd7e07e03c73bf61819dae6c364 100644 --- a/src/proto_001_PtCJ7pwo/lib_protocol/dune +++ b/src/proto_001_PtCJ7pwo/lib_protocol/dune @@ -266,7 +266,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_001_PtCJ7pwo_functor) diff --git a/src/proto_002_PsYLVpVv/lib_protocol/dune b/src/proto_002_PsYLVpVv/lib_protocol/dune index a7117a6bd443ff1c486ee6c024aa3fcf6c7c8139..5b785dd95868b69078eb03cfe2a17c91e03b16f4 100644 --- a/src/proto_002_PsYLVpVv/lib_protocol/dune +++ b/src/proto_002_PsYLVpVv/lib_protocol/dune @@ -266,7 +266,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_002_PsYLVpVv_functor) diff --git a/src/proto_003_PsddFKi3/lib_protocol/dune b/src/proto_003_PsddFKi3/lib_protocol/dune index fde780ce310fde43242b2e16f3509107e2d7b945..978f72ec5019307248ca3245b5990dd24f5d5f5b 100644 --- a/src/proto_003_PsddFKi3/lib_protocol/dune +++ b/src/proto_003_PsddFKi3/lib_protocol/dune @@ -269,7 +269,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_003_PsddFKi3_functor) diff --git a/src/proto_004_Pt24m4xi/lib_protocol/dune b/src/proto_004_Pt24m4xi/lib_protocol/dune index e2a53e96f538e2b7227c7d1e49bcfb3c2531ee64..2936be4bb22e89fa82cbc380402f001a6372bb1b 100644 --- a/src/proto_004_Pt24m4xi/lib_protocol/dune +++ b/src/proto_004_Pt24m4xi/lib_protocol/dune @@ -269,7 +269,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_004_Pt24m4xi_functor) diff --git a/src/proto_005_PsBABY5H/lib_protocol/dune b/src/proto_005_PsBABY5H/lib_protocol/dune index 0cc41ab767b8b27c33704a55dfb36cbefb64f325..c6d8917528ff527a7f453ef727fd3271f6ca5020 100644 --- a/src/proto_005_PsBABY5H/lib_protocol/dune +++ b/src/proto_005_PsBABY5H/lib_protocol/dune @@ -272,7 +272,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_005_PsBABY5H_functor) diff --git a/src/proto_005_PsBabyM1/lib_protocol/dune b/src/proto_005_PsBabyM1/lib_protocol/dune index 6670dd70a3ae189038b271c54dcfc75a4b13a06d..8b6969e9c5f8e5983d7e49efe24d6e8ee31f90e8 100644 --- a/src/proto_005_PsBabyM1/lib_protocol/dune +++ b/src/proto_005_PsBabyM1/lib_protocol/dune @@ -272,7 +272,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_005_PsBabyM1_functor) diff --git a/src/proto_006_PsCARTHA/lib_protocol/dune b/src/proto_006_PsCARTHA/lib_protocol/dune index 335a43c8258594104cd2523e2eaff4018cca3d27..8770d0b3374d50962fff5795dcd437cbc13ea9b0 100644 --- a/src/proto_006_PsCARTHA/lib_protocol/dune +++ b/src/proto_006_PsCARTHA/lib_protocol/dune @@ -272,7 +272,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_006_PsCARTHA_functor) diff --git a/src/proto_007_PsDELPH1/lib_protocol/dune b/src/proto_007_PsDELPH1/lib_protocol/dune index 4691c903933aa8601213f7bb1c7a6e95523d2bd9..d0279cc6df2bfb8ec0a39420a42cdf6201ce7528 100644 --- a/src/proto_007_PsDELPH1/lib_protocol/dune +++ b/src/proto_007_PsDELPH1/lib_protocol/dune @@ -278,7 +278,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_007_PsDELPH1_functor) diff --git a/src/proto_008_PtEdo2Zk/lib_protocol/dune b/src/proto_008_PtEdo2Zk/lib_protocol/dune index 94b5af617b39576fbb6995c27896ba0f7c63c87e..e4592dccc26c8b406b4198954bda46cfa9102e8b 100644 --- a/src/proto_008_PtEdo2Zk/lib_protocol/dune +++ b/src/proto_008_PtEdo2Zk/lib_protocol/dune @@ -293,7 +293,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_008_PtEdo2Zk_functor) diff --git a/src/proto_008_PtEdoTez/lib_protocol/dune b/src/proto_008_PtEdoTez/lib_protocol/dune index f425e34138b86dab8fa2e2ea6aa09c52d3834c09..e2cfe23826d0eab2807086f863c3238cfbc07e93 100644 --- a/src/proto_008_PtEdoTez/lib_protocol/dune +++ b/src/proto_008_PtEdoTez/lib_protocol/dune @@ -293,7 +293,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_008_PtEdoTez_functor) diff --git a/src/proto_009_PsFLoren/lib_protocol/dune b/src/proto_009_PsFLoren/lib_protocol/dune index 53bf1228edcbb7222ac126b3439a2389d4fc4499..c2cb0a47d479a8ce2c1cb261359e072e958412ed 100644 --- a/src/proto_009_PsFLoren/lib_protocol/dune +++ b/src/proto_009_PsFLoren/lib_protocol/dune @@ -302,7 +302,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_009_PsFLoren_functor) diff --git a/src/proto_010_PtGRANAD/lib_protocol/dune b/src/proto_010_PtGRANAD/lib_protocol/dune index 54bab5cdae93076acc49b52b8827d2558db8f78c..d13d8ab156a235695dcc51ee0a7e0dca3ec4d17a 100644 --- a/src/proto_010_PtGRANAD/lib_protocol/dune +++ b/src/proto_010_PtGRANAD/lib_protocol/dune @@ -317,7 +317,12 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action + (run + %{bin:tezos-protocol-compiler} + -warning -6-7-9-16-29-32-51-68 + -warn-error +a + .))) (library (name tezos_protocol_010_PtGRANAD_functor) diff --git a/src/proto_011_PtHangz2/lib_protocol/dune b/src/proto_011_PtHangz2/lib_protocol/dune index 8aa83538d5697c41d511bf65c18661844dfd0db9..515237f9fad35d2777e5977d9b4edee8c29231bf 100644 --- a/src/proto_011_PtHangz2/lib_protocol/dune +++ b/src/proto_011_PtHangz2/lib_protocol/dune @@ -356,7 +356,7 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action (run %{bin:tezos-protocol-compiler} -warning -51 -warn-error +a .))) (library (name tezos_protocol_011_PtHangz2_functor) diff --git a/src/proto_012_Psithaca/lib_protocol/dune b/src/proto_012_Psithaca/lib_protocol/dune index 0ad6bd4c9d1b7314d63e786c4dd38dc0f81e2b13..d154bf99c2b40be33bef974807e471c7f31ad4e4 100644 --- a/src/proto_012_Psithaca/lib_protocol/dune +++ b/src/proto_012_Psithaca/lib_protocol/dune @@ -407,7 +407,7 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action (run %{bin:tezos-protocol-compiler} -warning -51 -warn-error +a .))) (library (name tezos_protocol_012_Psithaca_functor) diff --git a/src/proto_013_PtJakart/lib_protocol/dune b/src/proto_013_PtJakart/lib_protocol/dune index b7b598c60bf7f7dc78477d80e23d94d75c7ba710..d57e7c984d5dab6bef810d51cd33e1efa5bd103b 100644 --- a/src/proto_013_PtJakart/lib_protocol/dune +++ b/src/proto_013_PtJakart/lib_protocol/dune @@ -604,7 +604,7 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} .))) + (action (run %{bin:tezos-protocol-compiler} -warning -51 -warn-error +a .))) (library (name tezos_protocol_013_PtJakart_functor) diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index 1bd086be3213209da3f8d98abd0d4a2426076fba..782f6786eb2a3f7943557559da8859b86d0bd923 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -664,7 +664,7 @@ alpha_services.ml alpha_services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} -no-hash-check .))) + (action (run %{bin:tezos-protocol-compiler} -no-hash-check -warn-error +a .))) (library (name tezos_protocol_alpha_functor) diff --git a/src/proto_demo_counter/lib_protocol/dune b/src/proto_demo_counter/lib_protocol/dune index b363b6cd444fd7f0e7502b2adc68249c8b8a7a08..b28cef118083db3b35c3fed3047ee7ca5dc632ab 100644 --- a/src/proto_demo_counter/lib_protocol/dune +++ b/src/proto_demo_counter/lib_protocol/dune @@ -90,7 +90,7 @@ services.ml services.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} -no-hash-check .))) + (action (run %{bin:tezos-protocol-compiler} -no-hash-check -warn-error +a .))) (library (name tezos_protocol_demo_counter_functor) diff --git a/src/proto_demo_noops/lib_protocol/dune b/src/proto_demo_noops/lib_protocol/dune index 025f7be86221badf094fd6af08f19a5928d08a4c..0a8d9d0b42c2ee2331b7ea3de0baf005c4471918 100644 --- a/src/proto_demo_noops/lib_protocol/dune +++ b/src/proto_demo_noops/lib_protocol/dune @@ -62,7 +62,7 @@ (rule (alias runtest_compile_protocol) (deps main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} -no-hash-check .))) + (action (run %{bin:tezos-protocol-compiler} -no-hash-check -warn-error +a .))) (library (name tezos_protocol_demo_noops_functor) diff --git a/src/proto_genesis/lib_protocol/dune b/src/proto_genesis/lib_protocol/dune index fda7cba3820deed3b5626c6eded4d34ab185df4d..254b24e9ddf45ea98779d10bf50a5dd59747c169 100644 --- a/src/proto_genesis/lib_protocol/dune +++ b/src/proto_genesis/lib_protocol/dune @@ -66,7 +66,7 @@ (deps data.ml services.ml main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:tezos-protocol-compiler} -no-hash-check .))) + (action (run %{bin:tezos-protocol-compiler} -no-hash-check -warn-error +a .))) (library (name tezos_protocol_genesis_functor)