Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Suppress constexpr members declarations #374

Open
GTValentine opened this issue Jun 6, 2018 · 1 comment
Open

Suppress constexpr members declarations #374

GTValentine opened this issue Jun 6, 2018 · 1 comment

Comments

@GTValentine
Copy link

GTValentine commented Jun 6, 2018

There's no option to suppress constexpr members declarations. For this .djinni file:

bar = record
{
  const foo: i32 = 42;
}

Two files will be generated:

//.hpp
struct Bar final 
{
    static constexpr int32_t FOO = 42;
}

and

//.cpp
int32_t const Bar::FOO;

MSVC with c++17 enabled though frowns upon that:

warning C5041: 'FOO': out-of-line definition for constexpr static data member is not needed and is deprecated in C++17.

We're compiling with /WX (warning treated as errors) so this broke our build.

Please provide an option to not generate the declarations.

@artwyman
Copy link
Contributor

Making this optional seems like a reasonable thing for Djinni to do. Is the definition required at C++11 level? If so we couldn't eliminate it entirely while maintaining compatibility. At any rate, feel free to phrase your request in the form of a Pull Request. 😄

Meanwhile, you can likely work around this by tweaking the build options for generated code compared to your own code. I've frequently had to do that for 3rd-party code, which generally isn't as warning-clean as we want our internal code to be.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants