https://github.com/janet-lang/janet/releases/download/v1.32.1/janet.c https://github.com/janet-lang/janet/releases/download/v1.32.1/janet.h https://github.com/janet-lang/janet/releases/download/v1.32.1/shell.c $ dmd --version DMD64 D Compiler v2.106.0-beta.1 Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright $ dmd -P-I. -c janet.c src/core/vm.c(342): Error: expression expected, not `&&` src/core/vm.c(342): Error: found `label_JOP_NOOP` when expecting `}` src/core/vm.c(343): Error: identifier or `(` expected src/core/vm.c(597): Error: `=`, `;` or `,` expected to end declaration instead of `}` src/core/vm.c(643): Error: identifier expected following `goto` src/core/vm.c(643): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(650): Error: identifier expected following `goto` src/core/vm.c(650): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(657): Error: identifier expected following `goto` src/core/vm.c(657): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(666): Error: identifier expected following `goto` src/core/vm.c(666): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(676): Error: identifier expected following `goto` src/core/vm.c(676): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(680): Error: identifier expected following `goto` src/core/vm.c(680): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(680): Error: identifier expected following `goto` src/core/vm.c(680): Error: found `*` when expecting `;` following `goto` statement src/core/vm.c(683): Error: identifier expected following `goto` src/core/vm.c(683): Error: found `*` when expecting `;` following `goto` statement $ dmd -P-I. -c shell.c shell.c(657): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(657): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(659): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(681): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(681): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(681): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(681): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(681): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(764): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(778): Error: undefined identifier `isnan`, did you mean function `nan`? shell.c(780): Error: undefined identifier `isnan`, did you mean function `nan`?
Can you please try reducing this to the offending few lines of code? I don't have src/core/vm.c, and probably not exactly the same .h files you're using, either.
From forum discussion: --- One Problem with Janet is that it uses computed gotos which is a gcc extension The code it complains about looks like: ```C /* opcode -> label lookup if using clang/GCC */ #ifdef JANET_USE_COMPUTED_GOTOS static void *op_lookup[255] = { &&label_JOP_NOOP, &&label_JOP_ERROR, ``` As you can see &&label is not valid C11. Which is what the import C parser complains about. --- Maybe something can be done there with that JANET_USE_COMPUTED_GOTOS define.
clang provides __has_extension function for such checks, but doesn't document computed gotos.
If you can post the definition of JANET_USE_COMPUTED_GOTOS we can see about making it evaluate to false.
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__) #define JANET_USE_COMPUTED_GOTOS #endif
Oh, __GNUC__ means gnu C dialect? --- cjanet.c --- #undef __GNUC__ #include "janet.c" --- dmd -P-I. -c cjanet.c Does this work?
(In reply to Daniel from comment #5) > #if defined(__GNUC__) && !defined(__EMSCRIPTEN__) > #define JANET_USE_COMPUTED_GOTOS > #endif Unfortunately, if dmd #define'd __EMSCRIPTEN__ it would likely turn on some other nutburger extensions ImportC doesn't support. importc.h cannot #undef JANET_USE_COMPUTED_GOTOS because importc.h is #include'd first. Turning off __GNUC__ will cause all kinds of other problems.
I'm going to leave this as an enhancement request for computed goto. If there are other ImportC problems with janet, please post a bugzilla issue about it! https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
At least I can get you a better error message: https://github.com/dlang/dmd/pull/15967