Bug 22303 – ImportC: pragma directives should be ignored
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-14T01:01:51Z
Last change time
2021-09-30T01:46:09Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
dave287091
Comments
Comment #0 by dave287091 — 2021-09-14T01:01:51Z
Some pragmas are left in the source file after running a pre-processor. For example, using clang with -E can leave pragmas in the headers looking something like this:
int func_with_pragma(void){
#pragma clang diagnostic push // Error: found `#` instead of statement
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
return 1;
#pragma clang diagnostic pop // Error: found `#` instead of statement
}
This happens when using system headers on macOS.
Just ignoring pragmas would be fine.
Also, if I am understanding 6.10.6 of the c11 standard correctly, #pragmas are a pre-processing directive, but have effects on compilation? I believe to be conformant importC needs to be able to process the following:
#pragma STDC FP_CONTRACT on-off-switch
#pragma STDC FENV_ACCESS on-off-switch
#pragma STDC CX_LIMITED_RANGE on-off-switch
Comment #1 by dlang-bot — 2021-09-14T08:34:47Z
@WalterBright created dlang/dmd pull request #13072 "fix Issue 22303 - ImportC: pragma directives should be ignored" fixing this issue:
- fix Issue 22303 - ImportC: pragma directives should be ignored
https://github.com/dlang/dmd/pull/13072
Comment #2 by dlang-bot — 2021-09-19T06:41:48Z
dlang/dmd pull request #13072 "fix Issue 22303 - ImportC: pragma directives should be ignored" was merged into stable:
- 876ccbd229223f81e2536c44060e5a2944f2fd24 by Walter Bright:
fix Issue 22303 - ImportC: pragma directives should be ignored
https://github.com/dlang/dmd/pull/13072
Comment #3 by dlang-bot — 2021-09-30T01:46:09Z
dlang/dmd pull request #13108 "merge stable" was merged into master:
- 79ee87d6fb9c81bb9d8daf03330167633d217db9 by Walter Bright:
fix Issue 22303 - ImportC: pragma directives should be ignored (#13072)
https://github.com/dlang/dmd/pull/13108