c2rust
c2rust copied to clipboard
Skip or Add `NonAtomicToAtomic` Support Within C99
A request to add support or skip support for the functionality of casting regular types to a atomic type feature.
Error:
thread 'main' panicked at 'Unsupported implicit cast: NonAtomicToAtomic', /.../c2rust-transpile-0.16.0/src/c_ast/conversion.rs:167:14
Clang Version: Ubuntu clang version 14.0.0-1ubuntu1 Target: x86_64-pc-linux-gnu Thread model: posix
File Link: https://github.com/immunant/c2rust/blob/master/c2rust-transpile/src/c_ast/conversion.rs
What file in raylib cause this issue? Would like to narrow down the cause of this cast on the C side.
The file is actual not in raylib but in libclang after looking more closely at output. c2rust then stops converting after trying to convert the atomic types in stdatomic.h
of libclang 14.0:
https://clang.llvm.org/doxygen/stdatomic_8h_source.html:91:126
The file that is being converted is this one:
https://github.com/raysan5/raylib/blob/master/examples/core/core_loading_thread.c
I don't know where the file begins and ends but this was the last warning:
warning: Missing type 94425815108752 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 31, begin_line: 109, begin_column: 1, end_line: 109, end_column: 37 }, type_id: Some(94425815108752), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_int_fast8_t"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-14/lib/clang/14.0.0/include/stdatomic.h:109:1
Apologies for the long wait.
ahhhh, that is C11 atomics.
#include <stdatomic.h> // C11 atomic data types
Both functions in that file use C11 atomics, and so wouldn't get transpiled even if we get past parsing until we support these atomics properly. We don't have a singular issue for C11 atomics, so I'll keep this open until we either do or we implement some sort of support for them.
Yeah still I would like the program not to panic but give a error and keep going. So if some else is willing to add Result support for the CastKind match function would be great. I am also willing to do it as well so that I can at least get the file conversions of the files can be converted (skip support). I think it would also be useful to record all the functions that show a warning and error to a function so that they can be re-implemented.
Is there a way to just ignore it and transpile the rest so I can manually fix it instead?