Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add a C++ test outline #2

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

sjperkins
Copy link

@jrhosk @astrofrog I took the work done in 6c35a60 a bit further here by building a C++ test case outline.

There are some failures when actually compiling the generated C++.

/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp: In constructor ‘dtype_t::int1_t::int1_t(kaitai::kstream*, kaitai::kstruct*, dtype_t*)’:
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:159:118: error: no matching function for call to ‘dtype_t::int8_t::int8_t()’
  159 | ::int1_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, dtype_t* p__root) : kaitai::kstruct(p__io) {
      |                                                                                                       ^

/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:38:1: note: candidate: ‘dtype_t::int8_t::int8_t(kaitai::kstream*, kaitai::kstruct*, dtype_t*)’
   38 | dtype_t::int8_t::int8_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, dtype_t* p__root) : kaitai::kstruct(p__io) {
      | ^~~~~~~
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:38:1: note:   candidate expects 3 arguments, 0 provided
In file included from /home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:3:
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.h:69:11: note: candidate: ‘constexpr dtype_t::int8_t::int8_t(const dtype_t::int8_t&)’
   69 |     class int8_t : public kaitai::kstruct {
      |           ^~~~~~
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.h:69:11: note:   candidate expects 1 argument, 0 provided
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp: In member function ‘void dtype_t::int1_t::_read()’:
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:166:29: warning: invalid user-defined conversion from ‘int8_t’ {aka ‘signed char’} to ‘const dtype_t::int8_t&’ [-fpermissive]
  166 |     m_value = m__io->read_s1();
      |               ~~~~~~~~~~~~~~^~
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:38:1: note: candidate is: ‘dtype_t::int8_t::int8_t(kaitai::kstream*, kaitai::kstruct*, dtype_t*)’ (near match)
   38 | dtype_t::int8_t::int8_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, dtype_t* p__root) : kaitai::kstruct(p__io) {
      | ^~~~~~~
/home/simon/code/casa-formats-specification/ci/cpp/build/dtype.cpp:38:1: note:   conversion of argument 1 would be ill-formed:

I'm just pushing this up in the hopes that it'll be useful, rather than any expectation that this needs to be dealt with in the near or even medium term: It's just good to know there might be bumps in the road.

I might some time to dig more on my side as I haven't found time to understand the interaction between the generated kaitai C++ and the compiler.

Just compiling the generated rust would also be valuable IMO.

@jrhosk
Copy link
Collaborator

jrhosk commented Oct 23, 2024

That is interesting, I hadn't actually tried to use it yet so this is good to know. Depending on how likely we are to use this (c++/rust) it might be good to look at it more closely now rather than later given how closely the yaml file and the actual code is generated. By that I mean, a significant refactor of the yaml code would mean a significant rewrite of the access code. For now, I'm going to work on getting all of the yaml code written for the ms, with testing code, then if we need to make large changes they can be done at that point before really diving in to the API code.

I look forward to results of your investigation, thanks for this.

@astrofrog
Copy link
Member

astrofrog commented Oct 30, 2024

I've approved the workflow (not sure it didn't work by default) so it will now run - thanks for this addition!

@sjperkins
Copy link
Author

I've approved the workflow (not sure it didn't work by default) so it will now run - thanks for this addition!

Thanks, this is on my radar.

@sjperkins
Copy link
Author

The github action now installs cmake, the c++ compiler and katai-struct-compiler correctly. However, the generation of the cpp files now fails on master.

@jrhosk
Copy link
Collaborator

jrhosk commented Nov 5, 2024

@sjperkins I will try and take a look today, things on main are constantly in flux so this will happen often. If it helps, once it is compiling again I'll make a development branch so you can have a working main for your purposes.

@sjperkins
Copy link
Author

No pressure from my side, I thought it was important to at least get the github action to call katai-struct and attempt a compile.

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

Successfully merging this pull request may close these issues.

3 participants