emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem report #3


From: Dan Nicolaescu
Subject: Problem report #3
Date: Sun, 30 Apr 2006 09:42:05 -0700

CID: 3
Checker: DEADCODE (help)
File: emacs/lib-src/etags.c
Function: C_entries
Description: After this line, the value of "c" is equal to 47

3208    static void
3209    C_entries (c_ext, inf)
3210         int c_ext;                 /* extension of C */
3211         FILE *inf;                 /* input file */
3212    {
3213      register char c;              /* latest char read; '\0' for end of 
line */
3214      register char *lp;            /* pointer one beyond the character `c' 
*/
3215      int curndx, newndx;           /* indices for current and new lb */
3216      register int tokoff;          /* offset in line of start of current 
token */
3217      register int toklen;          /* length of current token */
3218      char *qualifier;              /* string used to qualify names */
3219      int qlen;                     /* length of qualifier */
3220      int bracelev;                 /* current brace level */
3221      int bracketlev;               /* current bracket level */
3222      int parlev;                   /* current parenthesis level */
3223      int attrparlev;               /* __attribute__ parenthesis level */
3224      int templatelev;              /* current template level */
3225      int typdefbracelev;           /* bracelev where a typedef struct body 
begun */
3226      bool incomm, inquote, inchar, quotednl, midtoken;
3227      bool yacc_rules;              /* in the rules part of a yacc file */
3228      struct tok savetoken;         /* token saved during preprocessor 
handling */
3229    
3230    
3231      linebuffer_init (&lbs[0].lb);
3232      linebuffer_init (&lbs[1].lb);
3233      if (cstack.size == 0)
3234        {
3235          cstack.size = (DEBUG) ? 1 : 4;
3236          cstack.nl = 0;
3237          cstack.cname = xnew (cstack.size, char *);
3238          cstack.bracelev = xnew (cstack.size, int);
3239        }
3240    
3241      tokoff = toklen = typdefbracelev = 0; /* keep compiler quiet */
3242      curndx = newndx = 0;
3243      lp = curlb.buffer;
3244      *lp = 0;
3245    
3246      fvdef = fvnone; fvextern = FALSE; typdef = tnone;
3247      structdef = snone; definedef = dnone; objdef = onone;
3248      yacc_rules = FALSE;
3249      midtoken = inquote = inchar = incomm = quotednl = FALSE;
3250      token.valid = savetoken.valid = FALSE;
3251      bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
3252      if (cjava)
3253        { qualifier = "."; qlen = 1; }
3254      else
3255        { qualifier = "::"; qlen = 2; }
3256    
3257    
3258      while (!feof (inf))
3259        {
3260          c = *lp++;

Event equality_cond: Cond "c == 92" evaluated as false
Also see events: 
[dead_error_line][dead_error_condition][new_values][assignment][new_values][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3261          if (c == '\\')
3262            {
3263              /* If we are at the end of the line, the next character is a
3264                 '\0'; do not skip it, because it is what tells us
3265                 to read the next line.  */
3266              if (*lp == '\0')
3267                {
3268                  quotednl = TRUE;
3269                  continue;
3270                }
3271              lp++;

Event assignment: Assigning "32" to "c"
Event const: After this line, the value of "c" is equal to 32
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][new_values][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3272              c = ' ';
3273            }
3274          else if (incomm)
3275            {
3276              switch (c)
3277                {
3278                case '*':
3279                  if (*lp == '/')
3280                    {
3281                      c = *lp++;
3282                      incomm = FALSE;
3283                    }
3284                  break;
3285                case '\0':
3286                  /* Newlines inside comments do not end macro definitions 
in
3287                     traditional cpp. */
3288                  CNL_SAVE_DEFINEDEF ();
3289                  break;
3290                }
3291              continue;
3292            }
3293          else if (inquote)
3294            {
3295              switch (c)
3296                {
3297                case '"':
3298                  inquote = FALSE;
3299                  break;
3300                case '\0':
3301                  /* Newlines inside strings do not end macro definitions
3302                     in traditional cpp, even though compilers don't
3303                     usually accept them. */
3304                  CNL_SAVE_DEFINEDEF ();
3305                  break;
3306                }
3307              continue;
3308            }
3309          else if (inchar)
3310            {
3311              switch (c)
3312                {
3313                case '\0':
3314                  /* Hmmm, something went wrong. */
3315                  CNL ();
3316                  /* FALLTHRU */
3317                case '\'':
3318                  inchar = FALSE;
3319                  break;
3320                }
3321              continue;
3322            }
3323          else if (bracketlev > 0)
3324            {
3325              switch (c)
3326                {
3327                case ']':
3328                  if (--bracketlev > 0)
3329                    continue;
3330                  break;
3331                case '\0':
3332                  CNL_SAVE_DEFINEDEF ();
3333                  break;
3334                }
3335              continue;
3336            }

Event const: After this line, the value of "c" is equal to 34
Event const: After this line, the value of "c" is equal to 37
Event const: After this line, the value of "c" is equal to 39
Event const: After this line, the value of "c" is equal to 47
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][new_values][const][const][const][assignment][equality_cond][const][const][const]

3337          else switch (c)
3338            {

Event new_values: Conditional "c == 34"
Also see events: 
[dead_error_line][dead_error_condition][equality_cond][assignment][new_values][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3339            case '"':
3340              inquote = TRUE;
3341              if (inattribute)
3342                break;
3343              switch (fvdef)
3344                {
3345                case fdefunkey:
3346                case fstartlist:
3347                case finlist:
3348                case fignore:
3349                case vignore:
3350                  break;
3351                default:
3352                  fvextern = FALSE;
3353                  fvdef = fvnone;
3354                }
3355              continue;

Event new_values: Conditional "c == 39"
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3356            case '\'':
3357              inchar = TRUE;
3358              if (inattribute)
3359                break;
3360              if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3361                {
3362                  fvextern = FALSE;
3363                  fvdef = fvnone;
3364                }
3365              continue;

Event new_values: Conditional "c == 47"
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3366            case '/':
3367              if (*lp == '*')
3368                {
3369                  lp++;
3370                  incomm = TRUE;
3371                  continue;
3372                }
3373              else if (/* cplpl && */ *lp == '/')
3374                {

Event const: After this line, the value of "c" is equal to 0
Event assignment: Assigning "0" to "c"
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][new_values][const][const][assignment][const][equality_cond][const][const][const]

3375                  c = '\0';
3376                  break;
3377                }
3378              else
3379                break;

Event new_values: Conditional "c == 37"
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][const][const][const][assignment][const][equality_cond][const][const][const]

3380            case '%':
3381              if ((c_ext & YACC) && *lp == '%')
3382                {
3383                  /* Entering or exiting rules section in yacc file. */
3384                  lp++;
3385                  definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3386                  typdef = tnone; structdef = snone;
3387                  midtoken = inquote = inchar = incomm = quotednl = FALSE;
3388                  bracelev = 0;
3389                  yacc_rules = !yacc_rules;
3390                  continue;
3391                }
3392              else
3393                break;
3394            case '#':
3395              if (definedef == dnone)
3396                {
3397                  char *cp;
3398                  bool cpptoken = TRUE;
3399    
3400                  /* Look back on this line.  If all blanks, or nonblanks
3401                     followed by an end of comment, this is a preprocessor
3402                     token. */
3403                  for (cp = newlb.buffer; cp < lp-1; cp++)
3404                    if (!iswhite (*cp))
3405                      {
3406                        if (*cp == '*' && *(cp+1) == '/')
3407                          {
3408                            cp++;
3409                            cpptoken = TRUE;
3410                          }
3411                        else
3412                          cpptoken = FALSE;
3413                      }
3414                  if (cpptoken)
3415                    definedef = dsharpseen;
3416                } /* if (definedef == dnone) */
3417              continue;
3418            case '[':
3419              bracketlev++;
3420                continue;
3421            } /* switch (c) */
3422    
3423    
3424          /* Consider token only if some involved conditions are satisfied. 
*/
3425          if (typdef != tignore
3426              && definedef != dignorerest
3427              && fvdef != finlist
3428              && templatelev == 0
3429              && (definedef != dnone
3430                  || structdef != scolonseen)
3431              && !inattribute)
3432            {
3433              if (midtoken)
3434                {
3435                  if (endtoken (c))
3436                    {

Event const: After this line, the value of "c" is equal to 32
Event equality_cond: Cond "c == 58" evaluated as false
Also see events: 
[dead_error_line][dead_error_condition][new_values][equality_cond][assignment][new_values][new_values][new_values][const][const][assignment][const][equality_cond][const][const][const]

3437                      if (c == ':' && *lp == ':' && begtoken (lp[1]))
3438                        /* This handles :: in the middle,
3439                           but not at the beginning of an identifier.
3440                           Also, space-separated :: is not recognised. */
3441                        {
3442                          if (c_ext & C_AUTO) /* automatic detection of C++ 
*/
3443                            c_ext = (c_ext | C_PLPL) & ~C_AUTO;
3444                          lp += 2;
3445                          toklen += 2;
3446                          c = lp[-1];
3447                          goto still_in_token;
3448                        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]