Skip to content

Commit

Permalink
Mark new macros change as potentially breaking
Browse files Browse the repository at this point in the history
If an OCaml C library already defines some of the new `Val_none`,
`Some_val`, `Is_none`, `Is_some`, `caml_alloc_some`, or `Tag_some`
macros; then the C compiler will likely warn for macro redefinition,
even if the macro definition are identical.

This problem happens in [ocaml-mccs][1].

The proposed [fix][2] for libraries is to only define the macros when
compiling with OCaml strictly older than 4.12, i.e.:

    #if OCAML_VERSION < 41200
    #define ...
    #endif

[1]: ocaml-opam/ocaml-mccs#30
[2]: ocaml#5154 (comment)
  • Loading branch information
MisterDA committed Jul 17, 2020
1 parent c4851b0 commit 394a47d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Changes
Expand Up @@ -38,8 +38,10 @@ Working version
(KC Sivaramakrishnan, review by Stephen Dolan, Gabriel Scherer,
and Xavier Leroy)

- #9569: Add `Val_none`, `Some_val`, `Is_none`, `Is_some`, `caml_alloc_some`,
and `Tag_some`.
* #5154, #9569, #9734: Add `Val_none`, `Some_val`, `Is_none`, `Is_some`,
`caml_alloc_some`, and `Tag_some`. As these macros are sometimes defined by
authors of C bindings, this change may cause warnings/errors in case of
redefinition.
(Nicolás Ojeda Bär, review by Stephen Dolan, Gabriel Scherer, Mark Shinwell,
and Xavier Leroy)

Expand Down

0 comments on commit 394a47d

Please sign in to comment.