Ambiguous overload for operator -- cross-compile riscv64-unknown-elf-
#1484
-
Hello folks, I'm doing a cross-compilation for RISC-V CPU + FreeRTOS and I have several errors concerning ambiguous overloads like : [ 43%] Generating ActiveLogger_FilterSeverityEnumAc.hpp, ActiveLogger_FilterSeverityEnumAc.cpp
Parsing Enum ActiveLogger_FilterSeverity
Completed generating files for /home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/ActiveLogger/ActiveLogger_FilterSeverityEnumAi.xml Enum XML....
Scanning dependencies of target Svc_ActiveLogger
[ 43%] Building CXX object F-Prime/Svc/ActiveLogger/CMakeFiles/Svc_ActiveLogger.dir/ActiveLoggerImpl.cpp.obj
/home/ThibFrgsGmz/Documents/fprime-poc/fprime/Svc/ActiveLogger/ActiveLoggerImpl.cpp: In constructor 'Svc::ActiveLoggerImpl::ActiveLoggerImpl(const char*)':
/home/ThibFrgsGmz/Documents/fprime-poc/fprime/Svc/ActiveLogger/ActiveLoggerImpl.cpp:24:69: error: ambiguous overload for 'operator=' (operand types are 'Svc::ActiveLogger_Enabled' and 'Svc::ActiveLogger_Enabled::t')
FILTER_WARNING_HI_DEFAULT?Enabled::ENABLED:Enabled::DISABLED;
^~~~~~~~
In file included from /home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/ActiveLogger/ActiveLoggerComponentAc.hpp:22,
from /home/ThibFrgsGmz/Documents/fprime-poc/fprime/Svc/ActiveLogger/ActiveLoggerImpl.hpp:11,
from /home/ThibFrgsGmz/Documents/fprime-poc/fprime/Svc/ActiveLogger/ActiveLoggerImpl.cpp:10:
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/ActiveLogger/ActiveLogger_EnabledEnumAc.hpp:72:27: note: candidate: 'Svc::ActiveLogger_Enabled& Svc::ActiveLogger_Enabled::operator=(const Svc::ActiveLogger_Enabled&)'
ActiveLogger_Enabled& operator=(
^~~~~~~~
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/ActiveLogger/ActiveLogger_EnabledEnumAc.hpp:77:27: note: candidate: 'Svc::ActiveLogger_Enabled& Svc::ActiveLogger_Enabled::operator=(NATIVE_INT_TYPE)'
ActiveLogger_Enabled& operator=(
^~~~~~~~
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/ActiveLogger/ActiveLogger_EnabledEnumAc.hpp:82:27: note: candidate: 'Svc::ActiveLogger_Enabled& Svc::ActiveLogger_Enabled::operator=(NATIVE_UINT_TYPE)'
ActiveLogger_Enabled& operator=(
^~~~~~~~ If you know, could you tell me how to get rid of this error in a clean way please? I also had this error on the serialization/deserialization methods of command messages which I solved by writing in my #define FPRIME_OVERRIDE_NATIVE_TYPES
typedef int32_t NATIVE_INT_TYPE; //!< native integer type declaration
typedef uint32_t NATIVE_UINT_TYPE; //!< native unsigned integer type declaration Is this the best way to correct this type of error? According to Can you explain to me what exactly "malformed" means? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
In the meantime I statically cast the ActiveLoggerImpl::ActiveLoggerImpl(const char* name) :
ActiveLoggerComponentBase(name)
{
// set filter defaults
this->m_filterState[FilterSeverity::WARNING_HI].enabled =
FILTER_WARNING_HI_DEFAULT? static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
this->m_filterState[FilterSeverity::WARNING_LO].enabled =
FILTER_WARNING_LO_DEFAULT?static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
this->m_filterState[FilterSeverity::COMMAND].enabled =
FILTER_COMMAND_DEFAULT?static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
this->m_filterState[FilterSeverity::ACTIVITY_HI].enabled =
FILTER_ACTIVITY_HI_DEFAULT?static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
this->m_filterState[FilterSeverity::ACTIVITY_LO].enabled =
FILTER_ACTIVITY_LO_DEFAULT?static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
this->m_filterState[FilterSeverity::DIAGNOSTIC].enabled =
FILTER_DIAGNOSTIC_DEFAULT?static_cast<NATIVE_INT_TYPE>(Enabled::ENABLED):static_cast<NATIVE_INT_TYPE>(Enabled::DISABLED);
memset(m_filteredIDs,0,sizeof(m_filteredIDs));
} Even if it works, I wonder if it's a mistake on my side by having misconfigured something in the framework. Otherwise if it is a real error in the code, I can submit by PR the static_cast that I had to add to crosscompile in riscv. |
Beta Was this translation helpful? Give feedback.
-
Nope, this is a genuine issue! I suspect when we start testing with newer versions of clang / gcc we'd see the same warning. It's warning that we're assigning the raw enum value ( an int), rather than the enum class (a C++ class). What we should do is assign a Svc::ActiveLogger_Enabled to fileState instead. |
Beta Was this translation helpful? Give feedback.
-
@Joshua-Anderson Well, now it's in the autogenerated code that I have this ambiguous cast error: Completed generating files for /home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileStatusEnumAi.xml Enum XML....
Scanning dependencies of target Svc_FileDownlinkPorts
[ 60%] Building CXX object F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/SendFileCompletePortAc.cpp.obj
[ 60%] Building CXX object F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/SendFileRequestPortAc.cpp.obj
[ 61%] Building CXX object F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/SendFileResponseSerializableAc.cpp.obj
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileResponseSerializableAc.cpp: In constructor 'Svc::SendFileResponse::SendFileResponse()':
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileResponseSerializableAc.cpp:13:43: error: ambiguous overload for 'operator=' (operand types are 'Svc::SendFileStatus' and 'Svc::SendFileStatus::t')
this->m_status = Svc::SendFileStatus::STATUS_OK;
^~~~~~~~~
In file included from /home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileResponseSerializableAc.hpp:21,
from /home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileResponseSerializableAc.cpp:1:
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileStatusEnumAc.hpp:74:21: note: candidate: 'Svc::SendFileStatus& Svc::SendFileStatus::operator=(const Svc::SendFileStatus&)'
SendFileStatus& operator=(
^~~~~~~~
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileStatusEnumAc.hpp:79:21: note: candidate: 'Svc::SendFileStatus& Svc::SendFileStatus::operator=(NATIVE_INT_TYPE)'
SendFileStatus& operator=(
^~~~~~~~
/home/ThibFrgsGmz/Documents/fprime-poc/App/build-fprime-automatic-riscv-soc-freertos/F-Prime/Svc/FileDownlinkPorts/SendFileStatusEnumAc.hpp:84:21: note: candidate: 'Svc::SendFileStatus& Svc::SendFileStatus::operator=(NATIVE_UINT_TYPE)'
SendFileStatus& operator=(
^~~~~~~~
make[3]: *** [F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/build.make:134: F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/SendFileResponseSerializableAc.cpp.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:4783: F-Prime/Svc/FileDownlinkPorts/CMakeFiles/Svc_FileDownlinkPorts.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2189: CMakeFiles/App.dir/rule] Error 2
make: *** [Makefile:165: App] Error 2
[ERROR] CMake erred with return code 2 This is the result in the autogenerated #include <Svc/FileDownlinkPorts/SendFileResponseSerializableAc.hpp>
#include <Fw/Types/Assert.hpp>
#include <Fw/Types/BasicTypes.hpp>
#include <Fw/Types/StringUtils.hpp>
#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/String.hpp>
#endif
#include <cstring>
namespace Svc {
// public methods
SendFileResponse::SendFileResponse(): Serializable() {
this->m_status = Svc::SendFileStatus::STATUS_OK;
this->m_context = 0;
} So I try to modify the autocoder to add a // public methods
${name}::${name}(): Serializable() {
#for ($member,$type,$array_size,$size,$format,$comment,$default,$typeinfo) in $members:
#if $default != None and $array_size != None:
for (NATIVE_INT_TYPE _mem = 0; _mem < ${array_size}; _mem++) {
this->m_${member}[_mem] = static_cast<$type>(${default});
}
#else if $default != None:
this->m_${member} = ${default};
#end if
#end for
} Work in progress... |
Beta Was this translation helpful? Give feedback.
-
@ThibFrgsGmz what version of F Prime are you using? This bug looks very familiar to the bugs fixed by #1462. |
Beta Was this translation helpful? Give feedback.
@ThibFrgsGmz what version of F Prime are you using? This bug looks very familiar to the bugs fixed by #1462.