www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22598] New: importC: Add support for __extension__ keyword

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

          Issue ID: 22598
           Summary: importC: Add support for __extension__ keyword
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

In common system headers, the __extension__ keyword can crop up, i.e in
assert.h, assert() is defined as:

---

  ((void) sizeof ((expr) ? 1 : 0), __extension__ ({                     \
      if (expr)                                                         \
        ; /* empty */                                                   \
      else                                                              \
        __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION);   \
    }))
---


Here the __extension__ disables any ISO C warnings caused by the non-standards
conforming syntax ({ ... }).

By not allowing the same to be compilable by ImportC would prevent any code
that uses assert.h from working.

--
Dec 14 2021