| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains macros and macro-like constructs (e.g., templates) that | 5 // This file contains macros and macro-like constructs (e.g., templates) that |
| 6 // are commonly used throughout Chromium source. (It may also contain things | 6 // are commonly used throughout Chromium source. (It may also contain things |
| 7 // that are closely related to things that are commonly used that belong in this | 7 // that are closely related to things that are commonly used that belong in this |
| 8 // file.) | 8 // file.) |
| 9 | 9 |
| 10 #ifndef BASE_MACROS_H_ | 10 #ifndef PDFIUM_THIRD_PARTY_BASE_MACROS_H_ |
| 11 #define BASE_MACROS_H_ | 11 #define PDFIUM_THIRD_PARTY_BASE_MACROS_H_ |
| 12 | 12 |
| 13 // The COMPILE_ASSERT macro can be used to verify that a compile time | 13 // The COMPILE_ASSERT macro can be used to verify that a compile time |
| 14 // expression is true. For example, you could use it to verify the | 14 // expression is true. For example, you could use it to verify the |
| 15 // size of a static array: | 15 // size of a static array: |
| 16 // | 16 // |
| 17 // COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, | 17 // COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, |
| 18 // content_type_names_incorrect_size); | 18 // content_type_names_incorrect_size); |
| 19 // | 19 // |
| 20 // or to make sure a struct is smaller than a certain size: | 20 // or to make sure a struct is smaller than a certain size: |
| 21 // | 21 // |
| 22 // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); | 22 // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); |
| 23 // | 23 // |
| 24 // The second argument to the macro is the name of the variable. If | 24 // The second argument to the macro is the name of the variable. If |
| 25 // the expression is false, most compilers will issue a warning/error | 25 // the expression is false, most compilers will issue a warning/error |
| 26 // containing the name of the variable. | 26 // containing the name of the variable. |
| 27 | 27 |
| 28 #undef COMPILE_ASSERT | 28 #undef COMPILE_ASSERT |
| 29 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) | 29 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) |
| 30 | 30 |
| 31 #endif // BASE_MACROS_H_ | 31 #endif // PDFIUM_THIRD_PARTY_BASE_MACROS_H_ |
| OLD | NEW |