Feature Requests: Browse | Submit New | Admin

[#1944] Make preprocessor ignore tokens following #endif until end-of-line (?)

Date:
2005-05-23 03:48
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Make preprocessor ignore tokens following #endif until end-of-line (?)

Detailed description
I doubt this is strictly conforming C code, but the OSX/Darwin header <netinet6/in6.h> contains the following
construct, which gcc accepts, but dbc rejects:

#if 0 /* the followings are relic in IPv4 and hence are disabled */
...
#endif 0

It would be nice if dbc could let this slide.

I'm no YACC guru, and I don't know what negative repercussions this change might have, but the attached patch to
dbc/contrib/caphir/src/preprocessor.y seems to let me get around my immediate problem.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2005-08-05 20:41
Sender: Charles Mills

Thanks, I will apply patch.
Date: 2005-05-23 03:50
Sender: Nobody

OK, I failed to follow the instructions for uploading a file
(didn't check the box), so here it is:

63c63
<               | 'endif' end_of_statement               
{ @cond_comp.pop }
---
>               | endif_token                            
{ @cond_comp.pop }
65c65,75
< 
---
> 
>         ignore_others
>                 : ignore_other ignore_others
>                 | ignore_other
>                 ;
> 
>       endif_token
>                 : 'endif' ignore_others end_of_statement
>                 | 'endif' end_of_statement
>                 ;
> 
75c85
<               | 'endif' end_of_statement { @cond_comp.pop }
---
>               | endif_token { @cond_comp.pop }
120c130,131
<               | 'endif'                                
{ @cond_comp.pop }
---
>                 | 'endif' ignore_others                
{ @cond_comp.pop }
>               | 'endif'                                
{ @cond_comp.pop }

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item