<< Back to previous view

[PCC-365] chknl() fail to detect eof Created: 29/Jun/11  Updated: 06/Jul/11

Status: Resolved
Project: pcc
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial
Reporter: Anthony Mallet Assignee: Anders Magnusson
Resolution: Fixed Votes: 0

File Attachments: File patch    

chknl() fail to detect eof, and prints the followin warning:
warning: newline expected, got "�" (where the char in question is 255)

The fix is trivial: check for a return of 0 in sloscan(). However, sloscan() might also return (usch)-1 (i.e. 255) because it can happen that unch() has been called beforehand with a value of -1 returned by sloscan(), and unch(-1) actually pushes back 255.

See the attached patch for a fix (hopefully more formal than my tentative explanation above :)

Comment by Anthony Mallet [ 29/Jun/11 05:11 PM ]
I should have said that this happens when a # directive is on the last (unterminated) line, e.g:
#endif<missing \n>
Comment by Anders Magnusson [ 06/Jul/11 06:03 PM ]
Great, thanks, applied!
Generated at Tue Oct 17 17:07:53 CEST 2017 using JIRA Enterprise Edition, Version: 3.13.1-#333.