From c55bb390d88b8eb62a50932f7f9b47c2a3733f16 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Fri, 21 Sep 2018 00:02:02 +0000 Subject: [PATCH] Revert^2 "ART: Refactor typedef to using" This reverts commit ee07743e03042c2ca36e0c9513847a9e7d2509f1. Reason for revert: fixed attributes. Bug: 32619234 Test: m test-art-host Test: m test-art-target-gtest-unstarted_runtime_test Change-Id: I6f0a775adfdf6ecd132b470f7c5446e949872e20 --- build/Android.bp | 2 ++ compiler/dex/inline_method_analyser.cc | 2 +- compiler/optimizing/code_generator_x86.cc | 2 +- compiler/optimizing/code_generator_x86_64.cc | 2 +- compiler/optimizing/graph_visualizer.cc | 3 +- compiler/optimizing/parallel_move_test.cc | 4 +-- compiler/utils/mips/assembler_mips.cc | 2 +- .../utils/mips/assembler_mips32r5_test.cc | 12 +++---- .../utils/mips/assembler_mips32r6_test.cc | 12 +++---- compiler/utils/mips/assembler_mips_test.cc | 10 +++--- compiler/utils/mips64/assembler_mips64.cc | 2 +- .../utils/mips64/assembler_mips64_test.cc | 12 +++---- compiler/utils/x86/assembler_x86_test.cc | 10 +++--- .../utils/x86_64/assembler_x86_64_test.cc | 10 +++--- dex2oat/linker/elf_writer_test.cc | 2 +- dex2oat/linker/oat_writer.cc | 4 +-- .../linker/x86/relative_patcher_x86_base.cc | 2 +- .../linker/x86_64/relative_patcher_x86_64.cc | 2 +- dexdump/dexdump.cc | 16 ++++----- dexlist/dexlist.cc | 6 ++-- disassembler/disassembler_arm.cc | 12 +++---- libdexfile/dex/dex_file_loader.cc | 4 --- oatdump/oatdump.cc | 4 +-- runtime/base/mutex.cc | 7 ++-- runtime/class_linker.cc | 4 +-- runtime/elf_file.cc | 2 +- runtime/hprof/hprof.cc | 10 +++--- runtime/interpreter/interpreter.cc | 36 +++++++++---------- runtime/interpreter/unstarted_runtime.cc | 19 ++++++---- runtime/interpreter/unstarted_runtime_test.cc | 6 ++-- runtime/jdwp/jdwp_handler.cc | 2 +- runtime/jit/debugger_interface.cc | 4 +-- runtime/jni/java_vm_ext.cc | 4 +-- runtime/mirror/object_test.cc | 10 +++--- runtime/mirror/var_handle.cc | 2 +- runtime/native/dalvik_system_VMRuntime.cc | 2 +- runtime/oat_file.cc | 2 +- runtime/transaction.cc | 4 +-- sigchainlib/sigchain_test.cc | 2 +- simulator/code_simulator_container.cc | 10 +++--- test/004-JniTest/jni_test.cc | 2 +- test/115-native-bridge/nativebridge.cc | 31 ++++++++-------- test/1900-track-alloc/alloc.cc | 2 +- test/1940-ddms-ext/ddm_ext.cc | 2 +- test/1946-list-descriptors/descriptors.cc | 2 +- .../raw_monitor.cc | 2 +- 46 files changed, 151 insertions(+), 153 deletions(-) diff --git a/build/Android.bp b/build/Android.bp index 5f64c2d9f7..3eb4aaff79 100644 --- a/build/Android.bp +++ b/build/Android.bp @@ -23,6 +23,7 @@ art_clang_tidy_errors = [ "bugprone-virtual-near-miss", "modernize-use-bool-literals", "modernize-use-nullptr", + "modernize-use-using", "performance-faster-string-find", "performance-for-range-copy", "performance-implicit-conversion-in-loop", @@ -37,6 +38,7 @@ art_clang_tidy_errors_str = "bugprone-lambda-function-name" + ",modernize-redundant-void-arg" + ",modernize-use-bool-literals" + ",modernize-use-nullptr" + + ",modernize-use-using" + ",performance-faster-string-find" + ",performance-for-range-copy" + ",performance-implicit-conversion-in-loop" diff --git a/compiler/dex/inline_method_analyser.cc b/compiler/dex/inline_method_analyser.cc index fe8b766d0f..183173b298 100644 --- a/compiler/dex/inline_method_analyser.cc +++ b/compiler/dex/inline_method_analyser.cc @@ -41,7 +41,7 @@ namespace { // anonymous namespace class Matcher { public: // Match function type. - typedef bool MatchFn(Matcher* matcher); + using MatchFn = bool(Matcher*); template static bool Match(const CodeItemDataAccessor* code_item, MatchFn* const (&pattern)[size]); diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 6c77232361..39cbe5e850 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -8301,7 +8301,7 @@ void CodeGeneratorX86::PatchJitRootUse(uint8_t* code, uint32_t code_offset = info.label.Position() - kLabelPositionToLiteralOffsetAdjustment; uintptr_t address = reinterpret_cast(roots_data) + index_in_table * sizeof(GcRoot); - typedef __attribute__((__aligned__(1))) uint32_t unaligned_uint32_t; + using unaligned_uint32_t __attribute__((__aligned__(1))) = uint32_t; reinterpret_cast(code + code_offset)[0] = dchecked_integral_cast(address); } diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 39d97899ae..e458dfffb4 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -7542,7 +7542,7 @@ void CodeGeneratorX86_64::PatchJitRootUse(uint8_t* code, uint32_t code_offset = info.label.Position() - kLabelPositionToLiteralOffsetAdjustment; uintptr_t address = reinterpret_cast(roots_data) + index_in_table * sizeof(GcRoot); - typedef __attribute__((__aligned__(1))) uint32_t unaligned_uint32_t; + using unaligned_uint32_t __attribute__((__aligned__(1))) = uint32_t; reinterpret_cast(code + code_offset)[0] = dchecked_integral_cast(address); } diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index 31db8c205f..d45653c6e4 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -106,8 +106,7 @@ std::ostream& operator<<(std::ostream& os, const StringList& list) { } } -typedef Disassembler* create_disasm_prototype(InstructionSet instruction_set, - DisassemblerOptions* options); +using create_disasm_prototype = Disassembler*(InstructionSet, DisassemblerOptions*); class HGraphVisualizerDisassembler { public: HGraphVisualizerDisassembler(InstructionSet instruction_set, diff --git a/compiler/optimizing/parallel_move_test.cc b/compiler/optimizing/parallel_move_test.cc index 399a6d8cbd..a8ab6cdd0c 100644 --- a/compiler/optimizing/parallel_move_test.cc +++ b/compiler/optimizing/parallel_move_test.cc @@ -174,8 +174,8 @@ class ParallelMoveTest : public ::testing::Test { template<> const bool ParallelMoveTest::has_swap = true; template<> const bool ParallelMoveTest::has_swap = false; -typedef ::testing::Types - ParallelMoveResolverTestTypes; +using ParallelMoveResolverTestTypes = + ::testing::Types; TYPED_TEST_CASE(ParallelMoveTest, ParallelMoveResolverTestTypes); diff --git a/compiler/utils/mips/assembler_mips.cc b/compiler/utils/mips/assembler_mips.cc index c0b6f988d4..65d3031b67 100644 --- a/compiler/utils/mips/assembler_mips.cc +++ b/compiler/utils/mips/assembler_mips.cc @@ -179,7 +179,7 @@ void MipsAssembler::PatchCFI(size_t number_of_delayed_adjust_pcs) { return; } - typedef DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC DelayedAdvancePC; + using DelayedAdvancePC = DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC; const auto data = cfi().ReleaseStreamAndPrepareForDelayedAdvancePC(); const std::vector& old_stream = data.first; const std::vector& advances = data.second; diff --git a/compiler/utils/mips/assembler_mips32r5_test.cc b/compiler/utils/mips/assembler_mips32r5_test.cc index bd73c12dc5..98fc44ba5d 100644 --- a/compiler/utils/mips/assembler_mips32r5_test.cc +++ b/compiler/utils/mips/assembler_mips32r5_test.cc @@ -38,12 +38,12 @@ class AssemblerMIPS32r5Test : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; // These tests were taking too long, so we hide the DriverStr() from AssemblerTest<> // and reimplement it without the verification against `assembly_string`. b/73903608 diff --git a/compiler/utils/mips/assembler_mips32r6_test.cc b/compiler/utils/mips/assembler_mips32r6_test.cc index 9637c25e7e..723c489f21 100644 --- a/compiler/utils/mips/assembler_mips32r6_test.cc +++ b/compiler/utils/mips/assembler_mips32r6_test.cc @@ -38,12 +38,12 @@ class AssemblerMIPS32r6Test : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; // These tests were taking too long, so we hide the DriverStr() from AssemblerTest<> // and reimplement it without the verification against `assembly_string`. b/73903608 diff --git a/compiler/utils/mips/assembler_mips_test.cc b/compiler/utils/mips/assembler_mips_test.cc index f137c60eb8..4f8ccee2c2 100644 --- a/compiler/utils/mips/assembler_mips_test.cc +++ b/compiler/utils/mips/assembler_mips_test.cc @@ -37,11 +37,11 @@ class AssemblerMIPSTest : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; // These tests were taking too long, so we hide the DriverStr() from AssemblerTest<> // and reimplement it without the verification against `assembly_string`. b/73903608 diff --git a/compiler/utils/mips64/assembler_mips64.cc b/compiler/utils/mips64/assembler_mips64.cc index 5b1c5d9e01..a6f807d1e5 100644 --- a/compiler/utils/mips64/assembler_mips64.cc +++ b/compiler/utils/mips64/assembler_mips64.cc @@ -52,7 +52,7 @@ void Mips64Assembler::PatchCFI() { return; } - typedef DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC DelayedAdvancePC; + using DelayedAdvancePC = DebugFrameOpCodeWriterForAssembler::DelayedAdvancePC; const auto data = cfi().ReleaseStreamAndPrepareForDelayedAdvancePC(); const std::vector& old_stream = data.first; const std::vector& advances = data.second; diff --git a/compiler/utils/mips64/assembler_mips64_test.cc b/compiler/utils/mips64/assembler_mips64_test.cc index 3218ae3a90..66711c3210 100644 --- a/compiler/utils/mips64/assembler_mips64_test.cc +++ b/compiler/utils/mips64/assembler_mips64_test.cc @@ -41,12 +41,12 @@ class AssemblerMIPS64Test : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; // These tests were taking too long, so we hide the DriverStr() from AssemblerTest<> // and reimplement it without the verification against `assembly_string`. b/73903608 diff --git a/compiler/utils/x86/assembler_x86_test.cc b/compiler/utils/x86/assembler_x86_test.cc index b03c40aa3e..ad75174d23 100644 --- a/compiler/utils/x86/assembler_x86_test.cc +++ b/compiler/utils/x86/assembler_x86_test.cc @@ -44,11 +44,11 @@ class AssemblerX86Test : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; protected: std::string GetArchitectureString() override { diff --git a/compiler/utils/x86_64/assembler_x86_64_test.cc b/compiler/utils/x86_64/assembler_x86_64_test.cc index 65711e0855..fe42f9b19b 100644 --- a/compiler/utils/x86_64/assembler_x86_64_test.cc +++ b/compiler/utils/x86_64/assembler_x86_64_test.cc @@ -137,11 +137,11 @@ class AssemblerX86_64Test : public AssemblerTest { public: - typedef AssemblerTest Base; + using Base = AssemblerTest; protected: // Get the typically used name for this architecture, e.g., aarch64, x86-64, ... diff --git a/dex2oat/linker/elf_writer_test.cc b/dex2oat/linker/elf_writer_test.cc index ef85fd16ff..1d578ab9d1 100644 --- a/dex2oat/linker/elf_writer_test.cc +++ b/dex2oat/linker/elf_writer_test.cc @@ -164,7 +164,7 @@ TEST_F(ElfWriterTest, EncodeDecodeOatPatches) { // Patch manually. std::vector expected = initial_data; for (uintptr_t location : patch_locations) { - typedef __attribute__((__aligned__(1))) uint32_t UnalignedAddress; + using UnalignedAddress __attribute__((__aligned__(1))) = uint32_t; *reinterpret_cast(expected.data() + location) += delta; } diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index e89de84739..acd49d5b45 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -92,10 +92,10 @@ static constexpr bool kOatWriterForceOatCodeLayout = false; static constexpr bool kOatWriterDebugOatCodeLayout = false; -typedef DexFile::Header __attribute__((aligned(1))) UnalignedDexFileHeader; +using UnalignedDexFileHeader __attribute__((__aligned__(1))) = DexFile::Header; const UnalignedDexFileHeader* AsUnalignedDexFileHeader(const uint8_t* raw_data) { - return reinterpret_cast(raw_data); + return reinterpret_cast(raw_data); } class ChecksumUpdatingOutputStream : public OutputStream { diff --git a/dex2oat/linker/x86/relative_patcher_x86_base.cc b/dex2oat/linker/x86/relative_patcher_x86_base.cc index 6a9690d768..07cd724308 100644 --- a/dex2oat/linker/x86/relative_patcher_x86_base.cc +++ b/dex2oat/linker/x86/relative_patcher_x86_base.cc @@ -50,7 +50,7 @@ void X86BaseRelativePatcher::PatchCall(std::vector* code, uint32_t displacement = target_offset - patch_offset; displacement -= kPcDisplacement; // The base PC is at the end of the 4-byte patch. - typedef __attribute__((__aligned__(1))) int32_t unaligned_int32_t; + using unaligned_int32_t __attribute__((__aligned__(1))) = int32_t; reinterpret_cast(&(*code)[literal_offset])[0] = displacement; } diff --git a/dex2oat/linker/x86_64/relative_patcher_x86_64.cc b/dex2oat/linker/x86_64/relative_patcher_x86_64.cc index 9633564999..c80f6a92f2 100644 --- a/dex2oat/linker/x86_64/relative_patcher_x86_64.cc +++ b/dex2oat/linker/x86_64/relative_patcher_x86_64.cc @@ -31,7 +31,7 @@ void X86_64RelativePatcher::PatchPcRelativeReference(std::vector* code, uint32_t displacement = target_offset - patch_offset; displacement -= kPcDisplacement; // The base PC is at the end of the 4-byte patch. - typedef __attribute__((__aligned__(1))) int32_t unaligned_int32_t; + using unaligned_int32_t __attribute__((__aligned__(1))) = int32_t; reinterpret_cast(&(*code)[patch.LiteralOffset()])[0] = displacement; } diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc index 2cf05678c6..1d6112f2e8 100644 --- a/dexdump/dexdump.cc +++ b/dexdump/dexdump.cc @@ -69,14 +69,14 @@ FILE* gOutFile = stdout; /* * Data types that match the definitions in the VM specification. */ -typedef uint8_t u1; -typedef uint16_t u2; -typedef uint32_t u4; -typedef uint64_t u8; -typedef int8_t s1; -typedef int16_t s2; -typedef int32_t s4; -typedef int64_t s8; +using u1 = uint8_t; +using u2 = uint16_t; +using u4 = uint32_t; +using u8 = uint64_t; +using s1 = int8_t; +using s2 = int16_t; +using s4 = int32_t; +using s8 = int64_t; /* * Basic information about a field or a method. diff --git a/dexlist/dexlist.cc b/dexlist/dexlist.cc index 23be19dd2e..067daa7842 100644 --- a/dexlist/dexlist.cc +++ b/dexlist/dexlist.cc @@ -55,9 +55,9 @@ static FILE* gOutFile = stdout; /* * Data types that match the definitions in the VM specification. */ -typedef uint8_t u1; -typedef uint32_t u4; -typedef uint64_t u8; +using u1 = uint8_t; +using u4 = uint32_t; +using u8 = uint64_t; /* * Returns a newly-allocated string for the "dot version" of the class diff --git a/disassembler/disassembler_arm.cc b/disassembler/disassembler_arm.cc index c1a6f59341..94ea0064e6 100644 --- a/disassembler/disassembler_arm.cc +++ b/disassembler/disassembler_arm.cc @@ -137,12 +137,12 @@ class DisassemblerArm::CustomDisassembler final : public PrintDisassembler { void DisassemblerArm::CustomDisassembler::CustomDisassemblerStream::PrintLiteral(LocationType type, int32_t offset) { // Literal offsets are not required to be aligned, so we may need unaligned access. - typedef const int16_t unaligned_int16_t __attribute__ ((aligned (1))); - typedef const uint16_t unaligned_uint16_t __attribute__ ((aligned (1))); - typedef const int32_t unaligned_int32_t __attribute__ ((aligned (1))); - typedef const int64_t unaligned_int64_t __attribute__ ((aligned (1))); - typedef const float unaligned_float __attribute__ ((aligned (1))); - typedef const double unaligned_double __attribute__ ((aligned (1))); + using unaligned_int16_t __attribute__((__aligned__(1))) = const int16_t; + using unaligned_uint16_t __attribute__((__aligned__(1))) = const uint16_t; + using unaligned_int32_t __attribute__((__aligned__(1))) = const int32_t; + using unaligned_int64_t __attribute__((__aligned__(1))) = const int64_t; + using unaligned_float __attribute__((__aligned__(1))) = const float; + using unaligned_double __attribute__((__aligned__(1))) = const double; // Zeros are used for the LocationType values this function does not care about. const size_t literal_size[kVst4Location + 1] = { diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc index 400c32b519..4aafc665ee 100644 --- a/libdexfile/dex/dex_file_loader.cc +++ b/libdexfile/dex/dex_file_loader.cc @@ -25,10 +25,6 @@ #include "standard_dex_file.h" #include "ziparchive/zip_archive.h" -// system/core/zip_archive definitions. -struct ZipEntry; -typedef void* ZipArchiveHandle; - namespace art { namespace { diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 707fc1c9ed..d30ec3157d 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -419,7 +419,7 @@ class OatDumper { return instruction_set_; } - typedef std::vector> DexFileUniqV; + using DexFileUniqV = std::vector>; bool Dump(std::ostream& os) { bool success = true; @@ -2480,7 +2480,7 @@ class ImageDumper { size_t bytes; size_t count; }; - typedef SafeMap SizeAndCountTable; + using SizeAndCountTable = SafeMap; SizeAndCountTable sizes_and_counts; void Update(const char* descriptor, size_t object_bytes_in) { diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index 28b29125cd..b2ddff3f6a 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -227,18 +227,15 @@ void BaseMutex::DumpAll(std::ostream& os) { // No mutexes have been created yet during at startup. return; } - typedef std::set::const_iterator It; os << "(Contended)\n"; - for (It it = all_mutexes->begin(); it != all_mutexes->end(); ++it) { - BaseMutex* mutex = *it; + for (const BaseMutex* mutex : *all_mutexes) { if (mutex->HasEverContended()) { mutex->Dump(os); os << "\n"; } } os << "(Never contented)\n"; - for (It it = all_mutexes->begin(); it != all_mutexes->end(); ++it) { - BaseMutex* mutex = *it; + for (const BaseMutex* mutex : *all_mutexes) { if (!mutex->HasEverContended()) { mutex->Dump(os); os << "\n"; diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index befeea463a..d9daae7b21 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -307,7 +307,7 @@ struct FieldGapsComparator { return lhs.size < rhs.size || (lhs.size == rhs.size && lhs.start_offset > rhs.start_offset); } }; -typedef std::priority_queue, FieldGapsComparator> FieldGaps; +using FieldGaps = std::priority_queue, FieldGapsComparator>; // Adds largest aligned gaps to queue of gaps. static void AddFieldGap(uint32_t gap_start, uint32_t gap_end, FieldGaps* gaps) { @@ -2301,7 +2301,7 @@ ObjPtr ClassLinker::EnsureResolved(Thread* self, return klass; } -typedef std::pair ClassPathEntry; +using ClassPathEntry = std::pair; // Search a collection of DexFiles for a descriptor ClassPathEntry FindInClassPath(const char* descriptor, diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc index e7715c4934..ce742fe47e 100644 --- a/runtime/elf_file.cc +++ b/runtime/elf_file.cc @@ -1417,7 +1417,7 @@ template void ElfFileImpl::ApplyOatPatches( const uint8_t* patches, const uint8_t* patches_end, Elf_Addr delta, uint8_t* to_patch, const uint8_t* to_patch_end) { - typedef __attribute__((__aligned__(1))) Elf_Addr UnalignedAddress; + using UnalignedAddress __attribute__((__aligned__(1))) = Elf_Addr; while (patches < patches_end) { to_patch += DecodeUnsignedLeb128(&patches); DCHECK_LE(patches, patches_end) << "Unexpected end of patch list."; diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index e8a47d1087..9467c4c952 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -148,11 +148,11 @@ enum HprofBasicType { hprof_basic_long = 11, }; -typedef uint32_t HprofStringId; -typedef uint32_t HprofClassObjectId; -typedef uint32_t HprofClassSerialNumber; -typedef uint32_t HprofStackTraceSerialNumber; -typedef uint32_t HprofStackFrameId; +using HprofStringId = uint32_t; +using HprofClassObjectId = uint32_t; +using HprofClassSerialNumber = uint32_t; +using HprofStackTraceSerialNumber = uint32_t; +using HprofStackFrameId = uint32_t; static constexpr HprofStackTraceSerialNumber kHprofNullStackTrace = 0; class EndianOutput { diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 048c6e4d66..df66061d01 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -56,7 +56,7 @@ static void InterpreterJni(Thread* self, ScopedObjectAccessUnchecked soa(self); if (method->IsStatic()) { if (shorty == "L") { - typedef jobject (fntype)(JNIEnv*, jclass); + using fntype = jobject(JNIEnv*, jclass); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -67,35 +67,35 @@ static void InterpreterJni(Thread* self, } result->SetL(soa.Decode(jresult)); } else if (shorty == "V") { - typedef void (fntype)(JNIEnv*, jclass); + using fntype = void(JNIEnv*, jclass); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); fn(soa.Env(), klass.get()); } else if (shorty == "Z") { - typedef jboolean (fntype)(JNIEnv*, jclass); + using fntype = jboolean(JNIEnv*, jclass); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); result->SetZ(fn(soa.Env(), klass.get())); } else if (shorty == "BI") { - typedef jbyte (fntype)(JNIEnv*, jclass, jint); + using fntype = jbyte(JNIEnv*, jclass, jint); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); result->SetB(fn(soa.Env(), klass.get(), args[0])); } else if (shorty == "II") { - typedef jint (fntype)(JNIEnv*, jclass, jint); + using fntype = jint(JNIEnv*, jclass, jint); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); result->SetI(fn(soa.Env(), klass.get(), args[0])); } else if (shorty == "LL") { - typedef jobject (fntype)(JNIEnv*, jclass, jobject); + using fntype = jobject(JNIEnv*, jclass, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -108,14 +108,14 @@ static void InterpreterJni(Thread* self, } result->SetL(soa.Decode(jresult)); } else if (shorty == "IIZ") { - typedef jint (fntype)(JNIEnv*, jclass, jint, jboolean); + using fntype = jint(JNIEnv*, jclass, jint, jboolean); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); result->SetI(fn(soa.Env(), klass.get(), args[0], args[1])); } else if (shorty == "ILI") { - typedef jint (fntype)(JNIEnv*, jclass, jobject, jint); + using fntype = jint(JNIEnv*, jclass, jobject, jint); fntype* const fn = reinterpret_cast(const_cast( method->GetEntryPointFromJni())); ScopedLocalRef klass(soa.Env(), @@ -125,7 +125,7 @@ static void InterpreterJni(Thread* self, ScopedThreadStateChange tsc(self, kNative); result->SetI(fn(soa.Env(), klass.get(), arg0.get(), args[1])); } else if (shorty == "SIZ") { - typedef jshort (fntype)(JNIEnv*, jclass, jint, jboolean); + using fntype = jshort(JNIEnv*, jclass, jint, jboolean); fntype* const fn = reinterpret_cast(const_cast(method->GetEntryPointFromJni())); ScopedLocalRef klass(soa.Env(), @@ -133,14 +133,14 @@ static void InterpreterJni(Thread* self, ScopedThreadStateChange tsc(self, kNative); result->SetS(fn(soa.Env(), klass.get(), args[0], args[1])); } else if (shorty == "VIZ") { - typedef void (fntype)(JNIEnv*, jclass, jint, jboolean); + using fntype = void(JNIEnv*, jclass, jint, jboolean); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); ScopedThreadStateChange tsc(self, kNative); fn(soa.Env(), klass.get(), args[0], args[1]); } else if (shorty == "ZLL") { - typedef jboolean (fntype)(JNIEnv*, jclass, jobject, jobject); + using fntype = jboolean(JNIEnv*, jclass, jobject, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -151,7 +151,7 @@ static void InterpreterJni(Thread* self, ScopedThreadStateChange tsc(self, kNative); result->SetZ(fn(soa.Env(), klass.get(), arg0.get(), arg1.get())); } else if (shorty == "ZILL") { - typedef jboolean (fntype)(JNIEnv*, jclass, jint, jobject, jobject); + using fntype = jboolean(JNIEnv*, jclass, jint, jobject, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -162,7 +162,7 @@ static void InterpreterJni(Thread* self, ScopedThreadStateChange tsc(self, kNative); result->SetZ(fn(soa.Env(), klass.get(), args[0], arg1.get(), arg2.get())); } else if (shorty == "VILII") { - typedef void (fntype)(JNIEnv*, jclass, jint, jobject, jint, jint); + using fntype = void(JNIEnv*, jclass, jint, jobject, jint, jint); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -171,7 +171,7 @@ static void InterpreterJni(Thread* self, ScopedThreadStateChange tsc(self, kNative); fn(soa.Env(), klass.get(), args[0], arg1.get(), args[2], args[3]); } else if (shorty == "VLILII") { - typedef void (fntype)(JNIEnv*, jclass, jobject, jint, jobject, jint, jint); + using fntype = void(JNIEnv*, jclass, jobject, jint, jobject, jint, jint); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef klass(soa.Env(), soa.AddLocalReference(method->GetDeclaringClass())); @@ -187,7 +187,7 @@ static void InterpreterJni(Thread* self, } } else { if (shorty == "L") { - typedef jobject (fntype)(JNIEnv*, jobject); + using fntype = jobject(JNIEnv*, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef rcvr(soa.Env(), soa.AddLocalReference(receiver)); @@ -198,14 +198,14 @@ static void InterpreterJni(Thread* self, } result->SetL(soa.Decode(jresult)); } else if (shorty == "V") { - typedef void (fntype)(JNIEnv*, jobject); + using fntype = void(JNIEnv*, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef rcvr(soa.Env(), soa.AddLocalReference(receiver)); ScopedThreadStateChange tsc(self, kNative); fn(soa.Env(), rcvr.get()); } else if (shorty == "LL") { - typedef jobject (fntype)(JNIEnv*, jobject, jobject); + using fntype = jobject(JNIEnv*, jobject, jobject); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef rcvr(soa.Env(), soa.AddLocalReference(receiver)); @@ -219,7 +219,7 @@ static void InterpreterJni(Thread* self, result->SetL(soa.Decode(jresult)); ScopedThreadStateChange tsc(self, kNative); } else if (shorty == "III") { - typedef jint (fntype)(JNIEnv*, jobject, jint, jint); + using fntype = jint(JNIEnv*, jobject, jint, jint); fntype* const fn = reinterpret_cast(method->GetEntryPointFromJni()); ScopedLocalRef rcvr(soa.Env(), soa.AddLocalReference(receiver)); diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc index d4b51af903..4cd378256e 100644 --- a/runtime/interpreter/unstarted_runtime.cc +++ b/runtime/interpreter/unstarted_runtime.cc @@ -1180,19 +1180,19 @@ static void UnstartedMemoryPeek( } case Primitive::kPrimShort: { - typedef int16_t unaligned_short __attribute__ ((aligned (1))); + using unaligned_short __attribute__((__aligned__(1))) = int16_t; result->SetS(*reinterpret_cast(static_cast(address))); return; } case Primitive::kPrimInt: { - typedef int32_t unaligned_int __attribute__ ((aligned (1))); + using unaligned_int __attribute__((__aligned__(1))) = int32_t; result->SetI(*reinterpret_cast(static_cast(address))); return; } case Primitive::kPrimLong: { - typedef int64_t unaligned_long __attribute__ ((aligned (1))); + using unaligned_long __attribute__((__aligned__(1))) = int64_t; result->SetJ(*reinterpret_cast(static_cast(address))); return; } @@ -1919,11 +1919,16 @@ void UnstartedRuntime::UnstartedJNIUnsafeGetArrayIndexScaleForComponentType( result->SetI(Primitive::ComponentSize(primitive_type)); } -typedef void (*InvokeHandler)(Thread* self, ShadowFrame* shadow_frame, JValue* result, - size_t arg_size); +using InvokeHandler = void(*)(Thread* self, + ShadowFrame* shadow_frame, + JValue* result, + size_t arg_size); -typedef void (*JNIHandler)(Thread* self, ArtMethod* method, mirror::Object* receiver, - uint32_t* args, JValue* result); +using JNIHandler = void(*)(Thread* self, + ArtMethod* method, + mirror::Object* receiver, + uint32_t* args, + JValue* result); static bool tables_initialized_ = false; static std::unordered_map invoke_handlers_; diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc index 200fc5b334..bd2705d530 100644 --- a/runtime/interpreter/unstarted_runtime_test.cc +++ b/runtime/interpreter/unstarted_runtime_test.cc @@ -261,7 +261,7 @@ TEST_F(UnstartedRuntimeTest, MemoryPeekShort) { UnstartedMemoryPeekShort(self, tmp.get(), &result, 0); - typedef int16_t unaligned_short __attribute__ ((aligned (1))); + using unaligned_short __attribute__((__aligned__(1))) = int16_t; const unaligned_short* short_ptr = reinterpret_cast(base_ptr + i); EXPECT_EQ(result.GetS(), *short_ptr); } @@ -284,7 +284,7 @@ TEST_F(UnstartedRuntimeTest, MemoryPeekInt) { UnstartedMemoryPeekInt(self, tmp.get(), &result, 0); - typedef int32_t unaligned_int __attribute__ ((aligned (1))); + using unaligned_int __attribute__((__aligned__(1))) = int32_t; const unaligned_int* int_ptr = reinterpret_cast(base_ptr + i); EXPECT_EQ(result.GetI(), *int_ptr); } @@ -307,7 +307,7 @@ TEST_F(UnstartedRuntimeTest, MemoryPeekLong) { UnstartedMemoryPeekLong(self, tmp.get(), &result, 0); - typedef int64_t unaligned_long __attribute__ ((aligned (1))); + using unaligned_long __attribute__((__aligned__(1))) = int64_t; const unaligned_long* long_ptr = reinterpret_cast(base_ptr + i); EXPECT_EQ(result.GetJ(), *long_ptr); } diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc index 1e61ba0f2d..0a54e38698 100644 --- a/runtime/jdwp/jdwp_handler.cc +++ b/runtime/jdwp/jdwp_handler.cc @@ -1432,7 +1432,7 @@ static JdwpError DDM_Chunk(JdwpState* state, Request* request, ExpandBuf* pReply /* * Handler map decl. */ -typedef JdwpError (*JdwpRequestHandler)(JdwpState* state, Request* request, ExpandBuf* reply); +using JdwpRequestHandler = JdwpError(*)(JdwpState* state, Request* request, ExpandBuf* reply); struct JdwpHandlerMap { uint8_t cmdSet; diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc index 63fb22cfce..6cd719a55c 100644 --- a/runtime/jit/debugger_interface.cc +++ b/runtime/jit/debugger_interface.cc @@ -77,11 +77,11 @@ namespace art { extern "C" { - typedef enum { + enum JITAction { JIT_NOACTION = 0, JIT_REGISTER_FN, JIT_UNREGISTER_FN - } JITAction; + }; struct JITCodeEntry { // Atomic to ensure the reader can always iterate over the linked list diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc index 42406cf73c..6769368ee4 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -333,7 +333,7 @@ class Libraries { } ScopedThreadSuspension sts(self, kNative); // Do this without holding the jni libraries lock to prevent possible deadlocks. - typedef void (*JNI_OnUnloadFn)(JavaVM*, void*); + using JNI_OnUnloadFn = void(*)(JavaVM*, void*); for (auto library : unload_libraries) { void* const sym = library->FindSymbol("JNI_OnUnload", nullptr); if (sym == nullptr) { @@ -1026,7 +1026,7 @@ bool JavaVMExt::LoadNativeLibrary(JNIEnv* env, self->SetClassLoaderOverride(class_loader); VLOG(jni) << "[Calling JNI_OnLoad in \"" << path << "\"]"; - typedef int (*JNI_OnLoadFn)(JavaVM*, void*); + using JNI_OnLoadFn = int(*)(JavaVM*, void*); JNI_OnLoadFn jni_on_load = reinterpret_cast(sym); int version = (*jni_on_load)(this, nullptr); diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 0b615a6b9a..cf6543fa26 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -204,7 +204,7 @@ TEST_F(ObjectTest, AllocArray_FillUsable) { template void TestPrimitiveArray(ClassLinker* cl) { ScopedObjectAccess soa(Thread::Current()); - typedef typename ArrayT::ElementType T; + using T = typename ArrayT::ElementType; StackHandleScope<2> hs(soa.Self()); Handle a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2)); @@ -252,9 +252,9 @@ TEST_F(ObjectTest, PrimitiveArray_Short_Alloc) { } TEST_F(ObjectTest, PrimitiveArray_Double_Alloc) { - typedef DoubleArray ArrayT; + using ArrayT = DoubleArray; ScopedObjectAccess soa(Thread::Current()); - typedef typename ArrayT::ElementType T; + using T = typename ArrayT::ElementType; StackHandleScope<2> hs(soa.Self()); Handle a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2)); @@ -283,9 +283,9 @@ TEST_F(ObjectTest, PrimitiveArray_Double_Alloc) { } TEST_F(ObjectTest, PrimitiveArray_Float_Alloc) { - typedef FloatArray ArrayT; + using ArrayT = FloatArray; ScopedObjectAccess soa(Thread::Current()); - typedef typename ArrayT::ElementType T; + using T = typename ArrayT::ElementType; StackHandleScope<2> hs(soa.Self()); Handle a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2)); diff --git a/runtime/mirror/var_handle.cc b/runtime/mirror/var_handle.cc index 864e1eab73..ce794084d1 100644 --- a/runtime/mirror/var_handle.cc +++ b/runtime/mirror/var_handle.cc @@ -691,7 +691,7 @@ class TypeAdaptorAccessor : public Object::Accessor { template class FieldAccessViaAccessor { public: - typedef Object::Accessor Accessor; + using Accessor = Object::Accessor; // Apply an Accessor to get a field in an object. static void Get(ObjPtr obj, diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc index 0e619407e5..b18a048c60 100644 --- a/runtime/native/dalvik_system_VMRuntime.cc +++ b/runtime/native/dalvik_system_VMRuntime.cc @@ -325,7 +325,7 @@ static void VMRuntime_runHeapTasks(JNIEnv* env, jobject) { Runtime::Current()->GetHeap()->GetTaskProcessor()->RunAllTasks(ThreadForEnv(env)); } -typedef std::map> StringTable; +using StringTable = std::map>; class PreloadDexCachesStringsVisitor : public SingleRootVisitor { public: diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index 0579b6e39d..5b965090d2 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -410,7 +410,7 @@ inline static bool ReadOatDexFileData(const OatFile& oat_file, return false; } static_assert(std::is_trivial::value, "T must be a trivial type"); - typedef __attribute__((__aligned__(1))) T unaligned_type; + using unaligned_type __attribute__((__aligned__(1))) = T; *value = *reinterpret_cast(*oat); *oat += sizeof(T); return true; diff --git a/runtime/transaction.cc b/runtime/transaction.cc index c9766bc9ca..1e5b2bbd4c 100644 --- a/runtime/transaction.cc +++ b/runtime/transaction.cc @@ -320,7 +320,7 @@ void Transaction::VisitRoots(RootVisitor* visitor) { void Transaction::VisitObjectLogs(RootVisitor* visitor) { // List of moving roots. - typedef std::pair ObjectPair; + using ObjectPair = std::pair; std::list moving_roots; // Visit roots. @@ -348,7 +348,7 @@ void Transaction::VisitObjectLogs(RootVisitor* visitor) { void Transaction::VisitArrayLogs(RootVisitor* visitor) { // List of moving roots. - typedef std::pair ArrayPair; + using ArrayPair = std::pair; std::list moving_roots; for (auto& it : array_logs_) { diff --git a/sigchainlib/sigchain_test.cc b/sigchainlib/sigchain_test.cc index 53e1e40454..bb997877a1 100644 --- a/sigchainlib/sigchain_test.cc +++ b/sigchainlib/sigchain_test.cc @@ -38,7 +38,7 @@ #include "sigchain.h" #if !defined(__BIONIC__) -typedef sigset_t sigset64_t; +using sigset64_t = sigset_t; static int sigemptyset64(sigset64_t* set) { return sigemptyset(set); diff --git a/simulator/code_simulator_container.cc b/simulator/code_simulator_container.cc index 3206bc7844..dc553dfe5d 100644 --- a/simulator/code_simulator_container.cc +++ b/simulator/code_simulator_container.cc @@ -34,13 +34,13 @@ CodeSimulatorContainer::CodeSimulatorContainer(InstructionSet target_isa) if (libart_simulator_handle_ == nullptr) { VLOG(simulator) << "Could not load " << libart_simulator_so_name << ": " << dlerror(); } else { - typedef CodeSimulator* (*create_code_simulator_ptr_)(InstructionSet target_isa); - create_code_simulator_ptr_ create_code_simulator_ = - reinterpret_cast( + using CreateCodeSimulatorPtr = CodeSimulator*(*)(InstructionSet); + CreateCodeSimulatorPtr create_code_simulator = + reinterpret_cast( dlsym(libart_simulator_handle_, "CreateCodeSimulator")); - DCHECK(create_code_simulator_ != nullptr) << "Fail to find symbol of CreateCodeSimulator: " + DCHECK(create_code_simulator != nullptr) << "Fail to find symbol of CreateCodeSimulator: " << dlerror(); - simulator_ = create_code_simulator_(target_isa); + simulator_ = create_code_simulator(target_isa); } } diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc index 33a8f5bba2..d82c526ee3 100644 --- a/test/004-JniTest/jni_test.cc +++ b/test/004-JniTest/jni_test.cc @@ -62,7 +62,7 @@ static void* AttachHelper(void* arg) { int attach_result = jvm->AttachCurrentThread(&env, &args); CHECK_EQ(attach_result, 0); - typedef void (*Fn)(JNIEnv*); + using Fn = void(*)(JNIEnv*); Fn fn = reinterpret_cast(arg); fn(env); diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc index a74f7638bd..cc7e806ba5 100644 --- a/test/115-native-bridge/nativebridge.cc +++ b/test/115-native-bridge/nativebridge.cc @@ -45,7 +45,7 @@ static const android::NativeBridgeRuntimeCallbacks* gNativeBridgeArtCallbacks; static jint trampoline_JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* env = nullptr; - typedef jint (*FnPtr_t)(JavaVM*, void*); + using FnPtr_t = jint(*)(JavaVM*, void*); FnPtr_t fnPtr = reinterpret_cast(find_native_bridge_method("JNI_OnLoad")->fnPtr); vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6); @@ -91,9 +91,8 @@ static jint trampoline_JNI_OnLoad(JavaVM* vm, void* reserved) { return fnPtr(vm, reserved); } -static void trampoline_Java_Main_testFindClassOnAttachedNativeThread(JNIEnv* env, - jclass klass) { - typedef void (*FnPtr_t)(JNIEnv*, jclass); +static void trampoline_Java_Main_testFindClassOnAttachedNativeThread(JNIEnv* env, jclass klass) { + using FnPtr_t = void(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testFindClassOnAttachedNativeThread")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -102,7 +101,7 @@ static void trampoline_Java_Main_testFindClassOnAttachedNativeThread(JNIEnv* env static void trampoline_Java_Main_testFindFieldOnAttachedNativeThreadNative(JNIEnv* env, jclass klass) { - typedef void (*FnPtr_t)(JNIEnv*, jclass); + using FnPtr_t = void(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testFindFieldOnAttachedNativeThreadNative")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -111,7 +110,7 @@ static void trampoline_Java_Main_testFindFieldOnAttachedNativeThreadNative(JNIEn static void trampoline_Java_Main_testCallStaticVoidMethodOnSubClassNative(JNIEnv* env, jclass klass) { - typedef void (*FnPtr_t)(JNIEnv*, jclass); + using FnPtr_t = void(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testCallStaticVoidMethodOnSubClassNative")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -119,7 +118,7 @@ static void trampoline_Java_Main_testCallStaticVoidMethodOnSubClassNative(JNIEnv } static jobject trampoline_Java_Main_testGetMirandaMethodNative(JNIEnv* env, jclass klass) { - typedef jobject (*FnPtr_t)(JNIEnv*, jclass); + using FnPtr_t = jobject(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testGetMirandaMethodNative")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -127,7 +126,7 @@ static jobject trampoline_Java_Main_testGetMirandaMethodNative(JNIEnv* env, jcla } static void trampoline_Java_Main_testNewStringObject(JNIEnv* env, jclass klass) { - typedef void (*FnPtr_t)(JNIEnv*, jclass); + using FnPtr_t = void(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testNewStringObject")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -135,7 +134,7 @@ static void trampoline_Java_Main_testNewStringObject(JNIEnv* env, jclass klass) } static void trampoline_Java_Main_testZeroLengthByteBuffers(JNIEnv* env, jclass klass) { - typedef void (*FnPtr_t)(JNIEnv*, jclass); + using FnPtr_t = void(*)(JNIEnv*, jclass); FnPtr_t fnPtr = reinterpret_cast (find_native_bridge_method("testZeroLengthByteBuffers")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -145,8 +144,8 @@ static void trampoline_Java_Main_testZeroLengthByteBuffers(JNIEnv* env, jclass k static jbyte trampoline_Java_Main_byteMethod(JNIEnv* env, jclass klass, jbyte b1, jbyte b2, jbyte b3, jbyte b4, jbyte b5, jbyte b6, jbyte b7, jbyte b8, jbyte b9, jbyte b10) { - typedef jbyte (*FnPtr_t)(JNIEnv*, jclass, jbyte, jbyte, jbyte, jbyte, jbyte, - jbyte, jbyte, jbyte, jbyte, jbyte); + using FnPtr_t = jbyte(*)(JNIEnv*, jclass, jbyte, jbyte, jbyte, jbyte, jbyte, jbyte, jbyte, jbyte, + jbyte, jbyte); FnPtr_t fnPtr = reinterpret_cast(find_native_bridge_method("byteMethod")->fnPtr); printf("%s called!\n", __FUNCTION__); return fnPtr(env, klass, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10); @@ -155,8 +154,8 @@ static jbyte trampoline_Java_Main_byteMethod(JNIEnv* env, jclass klass, jbyte b1 static jshort trampoline_Java_Main_shortMethod(JNIEnv* env, jclass klass, jshort s1, jshort s2, jshort s3, jshort s4, jshort s5, jshort s6, jshort s7, jshort s8, jshort s9, jshort s10) { - typedef jshort (*FnPtr_t)(JNIEnv*, jclass, jshort, jshort, jshort, jshort, jshort, - jshort, jshort, jshort, jshort, jshort); + using FnPtr_t = jshort(*)(JNIEnv*, jclass, jshort, jshort, jshort, jshort, jshort, jshort, jshort, + jshort, jshort, jshort); FnPtr_t fnPtr = reinterpret_cast(find_native_bridge_method("shortMethod")->fnPtr); printf("%s called!\n", __FUNCTION__); return fnPtr(env, klass, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); @@ -166,7 +165,7 @@ static jboolean trampoline_Java_Main_booleanMethod(JNIEnv* env, jclass klass, jb jboolean b2, jboolean b3, jboolean b4, jboolean b5, jboolean b6, jboolean b7, jboolean b8, jboolean b9, jboolean b10) { - typedef jboolean (*FnPtr_t)(JNIEnv*, jclass, jboolean, jboolean, jboolean, jboolean, jboolean, + using FnPtr_t = jboolean(*)(JNIEnv*, jclass, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean); FnPtr_t fnPtr = reinterpret_cast(find_native_bridge_method("booleanMethod")->fnPtr); printf("%s called!\n", __FUNCTION__); @@ -176,8 +175,8 @@ static jboolean trampoline_Java_Main_booleanMethod(JNIEnv* env, jclass klass, jb static jchar trampoline_Java_Main_charMethod(JNIEnv* env, jclass klass, jchar c1, jchar c2, jchar c3, jchar c4, jchar c5, jchar c6, jchar c7, jchar c8, jchar c9, jchar c10) { - typedef jchar (*FnPtr_t)(JNIEnv*, jclass, jchar, jchar, jchar, jchar, jchar, - jchar, jchar, jchar, jchar, jchar); + using FnPtr_t = jchar(*)(JNIEnv*, jclass, jchar, jchar, jchar, jchar, jchar, jchar, jchar, jchar, + jchar, jchar); FnPtr_t fnPtr = reinterpret_cast(find_native_bridge_method("charMethod")->fnPtr); printf("%s called!\n", __FUNCTION__); return fnPtr(env, klass, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10); diff --git a/test/1900-track-alloc/alloc.cc b/test/1900-track-alloc/alloc.cc index db5617c54c..f2096111da 100644 --- a/test/1900-track-alloc/alloc.cc +++ b/test/1900-track-alloc/alloc.cc @@ -24,7 +24,7 @@ namespace art { namespace Test1900TrackAlloc { -typedef jvmtiError (*GetGlobalState)(jvmtiEnv* env, jlong* allocated); +using GetGlobalState = jvmtiError(*)(jvmtiEnv* env, jlong* allocated); struct AllocTrackingData { GetGlobalState get_global_state; diff --git a/test/1940-ddms-ext/ddm_ext.cc b/test/1940-ddms-ext/ddm_ext.cc index cc29df9a49..452187bdcb 100644 --- a/test/1940-ddms-ext/ddm_ext.cc +++ b/test/1940-ddms-ext/ddm_ext.cc @@ -25,7 +25,7 @@ namespace art { namespace Test1940DdmExt { -typedef jvmtiError (*DdmHandleChunk)(jvmtiEnv* env, +using DdmHandleChunk = jvmtiError(*)(jvmtiEnv* env, jint type_in, jint len_in, const jbyte* data_in, diff --git a/test/1946-list-descriptors/descriptors.cc b/test/1946-list-descriptors/descriptors.cc index 01b306dea5..07fee6141b 100644 --- a/test/1946-list-descriptors/descriptors.cc +++ b/test/1946-list-descriptors/descriptors.cc @@ -24,7 +24,7 @@ namespace art { namespace Test1946Descriptors { -typedef jvmtiError (*GetDescriptorList)(jvmtiEnv* env, jobject loader, jint* cnt, char*** descs); +using GetDescriptorList = jvmtiError(*)(jvmtiEnv* env, jobject loader, jint* cnt, char*** descs); struct DescriptorData { GetDescriptorList get_descriptor_list; diff --git a/test/1951-monitor-enter-no-suspend/raw_monitor.cc b/test/1951-monitor-enter-no-suspend/raw_monitor.cc index 0425e350fd..efd02b6ae4 100644 --- a/test/1951-monitor-enter-no-suspend/raw_monitor.cc +++ b/test/1951-monitor-enter-no-suspend/raw_monitor.cc @@ -26,7 +26,7 @@ namespace art { namespace Test1951MonitorEnterNoSuspend { -typedef jvmtiError (*RawMonitorEnterNoSuspend)(jvmtiEnv* env, jrawMonitorID mon); +using RawMonitorEnterNoSuspend = jvmtiError(*)(jvmtiEnv* env, jrawMonitorID mon); template static void Dealloc(T* t) {