diff --git a/coffi/coffi.hpp b/coffi/coffi.hpp index 6d6558e..52782e7 100644 --- a/coffi/coffi.hpp +++ b/coffi/coffi.hpp @@ -33,6 +33,12 @@ THE SOFTWARE. #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4996) +// C4250: 'coffi' inherits 'coffi_strings::method' via dominance. +// This is expected and correct — coffi uses diamond virtual inheritance +// (coffi_strings and coffi_symbols both virtually inherit +// string_to_name_provider). The dominant path through coffi_strings +// is the intended resolution; the behavior is well-defined in C++. +#pragma warning(disable : 4250) //#pragma warning(disable:4355) //#pragma warning(disable:4244) #endif diff --git a/coffi/coffi_section.hpp b/coffi/coffi_section.hpp index 1153493..f565b2f 100644 --- a/coffi/coffi_section.hpp +++ b/coffi/coffi_section.hpp @@ -131,18 +131,8 @@ template class section_impl_tmpl : public section COFFI_GET_SET_ACCESS(uint32_t, virtual_address); COFFI_GET_SET_ACCESS(uint32_t, data_offset); COFFI_GET_SET_ACCESS(uint32_t, reloc_offset); - uint32_t get_reloc_count() const { return header.reloc_count; } - void set_reloc_count(uint32_t value) - { - header.reloc_count = - narrow_cast(value); - } - uint32_t get_line_num_count() const { return header.line_num_count; } - void set_line_num_count(uint32_t value) - { - header.line_num_count = - narrow_cast(value); - } + COFFI_GET_SET_ACCESS(uint32_t, reloc_count); + COFFI_GET_SET_ACCESS(uint32_t, line_num_count); COFFI_GET_SET_ACCESS(uint32_t, flags); COFFI_GET_SIZEOF(); diff --git a/coffi/coffi_utils.hpp b/coffi/coffi_utils.hpp index 50153a6..7ab7345 100644 --- a/coffi/coffi_utils.hpp +++ b/coffi/coffi_utils.hpp @@ -65,12 +65,12 @@ THE SOFTWARE. //! Defines a **set_NAME** function for accessing the **NAME** structure field. #define COFFI_SET_ACCESS(TYPE, NAME) \ - void set_##NAME(TYPE value) { header.NAME = value; } + void set_##NAME(TYPE value) { header.NAME = narrow_cast(value); } //! Defines a **get_NAME** and a **set_NAME** functions for accessing the **NAME** structure field. #define COFFI_GET_SET_ACCESS(TYPE, NAME) \ TYPE get_##NAME() const { return header.NAME; } \ - void set_##NAME(TYPE value) { header.NAME = value; } + void set_##NAME(TYPE value) { header.NAME = narrow_cast(value); } //! Disables the **get_NAME** function for prohibiting read accesses to the **NAME** structure field. #define COFFI_GET_ACCESS_NONE(TYPE, NAME) \