This is a new major version with a whole bunch of new features and bug fixes. The biggest features are support for translating some preprocessor directives like: #define
for simple constants and function like macros. This release also adds support for a new platform, Windows.
Here's the full changelog:
New/Changed Features
- Support for simple defines (like
#define FOO 1
) - Translation of defines to functions (like
#define FOO(a, b) a + b
) - Support for preprocessor token-pasting operator (
##
) - Support for translation of whole packages (
--package
CLI option) - Support for translation of preprocessor constants in array sizes
- Support for global comments and comments inside structs and enums
- Detecting collisions of renamed tag-space names (struct name_t ...) with existing ones
- Special treatment of a comment before header guard
- Support for removing excessive newlines and keeping original spacing
- Basic unit tests were added
- Cucumber tests were replaced with D-based tests
- Statements are now translated in the original order as the input file
- Multiple input files can be processed at once
- Extend a functionality that automatically replaces aliases to basic types with their D equivalents
- Add a switch
--reduce-aliases
which disables/enables the above functionality - Add a switch
--alias-enum-members
which enables generation of aliases for enum members in the global scope - Add a switch
--translate-macros
which can disable the translation of C macro definitions - Add the
libclang
bindings as a test case - Add support for Microsoft Windows
- Run Windows tests on AppVeyor
- Handle complex floating-point types.
- Use the new alias syntax (
alias Y = X
) in the output - Support for custom global attributes (e.g.
nothrow
,@nogc
) - Add support for building with LDC
- Bump the minimum requirement D compilers to their latest version
- Always test using the latest version of DMD and LDC, including beta and nightly builds
- Bump the minimum requirement of libclang to 7.0.0
- Automatically generate the libclang bindings using DStep
- Add a switch
--rename-enum-members
, which enables stripping of superfluous prefixes from enum members. - Add a switch
--normalize-modules
, which enables changing the names of modules to the D conforming form. - Add support for bit fields.
Bugs Fixed
- Issue 2: Self alias should be removed bug
- Issue 8: Typedef and anonymous structs
- Issue 10: Embedded struct not generated
- Issue 20:
#define
(simplest cases only?) - Issue 21:
wchar_t
should be translated tocore.stdc.stddef.wchar_t
- Issue 28: Crashes if fed nonexistent header
- Issue 29: Don't name anonymous enums
- Issue 30: Single space inserted after function names
- Issue 38: Spurious generation of variadic args rather than implicit void
- Issue 39: Recognize and translate
__attribute__((__packed__))
- Issue 46: Generating code that will not compile
- Issue 47: Treatment of #define enhancement
- Issue 50: struct typedef generates recursive alias bug
- Issue 59: Shouldn't dstep exit with status code when there is some kind of error
- Issue 83: New multiline translation
- Issue 85: dstep not converting
const T x[]
toconst (T)* x
- Issue 98: dstep segfaults: Unhandled type kind cast(CXTypeKind)119
- Issue 107: Handle typedef of opaque structs.
- Issue 114: Crash on recursive typedef.
- Issue 116: Option --space-after-function-name doesn't work with function pointer syntax.
- Issue 117: fatal error: 'limits.h' file not found.
- Issue 123: Missing import for usage of
#define
constant. - Issue 137: struct member expansion.
- Issue 138: Repeated declarations cause problems.
- Issue 140: On enums and scope.
- Issue 141: Use of _IO, _IOR, etc.
- Issue 154: Falling back to blunt pre-processor phase.
- Issue 157: Keep enum members when used as enum values.
- Issue 158: Keep literals for enum values.
- Issue 160: Translating typedef of function pointer doesn't take line length into consideration.
- Issue 166: macro used in struct declaration not translated properly
- Issue 192: Fail to convert nuklear
- Issue 199:
#define
of types results in incorrect output - Issue 202: Invalid translation of C struct with typedef to D.
- Issue 203: Octal constants not handled correctly
- Issue 204: C INT_MAX not handled.
- Issue 214: Cast inside macro not properly translated
- Issue 216: can't alias to existing D type