[Issue 22303] New: importC: import c errors on pragmas

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 14 01:01:51 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22303

          Issue ID: 22303
           Summary: importC: import c errors on pragmas
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

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

--


More information about the Digitalmars-d-bugs mailing list