Closed Bug 1480331 Opened 7 years ago Closed 3 years ago

Decide what to do wrt exceptions in libjsoncpp

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: glandium, Assigned: mozbugz)

References

Details

Attachments

(1 file)

The toolkit/components/jsoncpp/src/lib_json/moz.build file contains the following comment: # This code is only used in the stand-alone minidump analyzer executable so # enabling exceptions should be fine. This was true when it was written, but is not true anymore, as of bug 1341423, which now ends up linking jsoncpp to libxul.

I've just hit this when I started using it to construct JSON structures, Coverity complained that I used functions that throw! (Coverity CID 1507054 "Uncaught exception".)

I think we should just compile it without exceptions everywhere, for easier integration in Firefox. After a quick search, I didn't find any code that used JsonCpp and exceptions.
I'll push a patch for review soon.

Assignee: nobody → gsquelart

JsonCpp is used in different places around Firefox, which is normally built
without exception handling, so we don't want JsonCpp to throw.
Because we don't want to modify the JsonCpp files themselves (to ease future
update from the source), and some of its headers are directly included around
Firefox, we need to define JSON_USE_EXCEPTION to be 0 everywhere, which can
be done through moz.configure.
JsonCpp replaces its exception-triggering code with C asserts and aborts.

Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ea1db7e224d5 Compile and build JsonCpp without exception handling - r=glandium
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: