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.

CCS/CCSTUDIO: Disable single instance of a warning

Part Number: CCSTUDIO

Tool/software: Code Composer Studio

How do I disable a single instance of a warning / issue a one-time exception to a warning?

I understand that you can suppress every instance of a warning using --diag_suppress, but I would like to keep the warning turned on in general, signify an exception on one line of code, and keep my warning box (and the warning box of everyone else pulling the project from source control) clean.

Thank you!

  • Hello,
    Perhaps one option is to use file-specific options to specify --diag_suppress for that file. Of course this would applt for all the source of that file but this is the smallest granularity you can specify this for I believe.

    Thanks
    ki
  • Thanks for getting back to me.

    Can I do a single file suppress from the CCS Diagnostic Options GUI?   What is the syntax for this?

    When I add ### -filename.c or ### --filename.c to the suppress diagnostic box, I get

    WARNING: invalid compiler option --filename.c (ignored)

    Also is there a way to suppress the letter-specific version of an error (ex 169-D)?  Whenever I suppress 169-d (vs 169), I get this compile error:

    Command-line error: invalid number: 169-d
    1 catastrophic error detected in this compilation.
    Compilation terminated.

    (I am using CCSv7.2 with TI v17.6.0 STS for ARM CC3220 as the compiler version)

    Thank you!

  • alexa said:
    Can I do a single file suppress from the CCS Diagnostic Options GUI?   What is the syntax for this?

    See: http://software-dl.ti.com/ccs/esd/documents/users_guide/sdto_ccs_build-handbook.html#file-specific-options

    alexa said:
    Also is there a way to suppress the letter-specific version of an error (ex 169-D)?

    The "D" stands for Discretionary. It means you are allowed to change the level (like from warning to error). Hence there is no need to specify the -D portion of the diagnostic number.

    Thanks

    ki

  • Thank you!
    ... I wondered why I never saw error flavors A, B, or C :)
  • In MS compiler there is a way to temporary manipulate diagnostic with push/pop pragmas. One may have a temptation to use TI' diag_suppress and diag_default pragmas, but it does not work that way. What I see if there is diag_suppress pragma, it does suppress, but if later in file one places diag_default pragma, effect of the previous vanishes.

    I found TI expert suggests using these pragmas in . For me the following fragment

    #pragma diag_suppress=179
    static inline int32_t platform_memory_test2 (uint32_t start_address, uint32_t end_address)
    {
        uint32_t index, value;
    
        /* Write a pattern */
        for (index = start_address; index < end_address; index += 4) {
            *(volatile uint32_t *) index = (uint32_t)index;
        }
        return 0;
    }
    
    #pragma diag_default=179
    static inline int32_t platform_memory_test (uint32_t start_address, uint32_t end_address)
    {
        uint32_t index, value;
    

    produces 2 warnings for both functions:

    Description	Resource	Path	Location	Type
    #179-D function "platform_memory_test" was declared but never referenced	cus_plat_init.c	/mtp300_lte/platform	line 382	C/C++ Problem
    #179-D function "platform_memory_test2" was declared but never referenced	cus_plat_init.c	/mtp300_lte/platform	line 369	C/C++ Problem
    

    However, if I put diag_suppres pragma wherever in the file, that will suppress warning for all instances, not just for the one after the pragma. So I believe these pragmas aren't working as documented.

  • alexa said:
    I understand that you can suppress every instance of a warning using --diag_suppress, but I would like to keep the warning turned on in general, signify an exception on one line of code, and keep my warning box

    The TI compilers support the #pragma diag_suppress, which in conjunction with #pragma diag_push and #pragma diag_pop can be be used to disable a warning for particular lines of code. See for example 5.10.9 The Diagnostic Message Pragmas in the TI ARM compiler user's guide.

  • Chester,

    Nice catch. This should help people in ARM world.

    Push/pop mechanism isn't yet supported in C6000 compiler, and diag_suppress pragma has effect, similar to file wide option: regardless of pragma statement location, all instances of specified diagnostic gets suppressed, not only those from the statement till the end of translation unit.