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

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed)

Created:
10 years ago by dmichael(do not use this one)
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Add compile assertions to enforce the sizes of all structs and enums in the C API. Adjust some structs to make their sizes consistent across architectures. Note that some structs contain pointers, so are difficult to make consistent between 32-bit and 64-bit. Those types are in test_struct_sizes.c. Other types have a compile assertion immediately after their definition. This was broken off from a bigger CL: http://codereview.chromium.org/5340003/ BUG=61004, 92983 TEST=test_struct_sizes.c, compile assertions throughout See this CL for the code that helped generate the static assertions and find affected interfaces: http://codereview.chromium.org/5730003 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=69038

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+372 lines, -212 lines) Patch
M ppapi/c/dev/pp_cursor_type_dev.h View 2 chunks +3 lines, -0 lines 0 comments Download
M ppapi/c/dev/pp_file_info_dev.h View 3 chunks +4 lines, -0 lines 0 comments Download
M ppapi/c/dev/pp_video_dev.h View 13 chunks +52 lines, -7 lines 1 comment Download
M ppapi/c/dev/ppb_audio_config_dev.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/dev/ppb_char_set_dev.h View 2 chunks +3 lines, -1 line 0 comments Download
M ppapi/c/dev/ppb_directory_reader_dev.h View 2 chunks +11 lines, -2 lines 0 comments Download
M ppapi/c/dev/ppb_file_chooser_dev.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/dev/ppb_file_io_dev.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/dev/ppb_file_ref_dev.h View 1 chunk +1 line, -1 line 0 comments Download
M ppapi/c/dev/ppb_font_dev.h View 6 chunks +16 lines, -3 lines 0 comments Download
M ppapi/c/dev/ppb_opengles_dev.h View 1 chunk +15 lines, -0 lines 0 comments Download
M ppapi/c/dev/ppb_scrollbar_dev.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/dev/ppb_transport_dev.h View 1 chunk +1 line, -1 line 0 comments Download
M ppapi/c/dev/ppb_url_util_dev.h View 3 chunks +4 lines, -1 line 0 comments Download
M ppapi/c/dev/ppb_video_decoder_dev.h View 1 chunk +1 line, -1 line 0 comments Download
M ppapi/c/dev/ppp_printing_dev.h View 4 chunks +5 lines, -0 lines 0 comments Download
M ppapi/c/pp_bool.h View 1 chunk +0 lines, -1 line 0 comments Download
M ppapi/c/pp_input_event.h View 7 chunks +7 lines, -0 lines 0 comments Download
M ppapi/c/pp_instance.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/pp_macros.h View 2 chunks +10 lines, -1 line 0 comments Download
M ppapi/c/pp_module.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/pp_point.h View 1 chunk +1 line, -0 lines 0 comments Download
M ppapi/c/pp_rect.h View 1 chunk +1 line, -0 lines 0 comments Download
M ppapi/c/pp_resource.h View 2 chunks +2 lines, -0 lines 0 comments Download
M ppapi/c/pp_size.h View 1 chunk +1 line, -0 lines 0 comments Download
M ppapi/c/pp_time.h View 2 chunks +4 lines, -0 lines 0 comments Download
M ppapi/c/pp_var.h View 3 chunks +13 lines, -6 lines 0 comments Download
M ppapi/c/ppb_class.h View 1 chunk +1 line, -1 line 0 comments Download
M ppapi/c/ppb_image_data.h View 3 chunks +3 lines, -0 lines 0 comments Download
M ppapi/c/ppb_instance.h View 1 chunk +1 line, -1 line 0 comments Download
M ppapi/c/ppb_url_request_info.h View 2 chunks +3 lines, -1 line 0 comments Download
M ppapi/c/ppb_url_response_info.h View 2 chunks +3 lines, -1 line 0 comments Download
M ppapi/c/ppb_var.h View 3 chunks +11 lines, -1 line 0 comments Download
M ppapi/generate_ppapi_include_tests.py View 5 chunks +19 lines, -12 lines 0 comments Download
M ppapi/ppapi.gyp View 3 chunks +6 lines, -2 lines 0 comments Download
A + ppapi/tests/all_c_includes.h View 3 chunks +5 lines, -1 line 0 comments Download
A ppapi/tests/all_cpp_includes.h View 1 chunk +57 lines, -0 lines 0 comments Download
A ppapi/tests/arch_dependent_sizes_32.h View 1 chunk +31 lines, -0 lines 0 comments Download
A ppapi/tests/arch_dependent_sizes_64.h View 1 chunk +31 lines, -0 lines 0 comments Download
R ppapi/tests/test_c_includes.c View 1 chunk +4 lines, -69 lines 0 comments Download
D ppapi/tests/test_cc_includes.cc View 1 chunk +0 lines, -53 lines 0 comments Download
A + ppapi/tests/test_cpp_includes.cc View 2 chunks +2 lines, -45 lines 0 comments Download
A ppapi/tests/test_struct_sizes.c View 1 chunk +28 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
dmichael(do not use this one)
10 years ago (2010-12-10 22:18:17 UTC) #1
neb
LGTM On 2010/12/10 22:18:17, dmichael wrote:
10 years ago (2010-12-11 01:02:12 UTC) #2
sehr (please use chromium)
LGTM here also. On Fri, Dec 10, 2010 at 5:02 PM, <neb@chromium.org> wrote: > LGTM ...
10 years ago (2010-12-11 01:03:42 UTC) #3
darin (slow to review)
http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h File ppapi/c/dev/pp_video_dev.h (right): http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h#newcode264 ppapi/c/dev/pp_video_dev.h:264: // In some 32-bit platforms (NaCl and Win32), this ...
10 years ago (2010-12-13 08:24:57 UTC) #4
dmichael(do not use this one)
On 2010/12/13 08:24:57, darin wrote: > http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h > File ppapi/c/dev/pp_video_dev.h (right): > > http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h#newcode264 > ...
10 years ago (2010-12-13 16:47:45 UTC) #5
neb
10 years ago (2010-12-13 18:16:23 UTC) #6
On 2010/12/13 16:47:45, dmichael wrote:
> On 2010/12/13 08:24:57, darin wrote:
> > http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h
> > File ppapi/c/dev/pp_video_dev.h (right):
> > 
> >
>
http://codereview.chromium.org/5674004/diff/1/ppapi/c/dev/pp_video_dev.h#newc...
> > ppapi/c/dev/pp_video_dev.h:264: // In some 32-bit platforms (NaCl and
Win32),
> > this struct is 8-byte aligned
> > Is this comment out-dated now that PP_Resource has changed from an int64_t
to
> an
> > int32_t?
> It appears to me that PP_Resource has not yet changed:
> http://www.google.com/codesearch/p#OAMlx_jo-ck/src/ppapi/c/pp_resource.h
> When it does, I (or whoever changes pp_resource.h) can re-run my tools I made
> and it should take care of fixing up size checks appropriately.  At that time
we
> should also be able to take out at least this padding and associated comments,
> and maybe other padding too.
> 
> Brett or Neb...  Any idea when PP_Resource will change?  Should I wait to land
> this after, since that will affect so many structs?


That'd be me. I am still waiting to land the resource management patch to NaCl
before I land the PP_Resource patch that Bill wrote. Until then, resources are
still 64 bit.

Powered by Google App Engine
This is Rietveld 408576698