Issue Details (XML | Word | Printable)

Key: PCC-211
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

interaction between #if expression and #endif comment with "pcc -E -C"

Created: 12/Jan/11 03:00 PM   Updated: 01/Feb/11 04:51 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386

 Description  « Hide
There is an interaction between conditional expressions in the preprocessor and comments which causes an error while using pcc with lint as illustrated by the following code

  #define FOO 1

  #if (FOO == 1)

  #endif /* FOO */

when compiled with "pcc -C -E" the following warning is produced

  file.c:5: warning: newline expected, got "/"

and pcc exits with an error code, which causes lint to fail

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 16/Jan/11 01:00 PM
This seems to have been fixed as a side-effect in last checkin.

Iain Hibbert added a comment - 01/Feb/11 11:48 AM
seems to be only partially fixed.. there is an interaction with _Pragma() here, as

  #ifndef FOO
  #define BAR _Pragma("bar")
  #endif /* comment */

is triggering the same error..

Anders Magnusson added a comment - 01/Feb/11 04:51 PM
An unbalanced ++/-- of a variable caused this. Fixed now.