Closed Bug 518880 Opened 15 years ago Closed 15 years ago

Add support for warning/error'ing when important return values are unused

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 441324

People

(Reporter: cjones, Assigned: cjones)

Details

Attachments

(1 file)

(Platform/OS should really read "any on which we use a compiler supporting a warn_unused_result-type attribute".)

In Electrolysis, we call functions that end up sending IPC messages to other processes.  *Any* invocation of these functions may fail, since the other process may die completely unpredictably.  I'm sure there are other functions like this in mozilla-central (networking comes to mind).

So we want to ensure that the return value from such functions is always checked.  gcc's __attribute__((warn_unused_result)) is a start, and -Werror=warn_unused_result (or whatever it is) is even better.  A static analysis that makes warn_unused_result a transitive property is best of all.
Attached patch adds NS_WARN_UNUSED macro (deleted) — Splinter Review
Not tryserver'ing because this is just code taken from bug 441324.
Attachment #402876 - Flags: review?(benjamin)
Infallible malloc is about ready to land, and that patch incidentally adds this attribute.  (RESOLVED SUBSUMED would be more appropriate.)
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Attachment #402876 - Flags: review?(benjamin)
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: