Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Issue 1654373002: C types and utilities to validate and access struct and message headers (Closed)

Created:
4 years, 10 months ago by jamesr
Modified:
4 years, 10 months ago
Reviewers:
viettrungluu
CC:
Aaron Boodman, abarth-chromium, azani, ben+mojo_chromium.org, darin (slow to review), gregsimon, mojo-reviews_chromium.org, qsr+mojo_chromium.org, vardhan, viettrungluu+watch_chromium.org, yzshen+mojopublicwatch_chromium.org
Base URL:
git@github.com:domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

C types and utilities to validate and access struct and message headers This provides simple C types and utilities for validating Mojo struct and message headers and accessing their data. These utilities are written in C without any dependencies other than typedefs from the stdbool.h and stdint.h headers so they should be usable in programs that use different libcs or no libc at all. These utilities are general for all struct / messages, there's no codegen (yet) for particular structures or interfaces. As such it's difficult to reuse the existing validation conformance tests as they do not distinguish cleanly between tests for the Mojo archive format and tests for mojom-generated interfaces. For now tests for these routine are hand written reusing the validation input format but ideally they would share data with the validation tests for other languages. R=viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/0ba8e9e0eb08e291e6989477201345e043dc3aa8

Patch Set 1 #

Total comments: 2

Patch Set 2 : #

Total comments: 16

Patch Set 3 : #

Total comments: 4

Patch Set 4 : review feedback, for trybots #

Unified diffs Side-by-side diffs Delta from patch set Stats (+365 lines, -4 lines) Patch
M mojo/BUILD.gn View 2 chunks +8 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/BUILD.gn View 1 chunk +16 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/lib/message.c View 1 2 3 1 chunk +50 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/lib/struct.c View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/message.h View 1 2 1 chunk +42 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/struct.h View 1 2 1 chunk +29 lines, -0 lines 0 comments Download
A + mojo/public/c/bindings/tests/BUILD.gn View 1 2 3 3 chunks +4 lines, -4 lines 0 comments Download
A mojo/public/c/bindings/tests/bindings_unittest.cc View 1 2 3 1 chunk +188 lines, -0 lines 0 comments Download
M mojo/tools/data/unittests View 1 2 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (2 generated)
jamesr
I want to write some test programs in C with nostdlib and need some utilities ...
4 years, 10 months ago (2016-02-01 23:59:42 UTC) #2
jamesr
https://codereview.chromium.org/1654373002/diff/1/mojo/public/c/bindings/struct.h File mojo/public/c/bindings/struct.h (right): https://codereview.chromium.org/1654373002/diff/1/mojo/public/c/bindings/struct.h#newcode24 mojo/public/c/bindings/struct.h:24: _Static_assert(sizeof(mojo_struct_header_t) == 8u, this is kind of annoying. the ...
4 years, 10 months ago (2016-02-02 00:03:23 UTC) #3
viettrungluu
https://codereview.chromium.org/1654373002/diff/1/mojo/public/c/bindings/struct.h File mojo/public/c/bindings/struct.h (right): https://codereview.chromium.org/1654373002/diff/1/mojo/public/c/bindings/struct.h#newcode24 mojo/public/c/bindings/struct.h:24: _Static_assert(sizeof(mojo_struct_header_t) == 8u, On 2016/02/02 00:03:23, jamesr wrote: > ...
4 years, 10 months ago (2016-02-02 00:09:34 UTC) #4
jamesr
I think that works (the trybots will confirm) but it's a little dodgy since the ...
4 years, 10 months ago (2016-02-02 00:27:35 UTC) #5
viettrungluu
https://codereview.chromium.org/1654373002/diff/20001/mojo/public/c/bindings/lib/message.c File mojo/public/c/bindings/lib/message.c (right): https://codereview.chromium.org/1654373002/diff/20001/mojo/public/c/bindings/lib/message.c#newcode13 mojo/public/c/bindings/lib/message.c:13: #define MESSAGE_EXPECTS_RESPONSE (1 << 0u) Probably these should be ...
4 years, 10 months ago (2016-02-02 00:48:48 UTC) #6
jamesr
https://codereview.chromium.org/1654373002/diff/20001/mojo/public/c/bindings/lib/message.c File mojo/public/c/bindings/lib/message.c (right): https://codereview.chromium.org/1654373002/diff/20001/mojo/public/c/bindings/lib/message.c#newcode13 mojo/public/c/bindings/lib/message.c:13: #define MESSAGE_EXPECTS_RESPONSE (1 << 0u) On 2016/02/02 at 00:48:47, ...
4 years, 10 months ago (2016-02-02 00:55:04 UTC) #7
jamesr
Unless I'm missing something it looks like zlib, libpng, libxml, freetype, opengl, egl, libevent, etc ...
4 years, 10 months ago (2016-02-02 01:20:31 UTC) #8
jamesr
PTAL. Latest patch puts the flag macros in the header, uses const pointers, uses size_t ...
4 years, 10 months ago (2016-02-02 01:30:28 UTC) #9
viettrungluu
lgtm w/nits Possibly we should ponder our C style though (c_hacker_style_function_names()? underscore_t_for_typedefs_t?). https://codereview.chromium.org/1654373002/diff/20001/mojo/public/c/bindings/lib/message.c File mojo/public/c/bindings/lib/message.c ...
4 years, 10 months ago (2016-02-02 18:19:16 UTC) #10
jamesr
4 years, 10 months ago (2016-02-03 18:40:50 UTC) #12
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
0ba8e9e0eb08e291e6989477201345e043dc3aa8 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698