[Issue 24291] ImportC: cannot compile janet.c

2023-12-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

--- Comment #7 from Walter Bright  ---
(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.

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

--- Comment #6 from anonymous4  ---
Oh, __GNUC__ means gnu C dialect?

--- cjanet.c ---
#undef __GNUC__
#include "janet.c"
---
dmd -P-I. -c cjanet.c

Does this work?

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

Daniel  changed:

   What|Removed |Added

 CC||wyr...@gmx.net

--- Comment #5 from Daniel  ---
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
#define JANET_USE_COMPUTED_GOTOS
#endif

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

--- Comment #4 from Walter Bright  ---
If you can post the definition of JANET_USE_COMPUTED_GOTOS we can see about
making it evaluate to false.

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

--- Comment #3 from anonymous4  ---
clang provides __has_extension function for such checks, but doesn't document
computed gotos.

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

anonymous4  changed:

   What|Removed |Added

URL||https://forum.dlang.org/pos
   ||t/woaixickqgqvfsazutex@foru
   ||m.dlang.org

--- Comment #2 from anonymous4  ---
>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] = {
 &_JOP_NOOP,
 &_JOP_ERROR,
```

As you can see & 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.

--


[Issue 24291] ImportC: cannot compile janet.c

2023-12-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #1 from Walter Bright  ---
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.

--