@@ -220,10 +220,20 @@ let set_compiler_pass ppf ~name v flag ~filter =
220
220
(* 'can-discard=' specifies which arguments can be discarded without warning
221
221
because they are not understood by some versions of OCaml. *)
222
222
let can_discard = ref []
223
+ let warnings_for_discarded_params = ref false
224
+
225
+ let extra_params = ref None
226
+ let set_extra_params params = extra_params := params
223
227
224
228
let read_one_param ppf position name v =
225
229
let set name options s = setter ppf (fun b -> b) name options s in
226
230
let clear name options s = setter ppf (fun b -> not b) name options s in
231
+ let handled =
232
+ match ! extra_params with
233
+ | Some h -> h ppf position name v
234
+ | None -> false
235
+ in
236
+ if not handled then
227
237
match name with
228
238
| "g" -> set " g" [ Clflags. debug ] v
229
239
| "bin-annot" -> set " bin-annot" [ Clflags. binary_annotations ] v
@@ -359,112 +369,9 @@ let read_one_param ppf position name v =
359
369
set " cmm-invariants" [ cmm_invariants ] v
360
370
| "linscan" ->
361
371
set " linscan" [ use_linscan ] v
362
- | "ocamlcfg" ->
363
- set " ocamlcfg" [ use_ocamlcfg ] v
364
372
| "insn-sched" -> set " insn-sched" [ insn_sched ] v
365
373
| "no-insn-sched" -> clear " insn-sched" [ insn_sched ] v
366
374
367
- | "flambda2-join-points" ->
368
- set " flambda2-join-points"
369
- [Flambda2. join_points] v
370
- | "no-flambda2-join-points" ->
371
- clear " flambda2-join-points"
372
- [Flambda2. join_points] v
373
- | "flambda2-unbox-along-intra-function-control-flow" ->
374
- set " flambda2-unbox-along-intra-function-control-flow"
375
- [Flambda2. unbox_along_intra_function_control_flow] v
376
- | "no-flambda2-unbox-along-intra-function-control-flow" ->
377
- clear " flambda2-unbox-along-intra-function-control-flow"
378
- [Flambda2. unbox_along_intra_function_control_flow] v
379
- | "flambda2-backend-cse-at-toplevel" ->
380
- set " flambda2-backend-cse-at-toplevel"
381
- [Flambda2. backend_cse_at_toplevel] v
382
- | "no-flambda2-backend-cse-at-toplevel" ->
383
- clear " flambda2-backend-cse-at-toplevel"
384
- [Flambda2. backend_cse_at_toplevel] v
385
- | "flambda2-cse-depth" ->
386
- int_setter ppf " flambda2-cse-depth" Flambda2. cse_depth v
387
- | "flambda2-expert-inline-effects-in-cmm" ->
388
- set " flambda2-expert-inline-effects-in-cmm"
389
- [Flambda2.Expert. inline_effects_in_cmm] v
390
- | "no-flambda2-expert-inline-effects-in-cmm" ->
391
- clear " flambda2-expert-inline-effects-in-cmm"
392
- [Flambda2.Expert. inline_effects_in_cmm] v
393
- | "flambda2-expert-phantom-lets" ->
394
- set " flambda2-expert-phantom-lets"
395
- [Flambda2.Expert. phantom_lets] v
396
- | "no-flambda2-expert-phantom-lets" ->
397
- clear " flambda2-expert-phantom-lets"
398
- [Flambda2.Expert. phantom_lets] v
399
- | "flambda2-expert-max-unboxing-depth" ->
400
- int_setter ppf " flambda2-expert-max-unboxing-depth"
401
- Flambda2.Expert. max_unboxing_depth v
402
- | "flambda2-expert-can-inline-recursive-functions" ->
403
- set " flambda2-expert-can-inline-recursive-functions"
404
- [Flambda2.Expert. can_inline_recursive_functions] v
405
- | "no-flambda2-expert-can-inline-recursive-functions" ->
406
- clear " flambda2-expert-can-inline-recursive-functions"
407
- [Flambda2.Expert. can_inline_recursive_functions] v
408
- | "flambda2-inline-max-depth" ->
409
- Int_arg_helper. parse v
410
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-max-depth'"
411
- Flambda2.Inlining. max_depth
412
- | "flambda2-inline-max-rec-depth" ->
413
- Int_arg_helper. parse v
414
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-max-rec-depth'"
415
- Flambda2.Inlining. max_rec_depth
416
- | "flambda2-inline-call-cost" ->
417
- Float_arg_helper. parse v
418
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-call-cost'"
419
- Flambda2.Inlining. call_cost
420
- | "flambda2-inline-alloc-cost" ->
421
- Float_arg_helper. parse v
422
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-alloc-cost'"
423
- Flambda2.Inlining. alloc_cost
424
- | "flambda2-inline-prim-cost" ->
425
- Float_arg_helper. parse v
426
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-prim-cost'"
427
- Flambda2.Inlining. prim_cost
428
- | "flambda2-inline-branch-cost" ->
429
- Float_arg_helper. parse v
430
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-branch-cost'"
431
- Flambda2.Inlining. branch_cost
432
- | "flambda2-inline-indirect-cost" ->
433
- Float_arg_helper. parse v
434
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-indirect-cost'"
435
- Flambda2.Inlining. indirect_call_cost
436
- | "flambda2-inline-poly-compare-cost" ->
437
- Float_arg_helper. parse v
438
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-poly-compare-cost'"
439
- Flambda2.Inlining. poly_compare_cost
440
- | "flambda2-inline-small-function-size" ->
441
- Int_arg_helper. parse v
442
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-small-function-size'"
443
- Flambda2.Inlining. small_function_size
444
- | "flambda2-inline-large-function-size" ->
445
- Int_arg_helper. parse v
446
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-large-function-size'"
447
- Flambda2.Inlining. large_function_size
448
- | "flambda2-inline-threshold" ->
449
- Float_arg_helper. parse v
450
- " Bad syntax in OCAMLPARAM for 'flambda2-inline-threshold'"
451
- Flambda2.Inlining. threshold
452
- | "flambda2-speculative-inlining-only-if-arguments-useful" ->
453
- set " flambda2-speculative-inlining-only-if-arguments-useful"
454
- [Flambda2.Inlining. speculative_inlining_only_if_arguments_useful] v
455
- | "flambda2-treat-invalid-code-as-unreachable" ->
456
- set " flambda2-treat-invalid-code-as-unreachable"
457
- [Flambda2. treat_invalid_code_as_unreachable] v
458
- | "no-flambda2-treat-invalid-code-as-unreachable" ->
459
- clear " flambda2-treat-invalid-code-as-unreachable"
460
- [Flambda2. treat_invalid_code_as_unreachable] v
461
- | "flambda2-inlining-report-bin" ->
462
- set " flambda2-inlining-report-bin"
463
- [Flambda2.Inlining. report_bin] v
464
- | "no-flambda2-inlining-report-bin" ->
465
- clear " flambda2-inlining-report-bin"
466
- [Flambda2.Inlining. report_bin] v
467
-
468
375
(* color output *)
469
376
| "color" ->
470
377
begin match color_reader.parse v with
@@ -563,7 +470,8 @@ let read_one_param ppf position name v =
563
470
end
564
471
565
472
| _ ->
566
- if not (List. mem name ! can_discard) then begin
473
+ if ! warnings_for_discarded_params &&
474
+ not (List. mem name ! can_discard) then begin
567
475
can_discard := name :: ! can_discard;
568
476
Printf. ksprintf (print_error ppf)
569
477
" Warning: discarding value of variable %S in OCAMLPARAM\n %!"
0 commit comments