Microsoft KB Archive/61308

{|
 * width="100%"|

BUG: /Fs Does Not Locate Error When #line Directive Specified

 * }

Q61308

6.00 6.00a 6.00ax 7.00 | 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbtool kbbuglist -- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE) included with: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 6.0 and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SYMPTOMS ======== When the #line preprocessor directive is used with a filename label, /Fs generates a source listing with the correct error count but fails to correctly locate the errors in the listing file. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. This is not a problem in Visual C++ 32-bit Edition, because /Fs is not supported. MORE INFORMATION ================ The sample code below was used to generate the following listing files, which illustrate this problem. This is the normal source listing generated by the compiler: Line# Source Line Microsoft C Compiler Version 6.0 1 2 #include 3 4 void main 5 { 6 intt x; /* the error is here */ ***** test.c(6) : error C2065: 'intt' : undefined ***** test.c(6) : error C2146: syntax error : missing ';' before ... ***** test.c(6) : error C2065: 'x' : undefined 7 8 printf(&quot;hello&quot;); 9 } 3 errors detected When compiled with C 6.0 with a #line directive and a filename label, the source listing fails to indicate the error, and lists only the number of errors. For example: Line# Source Line Microsoft C Compiler Version 6.0 1 #include 2 3 #line 1 &quot;test&quot; 4 5 void main 6 { 7 8 intt x; /* error is here */ 9 10 printf(&quot;hello&quot;); 11 } 3 errors detected With version 6.0 of the compiler, if the filename label (&quot;test&quot; in this case) is not specified, the source listing contains the error messages, but they are not in the correct place. This is also the behavior when using version 7.0, 8.0, or 8.0c of the compiler with or without the filename label. For example: Line# Source Line Microsoft C Compiler Version 6.0 1 2 #include 3 #line 1 4 ***** test.c(4) : error C2065: 'intt' : undefined ***** test.c(4) : error C2146: syntax error : missing ';' before ... ***** test.c(4) : error C2065: 'x' : undefined 5 void main 6 { 7 intt x; /* the error is here */ 8 9 printf(&quot;hello&quot;); 10 } 3 errors detected Sample Code --- /* Compile options needed: /Fs */ #include void main { intt x; /* the error is here */ printf(&quot;hello&quot;); } Additional reference words: 6.00 6.00a 6.00ax 7.00 8.00 8.00c 1.00 1.50 KBCategory: kbtool kbbuglist KBSubcategory: CLIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCVCComp