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 3 // found in the LICENSE file. 4 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 7 // that are closely related to things that are commonly used that belong in this 8 // file.) 9 10 #ifndef PDFIUM_THIRD_PARTY_BASE_MACROS_H_ 11 #define PDFIUM_THIRD_PARTY_BASE_MACROS_H_ 12 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 15 // size of a static array: 16 // 17 // COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, 18 // content_type_names_incorrect_size); 19 // 20 // or to make sure a struct is smaller than a certain size: 21 // 22 // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); 23 // 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 26 // containing the name of the variable. 27 28 #undef COMPILE_ASSERT 29 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) 30 31 #endif // PDFIUM_THIRD_PARTY_BASE_MACROS_H_ 32