-
Bug
-
Resolution: Fixed
-
High
-
Code Generation Tools
-
CODEGEN-10058
-
-
-
-
default
-
Insert a carriage return \n or \r\n before the affected line of code.
The parser for the TI compiler treats stand alone carriage return \r as white space.
If a line of code (function call, expression, etc) following a line with
comments ending in \r, then the line of code will be treated as comments.
For below example, the function call two() is treated as comments as continued from the comments at end of the previous line.
void one(), two();
void line_ending_test()
{ one(); // this line ends with only \r two(); }More details
--------------
The attached source uses Windows text file line endings \r \n. Except one line has been intentionally changed to end only with \r. Even viewing this file is odd, because it depends on how the viewer software handles the case of a bare \r character. Here is a character by character dump using the utility od ...
% od -An -c -w10 line_ending_test.c v o i d o n e ( ) , t w o ( ) ; \r \n \r \n v o i d l i n e _ e n d i n g _ t e s t ( ) \r \n { \r \n o n e ( ) ; / / t h i s l i n e e n d s w i t h o n l y \ r \r t w o ( ) ; \r \n } \r \n
Notice how every line ends with the sequence \r \n, except for the one with the comment: // this line ends with only \r . The TI proprietary compilers, including cl2000, view the bare \r character like a space or tab. It does not cause the line to end. Thus, the call to the function two() is commented out. Every other compiler I tried, including tiarmclang, views the bare \r as a line separator. Thus, the call to the function two() is not commented out. This is easily verified by viewing the assembly code generated by the compiler. I loaded this into compiler explorer, and tried many compilers. https://godbolt.org/z/Tfa7hTPad . Every one I tried generates a call to the function two().