From dc38dd00743f230e55a853df4a2f1b7abffedcc6 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sat, 26 Nov 2022 18:14:51 +0800 Subject: [PATCH 1/2] Fix GCC build without -fpermissive C++ disallows referring to the return type of a class member function with the same name as the function itself, but only GCC produces an error for it. It can be easily fixed by specifying the namespace in the return type. --- src/impl/winmd_reader/database.h | 76 ++++++++++++++++---------------- src/impl/winmd_reader/flags.h | 6 +-- src/impl/winmd_reader/index.h | 6 +-- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/impl/winmd_reader/database.h b/src/impl/winmd_reader/database.h index c65de70..9a6b505 100644 --- a/src/impl/winmd_reader/database.h +++ b/src/impl/winmd_reader/database.h @@ -119,44 +119,44 @@ namespace winmd::reader initialize(); } - table TypeRef{ this }; - table GenericParamConstraint{ this }; - table TypeSpec{ this }; - table TypeDef{ this }; - table CustomAttribute{ this }; - table MethodDef{ this }; - table MemberRef{ this }; - table Module{ this }; - table Param{ this }; - table InterfaceImpl{ this }; - table Constant{ this }; - table Field{ this }; - table FieldMarshal{ this }; - table DeclSecurity{ this }; - table ClassLayout{ this }; - table FieldLayout{ this }; - table StandAloneSig{ this }; - table EventMap{ this }; - table Event{ this }; - table PropertyMap{ this }; - table Property{ this }; - table MethodSemantics{ this }; - table MethodImpl{ this }; - table ModuleRef{ this }; - table ImplMap{ this }; - table FieldRVA{ this }; - table Assembly{ this }; - table AssemblyProcessor{ this }; - table AssemblyOS{ this }; - table AssemblyRef{ this }; - table AssemblyRefProcessor{ this }; - table AssemblyRefOS{ this }; - table File{ this }; - table ExportedType{ this }; - table ManifestResource{ this }; - table NestedClass{ this }; - table GenericParam{ this }; - table MethodSpec{ this }; + table TypeRef{ this }; + table GenericParamConstraint{ this }; + table TypeSpec{ this }; + table TypeDef{ this }; + table CustomAttribute{ this }; + table MethodDef{ this }; + table MemberRef{ this }; + table Module{ this }; + table Param{ this }; + table InterfaceImpl{ this }; + table Constant{ this }; + table Field{ this }; + table FieldMarshal{ this }; + table DeclSecurity{ this }; + table ClassLayout{ this }; + table FieldLayout{ this }; + table StandAloneSig{ this }; + table EventMap{ this }; + table Event{ this }; + table PropertyMap{ this }; + table Property{ this }; + table MethodSemantics{ this }; + table MethodImpl{ this }; + table ModuleRef{ this }; + table ImplMap{ this }; + table FieldRVA{ this }; + table Assembly{ this }; + table AssemblyProcessor{ this }; + table AssemblyOS{ this }; + table AssemblyRef{ this }; + table AssemblyRefProcessor{ this }; + table AssemblyRefOS{ this }; + table File{ this }; + table ExportedType{ this }; + table ManifestResource{ this }; + table NestedClass{ this }; + table GenericParam{ this }; + table MethodSpec{ this }; template table const& get_table() const noexcept; diff --git a/src/impl/winmd_reader/flags.h b/src/impl/winmd_reader/flags.h index 62dee7f..6ae8ebf 100644 --- a/src/impl/winmd_reader/flags.h +++ b/src/impl/winmd_reader/flags.h @@ -303,7 +303,7 @@ namespace winmd::reader struct MethodImplAttributes : impl::AttributesBase { - constexpr CodeType CodeType() const noexcept + constexpr reader::CodeType CodeType() const noexcept { return get_enum(CodeType_mask); } @@ -311,7 +311,7 @@ namespace winmd::reader { set_enum(arg, CodeType_mask); } - constexpr Managed Managed() const noexcept + constexpr reader::Managed Managed() const noexcept { return get_enum(Managed_mask); } @@ -600,7 +600,7 @@ namespace winmd::reader { set_bit(arg, WindowsRuntime_bit); } - constexpr StringFormat StringFormat() const noexcept + constexpr reader::StringFormat StringFormat() const noexcept { return get_enum(StringFormat_mask); } diff --git a/src/impl/winmd_reader/index.h b/src/impl/winmd_reader/index.h index 6a7fc22..26de81f 100644 --- a/src/impl/winmd_reader/index.h +++ b/src/impl/winmd_reader/index.h @@ -48,9 +48,9 @@ namespace winmd::reader { using index_base::index_base; - TypeDef TypeDef() const; - TypeRef TypeRef() const; - TypeSpec TypeSpec() const; + reader::TypeDef TypeDef() const; + reader::TypeRef TypeRef() const; + reader::TypeSpec TypeSpec() const; auto CustomAttribute() const; }; } From d008fb52cc5a1d1e697491077349c8052a6145f0 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sat, 26 Nov 2022 18:25:51 +0800 Subject: [PATCH 2/2] Add `#include ` `impl/winmd_reader/view.h` uses `std::exchange`. Without the include, it fails to build on GCC 12 / libstdc++. --- src/impl/base.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/impl/base.h b/src/impl/base.h index 60e54e2..aa197e0 100644 --- a/src/impl/base.h +++ b/src/impl/base.h @@ -26,6 +26,7 @@ #include #include #include +#include #if defined(_DEBUG) #define XLANG_DEBUG