What does the ocamlc -strict-formats option do?

It doesn’t seem documented anywhere except for this one blurb in the -help output.

  -strict-formats  Reject invalid formats accepted by legacy implementations
     (Warning: Invalid formats may behave differently from
      previous OCaml versions, and will become always-rejected
      in future OCaml versions. You should always use this flag
      to detect invalid formats so you can fix them.)

I notice because dune turns it on for compilation by default. What thing’s formats is it referring to? What do these errors look like if you run into one?

Here “formats” refers to format strings, as in, those strings passed to functions in the Format and Printf modules of the Stdlib.

Oh! Those formats. Thanks!

A possibly somewhat silly question but still: which formats exactly are deprecated?

Essentially, formats with conflicting or redundant options. For examples,

Format.printf "%04.3d" 0 (* pads with 4 and 3 zeros*);;
Format.printf "%++d" 0 (* redundant + *);;
Format.printf "%2.+3f" 0 (* the precision must be an integer *);;