|
Make a new test to enforce the sizes of all structs and enums in the C API.
Originally, I was going to just run through and add the asserts manually after each definition, but I decided to experiment with Clang and try to automate it. The Clang plugin I wrote and ran is here:
/home/dmichael/www/clang_plugins/PrintNamesAndSizes.cpp
I used that and some simple search/replace to make test_c_sizes.c. The idea is that the sizes need to be consistent across platforms & compilers. Also, if the size is consistent should (in all practical cases) imply that the alignment is also the same. It's possible that if we added other architectures where e.g. floats are a different size, we'd need to make a 'test_c_sizes' for each platform family... but for now, I think all our platforms have the same size for all the structs (which is nice).
I would love to add this tool somewhere, but I have no idea where (if anywhere) would make sense to put it. If it was checked-in, we could run it periodically or as part of a gyp action to make sure we know if we change the size of something in the C ABI.
BUG= 61004, 92983
TEST=test_c_sizes.c
Closing uncommitted; I broke this up in to these 2:
http://codereview.chromium.org/5730003
http://codereview.chromium.org/5730004
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+839 lines, -199 lines) |
Patch |
 |
M |
ppapi/c/dev/pp_cursor_type_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/pp_file_info_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/pp_video_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
12 chunks |
+42 lines, -7 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_audio_config_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_char_set_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_directory_reader_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+8 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_file_chooser_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_file_io_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_font_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
6 chunks |
+16 lines, -3 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_opengles_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+14 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_scrollbar_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppb_url_util_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/dev/ppp_printing_dev.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_bool.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_input_event.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
7 chunks |
+7 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_instance.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_macros.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+34 lines, -1 line |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_module.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_point.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_rect.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_resource.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_size.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_time.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/pp_var.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+13 lines, -6 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/ppb_image_data.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/ppb_url_request_info.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/ppb_url_response_info.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/c/ppb_var.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+10 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/generate_ppapi_include_tests.py
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
4 chunks |
+18 lines, -11 lines |
0 comments
|
Download
|
 |
A |
ppapi/generate_ppapi_size_checks.py
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+334 lines, -0 lines |
0 comments
|
Download
|
 |
M |
ppapi/ppapi.gyp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+6 lines, -2 lines |
0 comments
|
Download
|
 |
A + |
ppapi/tests/all_c_includes.h
|
View
|
1
2
3
4
5
6
7
|
3 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
 |
A |
ppapi/tests/all_c_sizes.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+42 lines, -0 lines |
0 comments
|
Download
|
 |
A |
ppapi/tests/all_cpp_includes.h
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+56 lines, -0 lines |
0 comments
|
Download
|
 |
A |
ppapi/tests/all_sizes_32.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+79 lines, -0 lines |
0 comments
|
Download
|
 |
A |
ppapi/tests/all_sizes_64.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+79 lines, -0 lines |
0 comments
|
Download
|
 |
D |
ppapi/tests/test_c_includes.c
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+4 lines, -69 lines |
0 comments
|
Download
|
 |
M |
ppapi/tests/test_cc_includes.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+0 lines, -53 lines |
0 comments
|
Download
|
 |
A + |
ppapi/tests/test_cpp_includes.cc
|
View
|
1
2
3
4
5
6
7
|
2 chunks |
+2 lines, -45 lines |
0 comments
|
Download
|
 |
A |
ppapi/tests/test_struct_sizes_c.c
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+17 lines, -0 lines |
0 comments
|
Download
|
 |
A |
ppapi/tests/test_struct_sizes_cpp.cc
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+16 lines, -0 lines |
0 comments
|
Download
|
Total messages: 15 (0 generated)
|