Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

c_funcpack (rust version): Make compliant with Cpp #23

Open
trembel opened this issue Sep 27, 2024 · 0 comments
Open

c_funcpack (rust version): Make compliant with Cpp #23

trembel opened this issue Sep 27, 2024 · 0 comments

Comments

@trembel
Copy link

trembel commented Sep 27, 2024

If the generated header files are now included within a Cpp file

extern "C" {
  #include "max4146x_reg.h"
}

it throws a lot of warnings and errors, examples are:

/.../max4146x/max4146x_reg.h:1003:30: warning: missing initializer for member 'max4146x_cfg7::spi_txen2' [-Wmissing-field-initializers]
 1003 |   struct max4146x_cfg7 r = {0};

/.../max4146x/max4146x_reg.h:1300:28: error: invalid conversion from 'int' to 'max4146x_papwr' [-fpermissive]
 1300 |   struct max4146x_pa1 r = {0};
      |                            ^
      |                            |
      |                            int


/.../max4146x/max4146x_reg.h:208:38: warning: ISO C++ forbids compound-literals [-Wpedantic]
  208 | #define MAX4146X_CFG1_RESET_LE {0x90U} //!< CFG1 register reset value
      |                                      ^

This happens as the file is interpreted by the cpp compiler, which typically has much stricter rules (which saddly aren't easy to change for a single file anymore).
Help could be to split the file into a .c/.h pair.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant