cosmopolitan icon indicating copy to clipboard operation
cosmopolitan copied to clipboard

Bug: Cannot include `windowsesque` header into a cpp file

Open A2va opened this issue 10 months ago • 0 comments

Contact Details

[email protected]

What happened?

If windowsesque.h is included in a cpp file it fails to find the _Atomic type declaration.

Repro code: https://github.com/A2va/cosmocc-windowsesque

Version

cosmocc v4.0.2

What operating system are you seeing the problem on?

Linux

Relevant log output

error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: @programdir/modules/private/action/build/object.lua:100: @programdir/modules/core/tools/gcc.lua:966: In file included from /home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:3,
                 from /home/runner/work/_temp/cosmocc-4.0.2/include/windowsesque.h:18,
                 from main.cpp:1:
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h: In function 'int32_t InterlockedAdd(volatile int32_t*, int32_t)':
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:38:10: error: expected primary-expression before ')' token
   38 |   return atomic_fetch_add((_Atomic(int32_t) *)p, x) + x;
      |          ^~~~~~~~~~~~~~~~
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:38:10: error: '_Atomic' was not declared in this scope
   38 |   return atomic_fetch_add((_Atomic(int32_t) *)p, x) + x;
      |          ^~~~~~~~~~~~~~~~
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:38:10: error: expected primary-expression before ')' token
   38 |   return atomic_fetch_add((_Atomic(int32_t) *)p, x) + x;
      |          ^~~~~~~~~~~~~~~~
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h: In function 'int32_t InterlockedExchange(volatile int32_t*, int32_t)':
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:42:10: error: expected primary-expression before ')' token
   42 |   return atomic_exchange((_Atomic(int32_t) *)p, x);
      |          ^~~~~~~~~~~~~~~
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:42:10: error: '_Atomic' was not declared in this scope
   42 |   return atomic_exchange((_Atomic(int32_t) *)p, x);
      |          ^~~~~~~~~~~~~~~
/home/runner/work/_temp/cosmocc-4.0.2/include/libc/nt/synchronization.h:42:10: error: expected primary-expression before ')' token
   42 |   return atomic_exchange((_Atomic(int32_t) *)p, x);

A2va avatar Mar 06 '25 14:03 A2va