www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22303] New: importC: import c errors on pragmas

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 puremagic.com
          Reporter: dave287091 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
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
  return 1;
#pragma

}

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

--
Sep 13