ClassParser bugs & problems

wycc at lingo.ece.uci.edu wycc at lingo.ece.uci.edu
Fri Jun 11 09:49:44 BST 1999



On Fri, 11 Jun 1999, Jonas Nordin wrote:

> > (1) reach end of file when scan declaration.
> What type of declarations?
* case I:

struct node {
    struct node *next;
};

This "struct" will not be recongized because the codes check if it's an
attributes only when the first token is ID. union and const has the same
problem.

case 2:

struct ddpehdr
{
    __u16 deh_len:10,deh_hops:4,deh_pad:2;
 
name and crash when add to QDict because it need variable name as key. The 
parser don't recongize deh_len:10 as an variable declaration. I add the
below lines to let it recognize bit fields

 else if ( lexemStack.top()->type == STRING && lexemStack.count() > 3) {
	delete lexemStack.pop();
	if (lexemStack.top()->type == ':') {
	  lexemStack.pop();
	  aLexem = lexemStack.pop();
	  if (aLexem->type == ID) {
		anAttr->setName(aLexem->text);
	  }
	  delete aLexem;
	}
  } else
	anAttr->setName("notfound");


case 3:
struct board_info static_boards[NUMCARDS]={
        { ENABLED, 0, OFF, 2, (unchar*) 0x320, (unchar*) 0xd0000 },
}; 

No idea yet.

case 4:

struct floppy_raw_cmd {
        unsigned int flags;
#define FD_RAW_READ 1
#define FD_RAW_WRITE 2
#define FD_RAW_NO_MOTOR 4
#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
#define FD_RAW_INTR 8    /* wait for an interrupt */
#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
                                    * completion */



no idea yet. 

case 5:
file asm/unistd.h 

enter infinite loop

  if( lexem == ':' )
    while( lexem != '{' )
      getNextLexem();

at fillInParsedMethod of ClassParser.cc

no idea yet. add test if lexem == 0 to get out of loop.

case 6:
__initfunc(static void mod_setup(char *pattern, void (*setup)(char *, int
*)))
{
        unsigned long i;
        char c;
        int j;
        int match;
        char buffer[100];
        int ints[11];
        int length = strlen(pattern)+1;

        match=0;
        j=1;

        for (i=current->mm->env_start; i< current->mm->env_end; i ++){

It seems that parser can't recognize the function call mod_setup and then
think for is a function name. We don't need to recognize mod_setup, but it
shouldn't block here. I suggest to check ';' here.

For this case, may be we can add an option to parse the preprocessed C
source instead of original one.

case 7:
struct {
    int wed:3,
           :4;
};

It's a valid C codes, although wired!! 


case 8:
struct eata_info {
   ulong  data_len;     /* Number of valid bytes after this field */
   ulong  sign;         /* ASCII "EATA" signature */
   unchar        :4,    /* unused low nibble */
          version:4;    /* EATA version, should be 0x1 */
   unchar  ocsena:1,    /* Overlap Command Support Enabled */
           tarsup:1,    /* Target Mode Supported */
           trnxfr:1,    /* Truncate Transfer Cmd NOT Necessary */
           morsup:1,    /* More Supported */
           dmasup:1,    /* DMA Supported */
           drqvld:1,    /* DRQ Index (DRQX) is valid */
              ata:1,    /* This is an ATA device */
           haaval:1;    /* Host Adapter Address Valid */
  
crashed!


continue latter.....

Yu-Chung Wang




More information about the KDevelop mailing list