Closed Bug 1167453 Opened 10 years ago Closed 10 years ago

Make JSGCTraceKind a C++11 enum class

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This allows us to make the enum names the same as the display names, which allows us to use macro expansions in most of the places where we can't use DispatchTyped, saving us about 50 lines. Also, it looks nicer. It's a pretty big patch, but it's 100% name change. Code removals are all in the form of ripping out switch guts in favor of macro expansions. Otherwise, you should be able to get away with a quick scan.
Attachment #8609089 - Flags: review?(jcoppeard)
Comment on attachment 8609089 [details] [diff] [review] jstrace_kind_as_enum_class-v0.diff Review of attachment 8609089 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/public/TracingAPI.h @@ +49,3 @@ > > // A kind that indicates the real kind should be looked up in the arena. > + OutOfLine = 0x07, I was wondering whether OutOfLine would be better as an external constant. It's not a trace kind itself, and all uses are wrapped in uintptr_t() or equivalent. Also we should probably have asserts that the out of line kinds below all have these bits set.
Attachment #8609089 - Flags: review?(jcoppeard) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
This change causes compilation errors in recent versions of gcc: 0:19.89 In file included from /home/martin/code/obj/cert_mgmt/linux/js/src/jsapi-tests/Unified_cpp_js_src_jsapi-tests2.cpp:2:0: 0:19.89 /home/martin/code/gecko-dev/js/src/jsapi-tests/testGCMarking.cpp: In member function ‘void CCWTestTracer::callback(void**, JS::TraceKind)’: 0:19.89 /home/martin/code/gecko-dev/js/src/jsapi-tests/testGCMarking.cpp:21:43: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘JS::TraceKind’ [-Werror=format=] 0:19.89 printf("kind = %d\n", kind); 0:19.89 ^ 0:19.89 /home/martin/code/gecko-dev/js/src/jsapi-tests/testGCMarking.cpp:22:51: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘JS::TraceKind’ [-Werror=format=] 0:19.89 printf("expectedKind = %d\n", expectedKind); 0:19.89 ^ 0:19.89 cc1plus: all warnings being treated as errors
Forgot gcc --version: gcc (GCC) 5.1.1 20150422 (Red Hat 5.1.1-1)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: