This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add rules for ObjC files


Klee Dienes wrote:

I'm not sure if this is something you want to hassle with at the  moment, or if you'd prefer to let it wait as a modification once a  working version of the Objective-C patches are successfully committed.

But just as a heads-up, I should mention that in more recent versions  of our GDB, we've folded in all of the Objective-C support directly  into c-exp.y, and removed objc-exp.y as a file entirely.  Most of  objc-exp.y was always just an out-of-date copy of c-exp.y, anyway;  moving the (rather small) changes into c-exp.y directly not only  allowed us to track changes to the C parser much more smoothly, it  should also allow for much better Objective-C++ support.

You'll probably want to look at the most recent version of our GDB tree  (http://www.opensource.apple.com/projects/darwin/6.0/source/other/gdb- 20020918.tar.gz; no registration or anything similar required), and  check out our changes to c-exp.y; I've attached them for your  convenience.

One downside to having the changes directly in c-exp.y is that I don't know of any good way to conditionalize them; though I am by no means a bison guru.

ObjC is supposed to be a strict superset of C, so at least in theory,
extensions don't need to be conditionalized at all, or they can be
disallowed after parsing, if you wanted to have a "strict C mode"
(although I note that the little array@45 extension is always available,
even though it's not valid C).
(time passes)

(array@45 is documented as a GDB CLI extension).

Keeping the objective C .y separate from the C .y, I think, is a better long term strategy. While it will mean that someone needs to keep the two files in sync, it also means that the objective C, C and C++ parsers are guarenteed to not stomp on each others toes.

Andrew



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]