Skip to content

[5.3 regression] Failure when using the C API in C++ code #13422

@kit-ty-kate

Description

@kit-ty-kate

Trying to compile mccs with the 5.3 branch (a4e7cbd) breaks with the following error message at least on macOS:

File "src_ext/mccs/src/dune", line 5, characters 63-73:
  5 |    new_criteria notuptodate_criteria removed_criteria mccscudf mccs_stubs)
                                                                     ^^^^^^^^^^
  (cd _build/default/src_ext/mccs/src && /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wextra -Wno-unused-parameter -x c++ -DUSEGLPK -g -I /Users/runner/.cache/ocaml-local/lib/ocaml -I ../../cudf/lib -I ../../extlib/src -I glpk -o mccs_stubs.o -c mccs_stubs.cpp)
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:20:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:353:1: error: expected expression
  CAMLnoret CAMLextern void caml_fatal_error (char *, ...)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:105:22: note: expanded from macro 'CAMLnoret'
    #define CAMLnoret [[noreturn]]
                       ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:353:11: error: expected unqualified-id
  CAMLnoret CAMLextern void caml_fatal_error (char *, ...)
            ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:140:34: note: expanded from macro 'CAMLextern'
  #define CAMLextern CAMLDLLIMPORT extern
                                   ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:17:1: error: expected parameter declarator
  DOMAIN_STATE(atomic_uintnat, young_limit)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:17:1: error: expected ')'
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:17:1: note: to match this '('
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:29: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                              ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:17:1: error: a type specifier is required for all declarations
  DOMAIN_STATE(atomic_uintnat, young_limit)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:22: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                       ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:17:14: error: expected ';' at end of declaration list
  DOMAIN_STATE(atomic_uintnat, young_limit)
               ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:28:1: error: expected parameter declarator
  DOMAIN_STATE(value*, young_ptr)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:28:1: error: expected ')'
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:28:1: note: to match this '('
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:29: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                              ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:28:1: error: a type specifier is required for all declarations
  DOMAIN_STATE(value*, young_ptr)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:22: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                       ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:28:14: error: expected ';' at end of declaration list
  DOMAIN_STATE(value*, young_ptr)
               ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:31:1: error: expected parameter declarator
  DOMAIN_STATE(value*, young_start)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:31:1: error: expected ')'
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:31:1: note: to match this '('
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:29: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                              ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:31:1: error: a type specifier is required for all declarations
  DOMAIN_STATE(value*, young_start)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:34: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                   ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/misc.h:156:22: note: expanded from macro 'CAMLalign'
  #define CAMLalign(n) alignas(n)
                       ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:31:14: error: expected ';' at end of declaration list
  DOMAIN_STATE(value*, young_start)
               ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:34:1: error: expected parameter declarator
  DOMAIN_STATE(value*, young_end)
  ^
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
  In file included from mccs_stubs.cpp:7:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/mlvalues.h:70:
  In file included from /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:32:
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.tbl:34:1: error: expected ')'
  /Users/runner/.cache/ocaml-local/lib/ocaml/caml/domain_state.h:31:44: note: expanded from macro 'DOMAIN_STATE'
  #define DOMAIN_STATE(type, name) CAMLalign(8) type name;
                                             ^
[...]

After talking with @Octachron i'll try to go back through #11557 soon and polishing it in hope this would fix this kind of error forever

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions