https://github.com/janet-lang/janet/releases/download/v1.32.1/janet.chttps://github.com/janet-lang/janet/releases/download/v1.32.1/janet.hhttps://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`?
Comment #1 by bugzilla — 2023-12-24T06:49:38Z
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.
Comment #2 by dfj1esp02 — 2023-12-25T14:20:56Z
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.
Comment #3 by dfj1esp02 — 2023-12-25T14:43:38Z
clang provides __has_extension function for such checks, but doesn't document computed gotos.
Comment #4 by bugzilla — 2023-12-27T20:05:13Z
If you can post the definition of JANET_USE_COMPUTED_GOTOS we can see about making it evaluate to false.
Oh, __GNUC__ means gnu C dialect?
--- cjanet.c ---
#undef __GNUC__
#include "janet.c"
---
dmd -P-I. -c cjanet.c
Does this work?
Comment #7 by bugzilla — 2023-12-30T04:47:28Z
(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.