Skip to content

Fix compilation with older gcc #63721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/binder/assemblybindercommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ namespace BINDER_SPACE
{
// Search Assembly.ni.dll, then Assembly.dll
// The Assembly.ni.dll paths are rare, and intended for supporting managed C++ R2R assemblies.
SString candidates[] = { W(".ni.dll"), W(".dll") };
const WCHAR* const candidates[] = { W(".ni.dll"), W(".dll") };

// Loop through the binding paths looking for a matching assembly
for (int i = 0; i < 2; i++)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/binder/bindertracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ namespace BinderTracing
{
static thread_local bool t_AssemblyLoadStartInProgress = false;

AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath)
: m_bindRequest { assemblySpec, nullptr, assemblyPath }
AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath)
: m_bindRequest { assemblySpec, SString::Empty(), assemblyPath }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old gcc has trouble with initializer syntax when a candidate ctor of same type is marked explicit. Minimal repro: https://godbolt.org/z/c3heh1568

, m_populatedBindRequest { false }
, m_checkedIgnoreBind { false }
, m_ignoreBind { false }
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/inc/bindertracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace BinderTracing
{
public:
// This class assumes the assembly spec will have a longer lifetime than itself
AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath = nullptr);
AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath = SString::Empty());
~AssemblyBindOperation();

void SetResult(PEAssembly *assembly, bool cached = false);
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#undef min
#undef max

#ifndef __has_cpp_attribute
#define __has_cpp_attribute(x) (0)
#endif

#if __has_cpp_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#else
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ struct fgArgTabEntry
// In this case, it must be removed by GenTreeCall::ResetArgInfo.
bool isNonStandardArgAddedLate() const
{
switch (nonStandardArgKind)
switch (static_cast<NonStandardArgKind>(nonStandardArgKind))
{
case NonStandardArgKind::None:
case NonStandardArgKind::PInvokeFrame:
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/pal/inc/rt/sal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,10 @@ of each annotation, see the advanced annotations section.
#define __useHeader _Use_decl_anno_impl_
#define __on_failure(annotes) _On_failure_impl_(annotes _SAL_nop_impl_)

#ifndef __has_cpp_attribute
#define __has_cpp_attribute(x) (0)
#endif

#ifndef __fallthrough // [
#if __has_cpp_attribute(fallthrough)
#define __fallthrough [[fallthrough]]
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/dacenumerablehash.inl
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ namespace HashTableDetail
{
// Use the C++ detection idiom (https://isocpp.org/blog/2017/09/detection-idiom-a-stopgap-for-concepts-simon-brand) to call the
// derived table's EnumMemoryRegionsForEntry method if it defines one.
template<typename...>
using void_t = void;
template <class... > struct make_void { using type = void; };
template <class... T> using void_t = typename make_void<T...>::type;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


template<typename B>
struct negation : std::integral_constant<bool, !bool(B::value)> { };
Expand Down
4 changes: 2 additions & 2 deletions src/native/corehost/fxr/host_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ host_context_t::host_context_t(
const corehost_context_contract &hostpolicy_context_contract)
: marker { valid_host_context_marker }
, type { type }
, hostpolicy_contract { hostpolicy_contract }
, hostpolicy_context_contract { hostpolicy_context_contract }
, hostpolicy_contract (hostpolicy_contract)
, hostpolicy_context_contract (hostpolicy_context_contract)
{ }

void host_context_t::initialize_frameworks(const corehost_init_t& init)
Expand Down
4 changes: 4 additions & 0 deletions src/native/libs/Common/pal_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#define CONST_CAST2(TOTYPE, FROMTYPE, X) ((union { FROMTYPE _q; TOTYPE _nq; }){ ._q = (X) }._nq)
#define CONST_CAST(TYPE, X) CONST_CAST2(TYPE, const TYPE, (X))

#ifndef __has_attribute
#define __has_attribute(x) (0)
#endif

#if __has_attribute(fallthrough)
#define FALLTHROUGH __attribute__((fallthrough))
#else
Expand Down