[NFC][OCaml] Resolve const and unsigned compilation warnings

Authored by jberdine on Mar 25 2021, 4:24 PM.


[NFC][OCaml] Resolve const and unsigned compilation warnings

There are a number of compilation warnings regarding disregarding
const qualifiers, and casting between pointers to integer types with
different sign.

The incompatible sign warnings are due to treating the result of
LLVMGetModuleIdentifier as const unsigned char *, but it is
declared as const char *.

The dropped const qualifiers are due to the code pattern
memcpy(String_val(_),_,_) which ought to be (following the
implementation of the OCaml runtime)
memcpy((char *)String_val(_),_,_). The issue is that String_val is
usually used to get the value of an immutable string. But in the
context of the memcpy calls, the string is in the process of being
initialized, so is not yet constant.

Differential Revision: https://reviews.llvm.org/D99392