Closed Bug 623122 Opened 15 years ago Closed 15 years ago

CurrentThreadId does not have a return for an unreachable exit path (missing return)

Categories

(Toolkit :: Crash Reporting, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b10

People

(Reporter: espindola, Assigned: espindola)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
CurrentThreadId is missing a returns which causes clang to produce a warning that because of -Werror=return-type causes the build to fail.
Attachment #501239 - Attachment is patch: true
Attachment #501239 - Attachment mime type: application/octet-stream → text/plain
Attachment #501239 - Flags: review?(ted.mielczarek)
1959 CurrentThreadId() 1960 { 1961 #if defined(XP_WIN) 1962 return ::GetCurrentThreadId(); 1963 #elif defined(XP_LINUX) 1964 return sys_gettid(); 1965 #elif defined(XP_MACOSX) 1966 // Just return an index, since Mach ports can't be directly serialized 1967 thread_act_port_array_t threads_for_task; 1968 mach_msg_type_number_t thread_count; 1969 1970 if (task_threads(mach_task_self(), &threads_for_task, &thread_count)) 1971 return -1; 1972 1973 for (unsigned int i = 0; i < thread_count; ++i) { 1974 if (threads_for_task[i] == mach_thread_self()) 1975 return i; 1976 } 1977 #else 1978 # error "Unsupported platform" 1979 #endif 1980 } It's tempting to suggest abort() is better than return -1.
Summary: missing return → CurrentThreadId does not have a return for an unreachable exit path (missing return)
It kind of sucks either way, certainly, but these functions are incredibly unlikely to fail, so maybe an abort makes sense.
Rafael: FWIW, given how small all these patches are, I would have been fine with them all on one bug, like "fix CLang compilation issues in Breakpad".
Assignee: nobody → respindola
Attachment #501239 - Attachment is obsolete: true
Attachment #501239 - Flags: review?(ted.mielczarek)
Attachment #501414 - Flags: review?(ted.mielczarek)
Attachment #501414 - Flags: review?(ted.mielczarek) → review+
Attachment #501414 - Flags: approval2.0?
Attachment #501414 - Flags: approval2.0? → approval2.0+
Status: NEW → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b10
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: