Closed Bug 455424 Opened 16 years ago Closed 16 years ago

nssilckt.h defines the enumeration constant 'Lock', which conflicts with C++ code defining a 'Lock' class.

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
3.12.2

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch Proposed patch (obsolete) — Splinter Review
nssilckt.h defines the enumeration constant 'Lock' unconditionally:

typedef enum  {
    FlushTT = 0,
    NewLock = 1,
    Lock = 2,  <=== PROBLEM!
    Unlock = 3,
    DestroyLock = 4,
    NewCondVar = 5,
    WaitCondVar = 6,
    NotifyCondVar = 7,
    NotifyAllCondVar = 8,
    DestroyCondVar = 9,
    NewMonitor = 10,
    EnterMonitor = 11,
    ExitMonitor = 12,
    Notify = 13,
    NotifyAll = 14,
    Wait = 15,
    DestroyMonitor = 16
} nssILockOp;

This conflicts with C++ code that defines a 'Lock' class.

The fix is to move the definition of this enumeration type
into conditionally compiled code.  My proposed patch also
removes PR_BEGIN_EXTERN_C and PR_END_EXTERN_C, which are
not used in our xxxt.h headers by convention.
Attachment #338767 - Flags: review?(alexei.volkov.bugs)
Is this a public header file?
Attached patch Proposed patch v2 (obsolete) — Splinter Review
I added a test case.  Since the C++ rules in coreconf have rotted,
I created the test case in C even though the originally reported problem
is in C++.
Attachment #338767 - Attachment is obsolete: true
Attachment #338889 - Flags: review?(alexei.volkov.bugs)
Attachment #338767 - Flags: review?(alexei.volkov.bugs)
Comment on attachment 338889 [details] [diff] [review]
Proposed patch v2

r=alexei
Attachment #338889 - Flags: review?(alexei.volkov.bugs) → review+
I changed the test program conflict.c to include "nssilckt.h" directly.
I checked in this patch on the NSS trunk (NSS 3.12.2).

RCS file: /cvsroot/mozilla/security/nss/cmd/tests/conflict.c,v
done
Checking in cmd/tests/conflict.c;
/cvsroot/mozilla/security/nss/cmd/tests/conflict.c,v  <--  conflict.c
initial revision: 1.1
done
Checking in cmd/tests/manifest.mn;
/cvsroot/mozilla/security/nss/cmd/tests/manifest.mn,v  <--  manifest.mn
new revision: 1.7; previous revision: 1.6
done
Checking in lib/util/nssilckt.h;
/cvsroot/mozilla/security/nss/lib/util/nssilckt.h,v  <--  nssilckt.h
new revision: 1.7; previous revision: 1.6
done
Attachment #338889 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.12.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: