Closed Bug 265786 Opened 20 years ago Closed 19 years ago

unused variable warnings in QuickDER

Categories

(NSS :: Libraries, defect, P4)

3.9.3
Sun
SunOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julien.pierre, Assigned: julien.pierre)

Details

The gcc compiler generates warnings in the following :

quickder.c: In function `MatchComponentType':
quickder.c:252: warning: unused variable `tagclass'
quickder.c:253: warning: unused variable `expectedclass

The code is #ifdef DEBUG and the variables are never used indeed. For
cleanliness, I would like to eliminate the warning anyway. What's the best way
to do this ? I was thinking of assigning tagclass = tagclass and expectedclass =
expectedclass right after. Are there any compilers that will still warn on those ?
Priority: -- → P4
A trick John Myers told me is to use the
unused variables like this:

    (void)tagclass;
    (void)expectedclass;

Perhaps you can find a more meaningful way
to use them.  I know you want to have access
to the these values in the debugger.
Julien, after looking at the relevant code, I
suggest the following fix:

    unsigned char tagclass;
    unsigned char expectedclass;

    ...
  
    /* first, do a class check */  
    tagclass = tag & SEC_ASN1_CLASS_MASK;
    expectedclass = (unsigned char)kind & SEC_ASN1_CLASS_MASK;  
    if (tagclass != expectedclass)
    {
        *match = PR_FALSE;
        return SECSuccess;
    }
QA Contact: bishakhabanerjee → jason.m.reid
Assignee: wtchang → julien.pierre.bugs
Target Milestone: --- → 3.10
This bug was fixed in 3.10 .
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.