modernize-use-using

This commit is contained in:
Serge Lamikhov-Center 2021-09-07 10:03:19 +03:00
parent c99baabc0b
commit 4dc38f0f34
4 changed files with 25 additions and 42 deletions

View File

@ -926,31 +926,14 @@ struct Elf64_Rela
Elf_Sxword r_addend;
};
template <typename T> constexpr auto ELF32_R_SYM( T i )
{
return ( ( i ) >> 8 );
}
template <typename T> constexpr auto ELF32_R_TYPE( T i )
{
return ( (unsigned char)( i ) );
}
template <typename T1, typename T2> constexpr auto ELF32_R_INFO( T1 s, T2 t )
{
return ( ( ( s ) << 8 ) + (unsigned char)( t ) );
}
#define ELF32_R_SYM( i ) ( ( i ) >> 8 )
#define ELF32_R_TYPE( i ) ( (unsigned char)( i ) )
#define ELF32_R_INFO( s, t ) ( ( ( s ) << 8 ) + (unsigned char)( t ) )
template <typename T> constexpr auto ELF64_R_SYM( T i )
{
return ( ( i ) >> 32 );
}
template <typename T> constexpr auto ELF64_R_TYPE( T i )
{
return ( (i)&0xffffffffL );
}
template <typename T1, typename T2> constexpr auto ELF64_R_INFO( T1 s, T2 t )
{
return ( ( ( (int64_t)( s ) ) << 32 ) + ( (t)&0xffffffffL ) );
}
#define ELF64_R_SYM( i ) ( ( i ) >> 32 )
#define ELF64_R_TYPE( i ) ( (i)&0xffffffffL )
#define ELF64_R_INFO( s, t ) \
( ( ( (int64_t)( s ) ) << 32 ) + ( (t)&0xffffffffL ) )
// Dynamic structure
struct Elf32_Dyn

View File

@ -60,14 +60,14 @@ class elf_header
template <class T> struct elf_header_impl_types;
template <> struct elf_header_impl_types<Elf32_Ehdr>
{
typedef Elf32_Phdr Phdr_type;
typedef Elf32_Shdr Shdr_type;
using Phdr_type = Elf32_Phdr;
using Shdr_type = Elf32_Shdr;
static const unsigned char file_class = ELFCLASS32;
};
template <> struct elf_header_impl_types<Elf64_Ehdr>
{
typedef Elf64_Phdr Phdr_type;
typedef Elf64_Shdr Shdr_type;
using Phdr_type = Elf64_Phdr;
using Shdr_type = Elf64_Shdr;
static const unsigned char file_class = ELFCLASS64;
};

View File

@ -161,12 +161,12 @@ void checkRelocation( const relocation_section_accessor* pRT,
Elf_Sxword addend_,
Elf_Sxword calcValue_ )
{
Elf64_Addr offset;
Elf64_Addr symbolValue;
std::string symbolName;
Elf_Word type;
Elf_Sxword addend;
Elf_Sxword calcValue;
Elf64_Addr offset;
Elf64_Addr symbolValue;
std::string symbolName;
unsigned char type;
Elf_Sxword addend;
Elf_Sxword calcValue;
BOOST_REQUIRE_EQUAL( pRT->get_entry( index, offset, symbolValue, symbolName,
type, addend, calcValue ),

View File

@ -841,10 +841,10 @@ BOOST_AUTO_TEST_CASE( rearrange_local_symbols_with_reallocation )
std::vector<std::string> before;
for ( Elf_Word i = 0; i < rela.get_entries_num(); i++ ) {
Elf64_Addr offset;
Elf_Word symbol;
Elf_Word rtype;
Elf_Sxword addend;
Elf64_Addr offset;
Elf_Word symbol;
unsigned char rtype;
Elf_Sxword addend;
rela.get_entry( i, offset, symbol, rtype, addend );
symbols.get_symbol( symbol, name, value, size, bind, type,
@ -875,10 +875,10 @@ BOOST_AUTO_TEST_CASE( rearrange_local_symbols_with_reallocation )
std::vector<std::string> after;
for ( Elf_Word i = 0; i < rel.get_entries_num(); i++ ) {
Elf64_Addr offset;
Elf_Word symbol;
Elf_Word rtype;
Elf_Sxword addend;
Elf64_Addr offset;
Elf_Word symbol;
unsigned char rtype;
Elf_Sxword addend;
rel.get_entry( i, offset, symbol, rtype, addend );
syms.get_symbol( symbol, name, value, size, bind, type, section_index,