Parser.hpp: Replace the try-catch statement at line 152 with a condition since this seems to fix bad_cast not being caught when running a windows executable which has been compressed using upx
CMakeLists.txt: Revert the 89888113
commit and don't check CMAKE_CXX_LINK_NO_PIE_SUPPORTED when mingw is in use
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
c720769305
commit
4795bd54a0
|
@ -161,10 +161,10 @@ if (Threads_FOUND)
|
|||
endif()
|
||||
|
||||
option(NO_SELF_PACKER "Disables usage of a self-packer")
|
||||
if (NOT (UPPERCASE_BUILD_TYPE STREQUAL "DEBUG" OR UPPERCASE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" OR NO_SELF_PACKER OR DEFINED EMSCRIPTEN OR MINGW))
|
||||
if (NOT (UPPERCASE_BUILD_TYPE STREQUAL "DEBUG" OR UPPERCASE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" OR NO_SELF_PACKER OR DEFINED EMSCRIPTEN))
|
||||
include(FindSelfPackers)
|
||||
if (SELF_PACKER_FOR_EXECUTABLE MATCHES upx) # UPX version d61edc9 or higher is required when using a cross-compiler to target the musl C library
|
||||
if (CMAKE_CXX_LINK_NO_PIE_SUPPORTED)
|
||||
if (CMAKE_CXX_LINK_NO_PIE_SUPPORTED OR MINGW) # MINGW does not support PIE, yet the variable is set to NO.
|
||||
set(SELF_PACKER_FOR_EXECUTABLE_FLAGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} --ultra-brute --best)
|
||||
if (USER_DEFINED_PIE AND CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
message(NOTICE "-- Could NOT manually enable PIE (UPX is in use)")
|
||||
|
|
|
@ -149,20 +149,20 @@ namespace Parser {
|
|||
} catch (const NamedIdentifier<true>::identifier_reserved_exception&) {
|
||||
parsingError(current, " is a reserved identifier", true);
|
||||
}
|
||||
try {
|
||||
const auto& last = parseTree.cend() - 1;
|
||||
const type_info& lastId = last->get()->getId();
|
||||
const auto& last_identifier = dynamic_cast<NamedIdentifier<true>&>(**last);
|
||||
const auto& last = parseTree.cend() - 1;
|
||||
const type_info& lastId = last->get()->getId();
|
||||
const auto& last_identifier = dynamic_cast<NamedIdentifier<true>*>(last->get());
|
||||
if (last_identifier != nullptr) {
|
||||
if (lastId != typeid(Define) and
|
||||
any_of(parseTree.cbegin(), last, [&last_identifier](const component_ptr& pointer){
|
||||
try {
|
||||
return dynamic_cast<NamedIdentifier<true>&>(*pointer).name == last_identifier.name;
|
||||
return dynamic_cast<NamedIdentifier<true>&>(*pointer).name == last_identifier->name;
|
||||
} catch (const bad_cast&) {
|
||||
return false;
|
||||
}
|
||||
}))
|
||||
{ parsingError(current, " has already been defined previously", true); }
|
||||
} catch (const bad_cast&) {}
|
||||
}
|
||||
}
|
||||
return parseTree;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue