diff options
author | anujk.sharma <anujk.sharma@samsung.com> | 2015-01-20 07:54:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-20 15:55:38 +0000 |
commit | 1b06a96c05f8ef9e27b23ccbfe5f4976ed8ef123 (patch) | |
tree | 7a432d31dddb3a89a5df23836a4913ec989412f8 /courgette | |
parent | 8bb9afd210e6f841bb68810243d0196d0f8af8e2 (diff) | |
download | chromium_src-1b06a96c05f8ef9e27b23ccbfe5f4976ed8ef123.zip chromium_src-1b06a96c05f8ef9e27b23ccbfe5f4976ed8ef123.tar.gz chromium_src-1b06a96c05f8ef9e27b23ccbfe5f4976ed8ef123.tar.bz2 |
Using "static_assert" in lieu of "COMPILE_ASSERT" in courgete module
All our toolchains support c++'s static_assert now- COMPILE_ASSERT can be removed now.
BUG=442514
Review URL: https://codereview.chromium.org/857153003
Cr-Commit-Position: refs/heads/master@{#312203}
Diffstat (limited to 'courgette')
-rw-r--r-- | courgette/difference_estimator.cc | 3 | ||||
-rw-r--r-- | courgette/encoded_program.cc | 2 | ||||
-rw-r--r-- | courgette/third_party/bsdiff_apply.cc | 4 | ||||
-rw-r--r-- | courgette/third_party/bsdiff_create.cc | 4 | ||||
-rw-r--r-- | courgette/types_win_pe.h | 6 |
5 files changed, 10 insertions, 9 deletions
diff --git a/courgette/difference_estimator.cc b/courgette/difference_estimator.cc index 3b2cddc..f2f09e1 100644 --- a/courgette/difference_estimator.cc +++ b/courgette/difference_estimator.cc @@ -18,7 +18,8 @@ const int kTupleSize = 4; namespace { -COMPILE_ASSERT(kTupleSize >= 4 && kTupleSize <= 8, kTupleSize_between_4_and_8); +static_assert(kTupleSize >= 4 && kTupleSize <= 8, + "kTupleSize should be between 4 and 8"); size_t HashTuple(const uint8* source) { size_t hash1 = *reinterpret_cast<const uint32*>(source); diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc index f198a1b..af173b9 100644 --- a/courgette/encoded_program.cc +++ b/courgette/encoded_program.cc @@ -700,7 +700,7 @@ struct RelocBlockPOD { uint16 relocs[4096]; // Allow up to one relocation per byte of a 4k page. }; -COMPILE_ASSERT(offsetof(RelocBlockPOD, relocs) == 8, reloc_block_header_size); +static_assert(offsetof(RelocBlockPOD, relocs) == 8, "reloc block header size"); class RelocBlock { public: diff --git a/courgette/third_party/bsdiff_apply.cc b/courgette/third_party/bsdiff_apply.cc index 435acc0..48ee1be 100644 --- a/courgette/third_party/bsdiff_apply.cc +++ b/courgette/third_party/bsdiff_apply.cc @@ -49,8 +49,8 @@ BSDiffStatus MBS_ReadHeader(SourceStream* stream, MBSPatchHeader* header) { if (!stream->ReadVarint32(&header->dlen)) return READ_ERROR; // The string will have a NUL terminator that we don't use, hence '-1'. - COMPILE_ASSERT(sizeof(MBS_PATCH_HEADER_TAG) - 1 == sizeof(header->tag), - MBS_PATCH_HEADER_TAG_must_match_header_field_size); + static_assert(sizeof(MBS_PATCH_HEADER_TAG) - 1 == sizeof(header->tag), + "MBS_PATCH_HEADER_TAG must match header field size"); if (memcmp(header->tag, MBS_PATCH_HEADER_TAG, 8) != 0) return UNEXPECTED_ERROR; diff --git a/courgette/third_party/bsdiff_create.cc b/courgette/third_party/bsdiff_create.cc index 6086247..b43b53a 100644 --- a/courgette/third_party/bsdiff_create.cc +++ b/courgette/third_party/bsdiff_create.cc @@ -424,8 +424,8 @@ BSDiffStatus CreateBinaryPatch(SourceStream* old_stream, MBSPatchHeader header; // The string will have a null terminator that we don't use, hence '-1'. - COMPILE_ASSERT(sizeof(MBS_PATCH_HEADER_TAG) - 1 == sizeof(header.tag), - MBS_PATCH_HEADER_TAG_must_match_header_field_size); + static_assert(sizeof(MBS_PATCH_HEADER_TAG) - 1 == sizeof(header.tag), + "MBS_PATCH_HEADER_TAG must match header field size"); memcpy(header.tag, MBS_PATCH_HEADER_TAG, sizeof(header.tag)); header.slen = oldsize; header.scrc32 = CalculateCrc(old, oldsize); diff --git a/courgette/types_win_pe.h b/courgette/types_win_pe.h index 64fd541..eed88af 100644 --- a/courgette/types_win_pe.h +++ b/courgette/types_win_pe.h @@ -29,7 +29,7 @@ struct Section { }; #pragma pack(pop) -COMPILE_ASSERT(sizeof(Section) == 40, section_is_40_bytes); +static_assert(sizeof(Section) == 40, "section size is 40 bytes"); // ImageDataDirectory has same layout as IMAGE_DATA_DIRECTORY structure from // WINNT.H @@ -42,8 +42,8 @@ class ImageDataDirectory { uint32 size_; }; -COMPILE_ASSERT(sizeof(ImageDataDirectory) == 8, - image_data_directory_is_8_bytes); +static_assert(sizeof(ImageDataDirectory) == 8, + "image data directory size is 8 bytes"); //////////////////////////////////////////////////////////////////////////////// |