Skip to content

Cannot parse 'inline' from OCaml headers #47

Description

@edwintorok

Using calipso/FrontC 4.0.0 on Fedora34:

cat >x.c <<EOF
#include "caml/mlvalues.h"
#include "caml/memory.h"
#include "caml/alloc.h"

value dummy(value x) {
  CAMLparam1(x);
  CAMLreturn(x);
}
EOF
calipso_stat -p 'gcc -std=c99 -E -I /home/edwin/.opam/4.11.0/lib/ocaml/ %i -o %o' y.c
/home/edwin/.opam/4.11.0/lib/ocaml/caml/misc.h[214] Syntax error: static inline int caml_uadd_overflow(uintnat a, uintnat b, uintnat * res)
goto total = 0
goto average = -
goto maximum = 0
goto functions = 0
label total = 0
label average = -
label maximum = 0
label functions = 0

Note: std=c99 is needed otherwise it fails at a different place:
/usr/lib/gcc/x86_64-redhat-linux/11/include/stddef.h[416] Syntax error: long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));

(If I save the preprocessed file and delete the inline the next failure will be:
/usr/include/stdio.h[415] Syntax error: extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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