From 51e1c4c1f2ba82182efed495687ca82ecab4e595 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 17 Apr 2021 13:38:36 +0200 Subject: [PATCH] Tweak some compiler options --- Makefile | 6 +++--- source/elfio/elfio_section.hpp | 26 ++++++-------------------- source/elfio/elfio_segment.hpp | 6 +----- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index df912f0..187502b 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,12 @@ INCLUDES := source #------------------------------------------------------------------------------- # options for code generation #------------------------------------------------------------------------------- -CFLAGS := -g -Wall -O2 -ffunction-sections\ +CFLAGS := -g -Wall -O3 -ffunction-sections -fno-exceptions -fno-rtti\ $(MACHDEP) -CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ +CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -CXXFLAGS := $(CFLAGS) -std=c++17 +CXXFLAGS := $(CFLAGS) -std=c++20 ASFLAGS := -g $(ARCH) LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -T$(WUMS_ROOT)/share/libfunctionpatcher.ld $(WUMSSPECS) diff --git a/source/elfio/elfio_section.hpp b/source/elfio/elfio_section.hpp index 1c04ab7..ed3b908 100644 --- a/source/elfio/elfio_section.hpp +++ b/source/elfio/elfio_section.hpp @@ -160,14 +160,8 @@ class section_impl : public section set_data( const char* raw_data, Elf_Word size ) { if ( get_type() != SHT_NOBITS ) { - delete [] data; - try { - data = new char[size]; - } catch (const std::bad_alloc&) { - data = 0; - data_size = 0; - size = 0; - } + delete [] data; + data = new char[size]; if ( 0 != data && 0 != raw_data ) { data_size = size; std::copy( raw_data, raw_data + size, data ); @@ -195,12 +189,8 @@ class section_impl : public section else { data_size = 2*( data_size + size); char* new_data; - try { - new_data = new char[data_size]; - } catch (const std::bad_alloc&) { - new_data = 0; - size = 0; - } + new_data = new char[data_size]; + if ( 0 != new_data ) { std::copy( data, data + get_size(), new_data ); std::copy( raw_data, raw_data + size, new_data + get_size() ); @@ -247,12 +237,8 @@ class section_impl : public section Elf_Xword size = get_size(); if ( 0 == data && SHT_NULL != get_type() && SHT_NOBITS != get_type() && size < get_stream_size()) { - try { - data = new char[size + 1]; - } catch (const std::bad_alloc&) { - data = 0; - data_size = 0; - } + + data = new char[size + 1]; if ( ( 0 != size ) && ( 0 != data ) ) { stream.seekg( (*convertor)( header.sh_offset ) ); diff --git a/source/elfio/elfio_segment.hpp b/source/elfio/elfio_segment.hpp index 642fd29..e906f3e 100644 --- a/source/elfio/elfio_segment.hpp +++ b/source/elfio/elfio_segment.hpp @@ -206,11 +206,7 @@ class segment_impl : public segment data = 0; } else { - try { - data = new char[size + 1]; - } catch (const std::bad_alloc&) { - data = 0; - } + data = new char[size + 1]; if ( 0 != data ) { stream.read( data, size );