Extra modes were added in the version 7 CRT (.NET 2002). Update `descriptor_is_in_binary_mode` so that the original mode is correctly restored at exit, even if it is neither `O_TEXT` nor `O_BINARY`.
fixes#9148
genprintval.tree_of_extension was missing instantiation of constructor argument types.
the Ctype.apply code is factorized out from a number of other places.
* Prologue size does not depend on stack_offset (power, arm64)
Define `initial_stack_offset` of a function, independently
of stack_offset, and use it to compute both frame_size and
prologue_size.
```ocaml
val left : 'a -> ('a, 'b) t
val right : 'b -> ('a, 'b) t
val is_left : ('a, 'b) t -> bool
val is_right : ('a, 'b) t -> bool
val find_left : ('a, 'b) t -> 'a option
val find_right : ('a, 'b) t -> 'b option
val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t
val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t
val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t
val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c
val equal :
left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) ->
('a, 'b) t -> ('a, 'b) t -> bool
val compare :
left:('a -> 'a -> int) -> right:('b -> 'b -> int) ->
('a, 'b) t -> ('a, 'b) t -> int
```
Unlike [result], no [either] type is made available in Stdlib,
one needs to access [Either.t] explicitly:
- This type is less common in typical OCaml codebases,
which prefer domain-specific variant types whose constructors
carry more meaning.
- Adding this to Stdlib would raise warnings in existing codebases
that already use a constructor named Left or Right:
+ when opening a module that exports such a name,
warning 45 is raised
+ adding a second constructor of the same name in scope kicks
in the disambiguation mechanisms, and warning 41 may now
be raised by existing code.
If the use becomes more common in the future we can always
revisit this choice.
The tests for -dlocations are painful to update for native compiler
backends. They were previously restricted to 64bit architectures only
( e57785524b ), and disabled on AFL
( 829b00b6c7 ), but the fact that they
have to be updated for both clambda and flambda backends is annoying
in practice. This commit disables location-testing completely for the
native backend, and only checks locations in the bytecode compiler
intermediate representations, from -dparsetree to -dlambda.
Note: now the we have bytecode-only versions of the test, it should be
more portable. The test has been re-enabled for 32bit and AFL
configurations. It will still need tweaking in the future if people
perform configuration-dependent changes on the Lambda representation
(but hopefully those changes could be disabled by command-line options
to be added to the test configuration).
Under Windows, for channels opened in text mode, EOL conversion causes
a mismatch between the `offset` position cached in the
`struct channel` record and actual position in the file.
This commit turns off the use of the cached "offset" in the implementations
of `{in,out}_channel_length` and `seek_in`, calling `lseek` directly instead.
To support this, a new channel flag `CHANNEL_TEXT_MODE` was added. It
is set for channels operating in text mode under Windows, when EOL
conversion is active.
Fixes: #9868