Closed Bug 1677962 Opened 4 years ago Closed 3 years ago

Use cbindgen to generate FFI declarations

Categories

(Toolkit :: Telemetry, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: janerik, Assigned: janerik)

References

Details

(Whiteboard: [telemetry:fog:m6])

Attachments

(1 file)

Right now we use manually-defined extern "C" blocks in the metric type implementations in C++.

We should auto-generate them using cbindgen, our build tooling has support for that, see e.g. https://searchfox.org/mozilla-central/rev/277ab3925eae21b419167a34624ec0ab518d0c94/dom/media/moz.build#364-372

Assignee: nobody → jrediger
Priority: P3 → P1
Whiteboard: [telemetry:fog:m?] → [telemetry:fog:m6]

cbindgen can work with expanded macros, but it requires a nightly rustc
to do its work.
We can't rely on a nightly compiler though, so the solution is:
Manually define the outer parts of the FFI function and use a macro for
the repetitive inner parts.
This also more easily allows for type conversions where needed.

Blocks: 1678583
Depends on: 1675286
Pushed by jrediger@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b3b6cfebc8e3
Generate FFI definitions using cbindgen.  r=emilio,chutten
Pushed by jrediger@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c01c54b11cc5
Generate FFI definitions using cbindgen.  r=emilio,chutten
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: