Closed Bug 764104 Opened 13 years ago Closed 13 years ago

Compilation fails if C++ keyword used in WebIDL enum.

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: wchen, Assigned: bzbarsky)

Details

Attachments

(1 file)

WebIDL enum containing a C++ keyword will generate C++ a enum that contain the keyword, causing compilation to fail. Example: enum NotificationPermission { "default", "denied", "granted" }; taken from (http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html#api) will generate: enum valuelist { default, denied, granted }; The enum above will fail to compile due to the "default" keyword (at least in clang).
Yeah, this is a bit of a PITA. One option is to upcase the first character of each enum value. So we would have: enum valuelist { Default, Denied, Granted }; Another is to add more special cases to getEnumValueName (there's already a special case for "", but we could add one for "default").
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Attachment #632504 - Flags: review?(peterv) → review+
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla16
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: