[comp.soft-sys.andrew] Possible bug in class preprocessor

turner@rchland.ibm.com (Mark Turner) (08/09/90)

We've come across a possible bug in the class preprocessor.

It has to do with defining macromethods with the word 'data' in them.

Example:

    class test : view
    {
        macromethods:
          push(char *elem) test_push((self), elem);
    };


when run through the class preprocessor, produces a line in the .ih file
likethis:

    #define test_push(self,elem) \
     test_push(((self)), elem);

which is fine.

However, changing the definition slightly,

    class test : view
    {
        macromethods:
          push(char *data) test_push((self), data);
    };


produces the line

    #define test_push(self,char) \
     test_push(((self)), data);


which fails miserably because nowhere does 'data' appear in the in the
macrodefinition portion.

Even more fun is running the following through the preprocessor:

    class test : view
    {
        macromethods:
          push(data) test_push((self), data);
    };

which produces

    #define test_push(self,rew/include/atk/view.ch) \
     test_push(((self)), data);



I don't know if data is a reserved word, and if so, I could live withit.
 However, there are classes in the distribution  (list, forexample)
which use the word 'data' in their macro definitions.

So is this a bug?

Scott Stekel  -  IBM Rochester

gk5g+@ANDREW.CMU.EDU (Gary Keim) (08/10/90)

Excerpts from misc: 8-Aug-90 Possible bug in class prepr.. Mark
Turner@rchland.ibm. (1204+0)

> I don't know if data is a reserved word, and if so, I could live with
> it.  However, there are classes in the distribution  (list, for example)
> which use the word 'data' in their macro definitions.

> So is this a bug?

From the bugs database located in andrew/bugs.open:

    ID: 1015
    Keyword: class
    Subject: possible bug
    Priority: 2
    Description:  There is a bug in the class preprocessor when the
    word 'data' is used in macromethods.  The macro which gets
    created in the corresponding .ih file is incorrect.  

Yep.  This does have to do with the fact that the word data is used to
begin the data-specification portion of a class header file.  It needs
to be fixed.  For now avoid that usage.

Gary