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.

tms470_4.9.5 compiler giving errant 188-D and 225-D line numbers in CCS 5.2



I recently switched from CCS 5.1 to 5.2 and TMS470 4.9.1 to 4.9.5.  I am noticing that the line number for an error or a warning is one line earlier than the actual offending line.  This has cost me hours chasing the wrong line of code.  When you turn on --verbose_diagnostics, the line number is still wrong, but at least the offending line of code is printed out, so you can figure out the mismatch.

This also causes a problem with double clicking on either the error line in either the Console or Problems tab.  You end up looking at the wrong error.

Example of error output with verbose, the actual lines printed  are 2673 and 2738:

"C:/Data/Code/LM4FCommon/MiWi/trunk/MiWi.c", line 2672: warning #225-D:
          function declared implicitly
                      ConsolePut(' ');
                      ^

"C:/Data/Code/LM4FCommon/MiWi/trunk/MiWi.c", line 2737: warning #188-D:
          pointless comparison of unsigned integer with zero
                          for(j = 0; j < (8-MY_ADDRESS_LENGTH); j++)
                                       ^

  • I cannot reproduce this with a small test case.

    How do you determine the actual line number of the warning? 

    Do you have any line continuation characters in MiWi.c?

  • It took me an hour and a half to hack down 5400lines to just these:

    long x;
    long y;
    
    void PrintChar(unsigned char ch) { }
    
    void Tasks(void)
    {
        #if defined(ENABLE_SLEEP)
    // The content in this #if clause is the issue, can be commented out or not
    //        if( y == 0 )
    //        {
    //            x = 0;
    //        }
        #endif
    }
    
    void DumpConnection(unsigned char index)
    {
        unsigned char i = 0;
        int j;  // needs to be signed to avoid TS470 warning below
    
        if( index == 0xFF )
        {
            PrintChar(i);
            ConsolePut(' ');
        }
    }
    
    Giving these warnings:

    "../188D.c", line 24: warning #225-D: function declared implicitly
              ConsolePut(' ');
              ^

    "../188D.c", line 19: warning #179-D: variable "j" was declared but never
              referenced
          int j;  // needs to be signed to avoid TS470 warning below

  • Thank you for providing a test case, but unfortunately I still can't reproduce the problem.

    From inspection of your post, the line numbers reported definitely should be 25 and 20, but that's exactly what I get when I run the TMS470 compiler version 4.9.5 on this test case.

    There could conceivably be a bug involving whitespace (I doubt it).  Could you zip this test case and attach that, so that I know I'm working with your exact test case?

    What command-line options are you using?

  • Please find the file attached.

    From Properties window, my summary of flags is:

    -mv7M4
    --code_state=16
    --float_support=FPv4SPD16
    --abi=eabi
    -me
    -g
    --include_path="C:/ti/ccsv5/tools/compiler/tms470_4.9.5/include"
    --include_path="C:/Data/Code/LM4FCommon/CommonLib/trunk"
    --include_path="C:/StellarisWare"
    --define=css --define=__TMS470__
    --define=__LM4F__
    --define=TARGET_IS_BLIZZARD_RA1
    --define=PART_LM4F232H5QD
    --verbose_diagnostics
    --diag_warning=225
    --display_error_number

  • When I compile your downloaded 188D.c using v4.9.5 with the options you provide, I get this:

    "188D.c", line 24: warning #225-D: function declared implicitly
              ConsolePut(' ');
              ^

    "188D.c", line 19: warning #179-D: variable "j" was declared but never
              referenced
          int j;  // needs to be signed to avoid TS470 warning below
              ^

    The line numbers match what I see in the file:

  • That ^M (line 12) is mighty suspicious.  I bet some parts of Eclipse or the tool chain are counting that as a line break, and some parts aren't.

  • pf, I think you're correct, and it is a CTRL-M carriage return (0x0D) without a line feed and not the two characters ^ and M, which is very unusual for Windows.  Using a binary editor on the provided file, it is the only location that has 0x0D without the 0x0A expected on Windows.

  • I can say you solved this problem of errant line numbers.  I cannot guess how this happend, though the original code came from a third party.  I am pretty sure I did not touch this line - though I touched many others.  I am not sure how to even enter just a line feed.

    I search the third party code base I am porting, and this line alone has the missing line feed.  I have deleted the lone \r and just hit return.  The line numbers for errors in the original code now accurate.

    I will mark this solved.