sustrik / libdill

Structured concurrency in C
MIT License
1.68k stars 156 forks source link

bundle_wait() is incompatible with -std=c99, -std=c11, -std=c90 #194

Open Hirrolot opened 5 years ago

Hirrolot commented 5 years ago

Code:

#include <libdill.h>
#include <assert.h>

coroutine void empty() {}

int main() {
    int all = bundle();
    assert(all != -1);
    bundle_go(all, empty()); /* #9 */
    assert(hclose(all) != -1);
}

When trying to compile:

gymmasssorla@gymmasssorla-desktop:~$ gcc main.c -std=c99 -ldill -pthread
In file included from main.c:1:0:
main.c: In function ‘main’:
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘;’ before ‘volatile’
  bundle_go(all, empty()); /* #9 */
  ^
gymmasssorla@gymmasssorla-desktop:~$ gcc main.c -std=c11 -ldill -pthread
In file included from main.c:1:0:
main.c: In function ‘main’:
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘;’ before ‘volatile’
  bundle_go(all, empty()); /* #9 */
  ^
gymmasssorla@gymmasssorla-desktop:~$ gcc main.c -std=c90 -ldill -pthread
In file included from main.c:1:0:
main.c: In function ‘main’:
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘)’ before ‘:’ token
  bundle_go(all, empty()); /* #9 */
  ^
main.c:9:2: error: expected ‘;’ before ‘volatile’
  bundle_go(all, empty()); /* #9 */
  ^

But everything works without the --std=X option. Is this a bug in the LibDill's source code?