This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/C6000-CGT: --diag_suppress is not working

Part Number: C6000-CGT
Other Parts Discussed in Thread: AM5728

Tool/software: TI C/C++ Compiler

I have an issue, i have those errors

line 162: error #173: invalid type conversion
line 163: error #173: invalid type conversion

i use --diag_suppress=173, but it's not affecting,

'Building file: "../app_main.cpp"'
'Invoking: C6000 Compiler'
"C:/ti/ti-cgt-c6000_8.3.6/bin/cl6x" -mv6600 --include_path="C:/ti/pdk_am57xx_1_0_10/packages/ti/boot/sbl/board/src" --include_path="C:/ti/pdk_am57xx_1_0_10/packages/ti/boot/sbl/soc/am57xx" --include_path="C:/ti/pdk_am57xx_1_0_10/packages/ti/board/src/maxxAM572x/include" --include_path="C:/Maxx_Firmware/projects/NIMU_attempt" --include_path="C:/Maxx_Firmware/projects/NIMU_attempt/inc" --include_path="C:/ti/ti-cgt-c6000_8.3.6/include" --include_path="C:/ti/ndk_2_26_00_08/packages" --include_path="C:/ti/pdk_am57xx_1_0_10/" --include_path="C:/ti/pdk_am57xx_1_0_10/packages/" --include_path="C:/ti/pdk_am57xx_1_0_10/packages/ti/transport/ndk/nimu" --include_path="C:/Maxx_Firmware/inc" --include_path="C:/Maxx_Firmware/src/app" --include_path="C:/ti/pdk_am57xx_1_0_10/packages/ti/boot/sbl/board/src" --include_path="C:/Maxx_Firmware/src/app/common" --define=TI_RTOS --define=USE_BIOS --define=SOC_AM572x --define=idkAM572x --define=C66X --define=am5726 --define=core1 -g --diag_remark=173 --diag_suppress=173 --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="app_main.d_raw" --cmd_file="configPkg/compiler.opt" "../app_main.cpp"

i also tried to use pragmas:

#ifdef _TMS320C6X
#define IGNORE_CONVERSIONS _Pragma("diag_push") \
                           _Pragma("diag_suppress 173")\
                           _Pragma("CHECK_MISRA(\"-9.1\")")

#define IGNORE_CONVERSIONS_RESTORE _Pragma("diag_pop")

But no effect either....


Can someone help?

  • Not all diagnostics can be suppressed.  And number 173 is one of them.  If a diagnostic can be suppressed, the number for the diagnostic is followed by -D.  For instance ...

    % cl6x --display_error_number file.c
    "file.c", line 3: warning #225-D: function "function_not_declared" declared implicitly

    Diagnostic numbers are not shown by default.  The option --display_error_number must be used to see them.  Notice the -D after the diagnostic number 225.  That means diagnostic 225 can be suppressed with --diag_suppress.  

    For more details, please search the C6000 compiler manual for the sub-chapter titled Understanding Diagnostic Messages.

    Thanks and regards,

    -George

  • Im using AM5728, on ARM A15 the #pragma GCC diagnostic error "-Wconversion" for the same code is working, but on c66 i try to achieve the same result and you say i cannot ignore this error...

    The problem is i try to cast pointer to member function to constant void pointer, it looks like this 

    (const void*)ExampleClass::ExampleFunc


     

     

    Maybe there is a way to solve it without supress? Thanks.

     

  • For the source file that gets the diagnostic about invalid type conversion, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • app_main.pp.txt

    the compiler i use ti-cgt-c6000_8.3.6

  • Major compilers generally agree that converting a pointer to member function is a bad idea: https://godbolt.org/z/3xd5rn

    GCC provides an extension to extract the function from such a pointer: https://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html

    Pointers to member functions are not data or function pointers, and can't be treated as such. Consider the case when such a pointer to member is a virtual function. There is some amount of processing that must occur to actually call the desired function based upon the data found in the 'this' pointer being sent in. This means that a pointer to member function may not even be a function, but rather a data object (virtual function table entry).

    In section 3.9.2.3 of the C++14 standard, in any text pertaining to types, "pointers" does not apply to pointer-to-member types unless that member is static, thus invalidating such concepts as conversions and alias rules. This adds on the concept that pointer-to-member types are not convertible to normal pointer types.

    According to section 4.11.2, only two types of conversions are allowed on pointer-to-members:

    • Conversion of the null pointer constant (nullptr) to a pointer to member is called a null member pointer value, and is distinct from any other pointer-to-member not created from nullptr
    • Conversion of 'pointer to member of B of type T' to 'pointer to member of D of type T', where B is a base class and D a derived class of B

    Footnote 59 in that same section clarifies:

    "Note that a pointer to member is not an object pointer or a function pointer and the rules for conversions of such pointers do not apply to pointers to members. In particular, a pointer to member cannot be converted to a void*."

    Thus, I'm led to believe your code sample here is ill-formed, and the error is expected.

    I don't see any way to immediately fix your code, unfortunately, since the callback API seems reliant upon casting this member function to a const void *.