When compiling the test with `gcc -std=c11 -fsyntax-only`
compilable/test22724.i:4:10: error: unknown type name ‘pack’
4 | __pragma(pack(push, 8))
| ^~~~
compilable/test22724.i:10:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
10 | __declspec(noreturn) void abra(void);
| ^~~~~~~~~~
compilable/test22724.i: In function ‘__declspec’:
compilable/test22724.i:10:1: warning: type of ‘noreturn’ defaults to ‘int’ [-Wimplicit-int]
compilable/test22724.i:10:27: error: declaration for parameter ‘abra’ but no such parameter
10 | __declspec(noreturn) void abra(void);
| ^~~~
compilable/test22724.i:11: error: expected ‘{’ at end of input
Original source content:
```
// https://issues.dlang.org/show_bug.cgi?id=22724
// https://docs.microsoft.com/en-us/cpp/preprocessor/pragma-directives-and-the-pragma-keyword?view=msvc-170
__pragma(pack(push, 8))
typedef unsigned int size_t;
// https://issues.dlang.org/show_bug.cgi?id=23206
__declspec(noreturn) void abra(void);
```
Comment #1 by ibuclaw — 2023-02-16T19:13:02Z
Some observations:
1. It would appear that `__pragma` and `__declspec` are MSVC extensions.
2. There is no documentation of ImportC parser handling these.
https://dlang.org/spec/importc.html#visualc-extensions
As of writing the this is an empty paragraph
```
<h2>$(LNAME2 visualc-extensions, Visual C Extensions)</h2>
$(DDOC_BLANKLINE )
$(DDOC_BLANKLINE )
<h2>$(LNAME2 digital-mars-extensions, Digital Mars C Extensions)</h2>
```
Comment #2 by bugzilla — 2023-02-20T06:34:24Z
(In reply to Iain Buclaw from comment #1)
> 1. It would appear that `__pragma` and `__declspec` are MSVC extensions.
That's correct. Just like ImportC adds extensions to try to get gcc .h files to compile.
Comment #3 by ibuclaw — 2023-02-20T10:40:10Z
(In reply to Walter Bright from comment #2)
> (In reply to Iain Buclaw from comment #1)
> > 1. It would appear that `__pragma` and `__declspec` are MSVC extensions.
>
> That's correct. Just like ImportC adds extensions to try to get gcc .h files
> to compile.
OK, updated title and switched component over to dlang.org.
Comment #4 by dlang-bot — 2023-06-01T04:59:27Z
@WalterBright created dlang/dlang.org pull request #3622 "fix Issue 23692 - ImportC: __pragma and __declspec are not documented…" fixing this issue:
- fix Issue 23692 - ImportC: __pragma and __declspec are not documented as supported Visual C extensions
https://github.com/dlang/dlang.org/pull/3622
Comment #5 by dlang-bot — 2023-06-01T04:59:48Z
@WalterBright created dlang/dlang.org pull request #3623 "fix Issue 23692 - ImportC: __pragma and __declspec are not documented…" fixing this issue:
- fix Issue 23692 - ImportC: __pragma and __declspec are not documented as supported Visual C extensions
https://github.com/dlang/dlang.org/pull/3623
Comment #6 by dlang-bot — 2023-06-06T10:57:30Z
dlang/dlang.org pull request #3622 "fix Issue 23692 - ImportC: __pragma and __declspec are not documented…" was merged into master:
- 72d897dfb26fed34ec65b2d21c87e6cadf90ecff by Walter Bright:
fix Issue 23692 - ImportC: __pragma and __declspec are not documented as supported Visual C extensions
https://github.com/dlang/dlang.org/pull/3622