|
Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas.
Note that compilers have trouble mixing __attribute__((...))
syntax with alignas(...) syntax.
// doesn't work in clang or gcc
struct alignas(16) __attribute__((packed)) S { char c; };
// works in clang but not gcc
struct __attribute__((packed)) alignas(16) S2 { char c; };
// works in clang and gcc
struct alignas(16) S3 { char c; } __attribute__((packed));
Note that there are also some attributes that must be specified
*before* a class definition: visibility (used for exporting
functions/classes) is one of these attributes. This means that
it is not possible to have use alignas() with a class that is
marked as exported.
In the Chromium codebase, there were two locations that
encountered these issues:
- media code marks some structs as aligned and exported.
However, since these structs are simply PODs and the full
definition is in the header, marking them as exported is
unnecessary. The fix is to remove the exported attribute.
- crashpad code marks some structs as aligned and packed. The
fix is to simply move the packed attribute after the
definition, verifying that clang/gcc still pack the structs
the same way.
If there are future instances of structs/classes that need to be
aligned and exported, the plan is to move to C++11 attribute
syntax for visibility attributes, which does work with alignas().
BUG= 688061
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
Total comments: 7
Total comments: 3
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+110 lines, -174 lines) |
Patch |
|
M |
base/compiler_specific.h
|
View
|
|
1 chunk |
+0 lines, -19 lines |
0 comments
|
Download
|
|
M |
base/containers/stack_container.h
|
View
|
1
2
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/containers/stack_container_unittest.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/lazy_instance.h
|
View
|
1
2
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
base/lazy_instance_unittest.cc
|
View
|
1
2
3
4
5
6
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/memory/aligned_memory.h
|
View
|
|
2 chunks |
+17 lines, -43 lines |
0 comments
|
Download
|
|
M |
base/memory/aligned_memory_unittest.cc
|
View
|
1
2
3
4
5
6
|
1 chunk |
+21 lines, -37 lines |
0 comments
|
Download
|
|
M |
base/memory/manual_constructor.h
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/memory/singleton.h
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/memory/singleton_unittest.cc
|
View
|
1
2
3
4
5
6
|
1 chunk |
+9 lines, -6 lines |
0 comments
|
Download
|
|
M |
base/metrics/persistent_memory_allocator.h
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
base/process/launch_posix.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
cc/base/contiguous_container.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
cc/base/contiguous_container_unittest.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
cc/raster/texture_compressor_etc1.h
|
View
|
|
1 chunk |
+4 lines, -9 lines |
0 comments
|
Download
|
|
M |
cc/raster/texture_compressor_etc1_sse.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/tracing/core/proto_zero_message.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+4 lines, -3 lines |
0 comments
|
Download
|
|
M |
content/renderer/devtools/lock_free_circular_queue.h
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
media/base/audio_parameters.h
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
net/quic/platform/impl/quic_aligned_impl.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
sandbox/linux/services/credentials.cc
|
View
|
1
2
3
5
6
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
styleguide/c++/c++11.html
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
third_party/crashpad/crashpad/minidump/minidump_context.h
|
View
|
1
2
3
|
2 chunks |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
third_party/crashpad/crashpad/minidump/minidump_extensions.h
|
View
|
1
2
3
4
|
11 chunks |
+16 lines, -16 lines |
0 comments
|
Download
|
|
M |
third_party/crashpad/crashpad/util/stdlib/aligned_allocator.h
|
View
|
1
2
3
|
3 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
Total messages: 64 (38 generated)
|