kaitai_struct_compiler icon indicating copy to clipboard operation
kaitai_struct_compiler copied to clipboard

Fix cpp pointers warnings - remove unfinished SharedPointers option

Open Mingun opened this issue 3 months ago • 0 comments

In SharedPointers mode compiler is never generate the correct code and in many cases just throw MatchError due to missing arms in switches.

It was not even possible to ran compiler with this settings, so it is better to remove it for now, until it will be fully implemented. If you wish to keep the work, you can then revert the first commit and create a draft PR with it and wait when someone will finish it.

Fixes the following warnings (13):

[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:511:26: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]         config.cppConfig.pointers match {
[warn]                          ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:511:26: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]         config.cppConfig.pointers match {
[warn]                          ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:727:22: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]     config.cppConfig.pointers match {
[warn]                      ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:870:24: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       config.cppConfig.pointers match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:980:22: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]     config.cppConfig.pointers match {
[warn]                      ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:727:22: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]     config.cppConfig.pointers match {
[warn]                      ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:1103:48: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       case ArrayTypeInStream(inType) => config.pointers match {
[warn]                                                ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:1108:44: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       case OwnedKaitaiStreamType => config.pointers match {
[warn]                                            ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:870:24: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       config.cppConfig.pointers match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:980:22: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]     config.cppConfig.pointers match {
[warn]                      ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:1103:48: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       case ArrayTypeInStream(inType) => config.pointers match {
[warn]                                                ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala:1108:44: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       case OwnedKaitaiStreamType => config.pointers match {
[warn]                                            ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala:106:24: match may not be exhaustive.
[warn] It would fail on the following input: SharedPointers
[warn]       config.cppConfig.pointers match {
[warn]                        ^

Mingun avatar Mar 11 '24 14:03 Mingun