From f0233fb7f22b5e1135e45e83989398ca3a20211d Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Mon, 16 Jun 2014 12:39:14 +0300 Subject: [PATCH] Fix build on GCC 4.9 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Seems like GCC 4.9 likes to warn about unused functions: - Remove unused function linintr_solve() - Remove unused function endian_char() - Remove unused function implode() - Remove unused copy of function read_active_macros() - Remove unused function format_type() - Make function seemingly poking some stuff in int24.cpp global (never called) - Remove unused data numbers_l - Remove unused data numbers_u - Remove unused function print_decimals() - Remove unused function format_float_base() - Remove unused function substr() - Remove unused function get_levelsize() - Remove unused function default_headersize() - Remove unused function get_button_name() - Remove unused function get_axis_name() - Remove unused function pick_volume() - Remove unused function UI_controller_index_by_logical() - Remove unused function movie_path() ­ Remove unused function clear_clipboard() - Remove unused function string_pad() --- src/core/audioapi.cpp | 6 ---- src/core/misc.cpp | 9 ------ src/core/moviefile-text-save.cpp | 32 ------------------ src/core/romguess.cpp | 12 ------- src/interface/romtype.cpp | 5 --- src/library/httpauth.cpp | 5 --- src/library/int24.cpp | 14 ++++---- src/library/integer-pool.cpp | 15 --------- src/library/mathexpr-format.cpp | 57 --------------------------------- src/library/png.cpp | 15 --------- src/platform/evdev/joystick.cpp | 16 --------- src/platform/wxwidgets/editor-movie.cpp | 5 --- src/platform/wxwidgets/mainwindow.cpp | 33 ------------------- src/platform/wxwidgets/status.cpp | 12 ------- 14 files changed, 7 insertions(+), 229 deletions(-) diff --git a/src/core/audioapi.cpp b/src/core/audioapi.cpp index c617a9a6..c68eeb70 100644 --- a/src/core/audioapi.cpp +++ b/src/core/audioapi.cpp @@ -64,12 +64,6 @@ namespace C = (-2 * v1 - 3 * v2 + 6 * v3 - v4) / 6; D = v2; } - - void linintr_solve(double v1, double v2, double& A, double& B) - { - A = (v2 - v1); - B = v1; - } } audioapi_instance::resampler::resampler() diff --git a/src/core/misc.cpp b/src/core/misc.cpp index e0ba4ff0..541939fc 100644 --- a/src/core/misc.cpp +++ b/src/core/misc.cpp @@ -41,15 +41,6 @@ namespace { bool reached_main_flag; - char endian_char(int e) - { - if(e < 0) - return 'L'; - if(e > 0) - return 'B'; - return 'N'; - } - void fatal_signal_handler(int sig) { write(2, "Caught fatal signal!\n", 21); diff --git a/src/core/moviefile-text-save.cpp b/src/core/moviefile-text-save.cpp index 874da83c..c3c3636f 100644 --- a/src/core/moviefile-text-save.cpp +++ b/src/core/moviefile-text-save.cpp @@ -18,38 +18,6 @@ namespace { - std::map read_active_macros(zip::reader& r, const std::string& member) - { - std::map x; - if(!r.has_member(member)) - return x; - std::istream& m = r[member]; - try { - while(m) { - std::string out; - std::getline(m, out); - istrip_CR(out); - if(out == "") - continue; - regex_results rx = regex("([0-9]+) +(.*)", out); - if(!rx) { - messages << "Warning: Bad macro state: '" << out << "'" << std::endl; - continue; - } - try { - uint64_t f = parse_value(rx[1]); - x[rx[2]] = f; - } catch(...) { - } - } - delete &m; - } catch(...) { - delete &m; - throw; - } - return x; - } - void write_active_macros(zip::writer& w, const std::string& member, const std::map& ma) { if(ma.empty()) diff --git a/src/core/romguess.cpp b/src/core/romguess.cpp index 0b3f55fc..6ee731ef 100644 --- a/src/core/romguess.cpp +++ b/src/core/romguess.cpp @@ -134,18 +134,6 @@ namespace return ""; } - std::string implode(const std::set& s, const std::string& e) - { - bool first = true; - std::ostringstream y; - for(auto i : s) { - if(!first) y << e; - y << i; - first = false; - } - return y.str(); - } - std::string try_guess_rom_core(const std::string& hint, const std::string& hash, const std::string& xhash, const std::set& extensions, uint64_t headersize, bool bios) { diff --git a/src/interface/romtype.cpp b/src/interface/romtype.cpp index 2879aeea..e4436edf 100644 --- a/src/interface/romtype.cpp +++ b/src/interface/romtype.cpp @@ -55,11 +55,6 @@ namespace { return (a->get_handle() < b->get_handle()); } - - unsigned default_headersize(size_t imagesize) - { - return 0; - } } bool interface_action::is_toggle() const diff --git a/src/library/httpauth.cpp b/src/library/httpauth.cpp index 2c2bc344..3d5ba86d 100644 --- a/src/library/httpauth.cpp +++ b/src/library/httpauth.cpp @@ -99,11 +99,6 @@ namespace return CHRCLASS_EOS; } - std::string substr(std::string x, std::pair m, size_t base) - { - return x.substr(m.first + base, m.second); - } - bool read_char(const std::string& input, size_t& itr, char ch) { if(input[itr] == ch) { diff --git a/src/library/int24.cpp b/src/library/int24.cpp index b2dfca28..3547030f 100644 --- a/src/library/int24.cpp +++ b/src/library/int24.cpp @@ -47,12 +47,12 @@ namespace { char assert1[(sizeof(ss_int24_t) == 3) ? 1 : -1]; char assert2[(sizeof(ss_uint24_t) == 3) ? 1 : -1]; +} - void foo() - { - char* x = assert1; - x[0] = 0; - x = assert2; - x[0] = 1; - } +void dummy_3263623632786738267323() +{ + char* x = assert1; + x[0] = 0; + x = assert2; + x[0] = 1; } diff --git a/src/library/integer-pool.cpp b/src/library/integer-pool.cpp index 5094109e..8d3ab68e 100644 --- a/src/library/integer-pool.cpp +++ b/src/library/integer-pool.cpp @@ -65,21 +65,6 @@ namespace return levels; } - uint64_t get_levelsize(unsigned n) - { - static uint64_t table[levels]; - static bool init = false; - if(!init) { - uint64_t r = 1; - for(unsigned i = 0; i < levels; i++) { - table[i] = r; - r = 8 * r + 1; - } - init = true; - } - return table[n]; - } - unsigned lsbz(uint8_t b) { return ((b & 1) ? ((b & 2) ? ((b & 4) ? ((b & 8) ? ((b & 16) ? ((b & 32) ? ((b & 64) ? diff --git a/src/library/mathexpr-format.cpp b/src/library/mathexpr-format.cpp index 748d414b..ce32588c 100644 --- a/src/library/mathexpr-format.cpp +++ b/src/library/mathexpr-format.cpp @@ -30,63 +30,6 @@ namespace return int_to_bits(v >> 1) + std::string(1, 48 + (v & 1)); } - const char* numbers_l = "0123456789abcdef"; - const char* numbers_u = "0123456789ABCDEF"; - - std::string print_decimals(double tail, unsigned base, int places, bool trimzero, bool uppercase) - { - std::string y; - for(int i = 0; i < places; i++) { - uint32_t n = floor(tail); - y += std::string(1, (uppercase ? numbers_u : numbers_l)[n % base]); - tail *= base; - tail = tail - n; - } - if(trimzero) { - size_t p = y.find_last_not_of("0"); - if(p < y.length()) - y = y.substr(0, p); - } - return y; - } - - std::string format_float_base(double v, _format fmt, unsigned base) - { - bool exponential = false; - std::string out; - char expsep = (base == 16) ? 'g' : 'e'; - if(fmt.uppercasehex) expsep -= 32; - int exponent = 0; - v += 0.5 * pow(base, fmt.precision); //Round. -again: - out = ""; - if(fmt.showsign || v < 0) - out += (v < 0) ? "-" : "+"; - if(exponential) { - //TODO. - out += std::string(1, expsep); - out += (stringfmt() << exponent).str(); - } else { - //TODO: Print whole part. - double tail = v - floor(v); - if(fmt.precision < 0) { - //Print up to 5 places. - std::string y = print_decimals(tail, base, fmt.precision, true, fmt.uppercasehex); - if(y != "") - out = out + "." + y; - } else if(fmt.precision > 0) { - //Print . and fmt.precision places. - out += "."; - out += print_decimals(tail, base, fmt.precision, false, fmt.uppercasehex); - } - } - if(!exponential && (ssize_t)out.length() > fmt.width) { - exponential = true; - goto again; - } - return out; - } - std::string format_float_10(double v, _format fmt) { std::string format; diff --git a/src/library/png.cpp b/src/library/png.cpp index 1e33fa7d..7ffcf560 100644 --- a/src/library/png.cpp +++ b/src/library/png.cpp @@ -281,21 +281,6 @@ namespace throw std::runtime_error("PNG file chunk CRC check failed"); } - std::string format_type(uint32_t type) - { - uint8_t t1 = type >> 24; - uint8_t t2 = type >> 16; - uint8_t t3 = type >> 8; - uint8_t t4 = type; - if(t1 < 'A' || t2 < 'A' || t3 < 'A' || t4 < 'A') - goto badtype; - if(t1 > 'z' || t2 > 'z' || t3 > 'z' || t4 > 'z') - goto badtype; - return (stringfmt() << t1 << t2 << t3 << t4).str(); -badtype: - return hex::to(type, true); - } - //========================================================= //=================== PNG IHDR CHUNK ====================== //========================================================= diff --git a/src/platform/evdev/joystick.cpp b/src/platform/evdev/joystick.cpp index 2ee581d0..17e2bc23 100644 --- a/src/platform/evdev/joystick.cpp +++ b/src/platform/evdev/joystick.cpp @@ -169,22 +169,6 @@ namespace std::map gamepad_map; - std::string get_button_name(uint16_t code) - { - if(code <= sizeof(buttonnames)/sizeof(buttonnames[0]) && buttonnames[code]) - return buttonnames[code]; - else - return (stringfmt() << "Unknown button #" << code).str(); - } - - std::string get_axis_name(uint16_t code) - { - if(code <= sizeof(axisnames)/sizeof(axisnames[0]) && axisnames[code]) - return axisnames[code]; - else - return (stringfmt() << "Unknown axis #" << code).str(); - } - bool read_one_input_event(int fd) { struct input_event ev; diff --git a/src/platform/wxwidgets/editor-movie.cpp b/src/platform/wxwidgets/editor-movie.cpp index 2280204b..80f94f47 100644 --- a/src/platform/wxwidgets/editor-movie.cpp +++ b/src/platform/wxwidgets/editor-movie.cpp @@ -346,11 +346,6 @@ namespace return (clipboard.length() > 0); } - void clear_clipboard() - { - clipboard = ""; - } - std::string copy_from_clipboard() { return clipboard; diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index ad091f65..977a80cb 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -535,27 +535,6 @@ namespace } - double pick_volume(wxWindow* win, const std::string& title, std::string& last) - { - std::string value; - regex_results r; - double parsed = 1; - value = pick_text(win, title, "Enter volume in absolute units, percentage (%) or dB:", - last); - if(r = regex("([0-9]*\\.[0-9]+|[0-9]+)", value)) - parsed = strtod(r[1].c_str(), NULL); - else if(r = regex("([0-9]*\\.[0-9]+|[0-9]+)%", value)) - parsed = strtod(r[1].c_str(), NULL) / 100; - else if(r = regex("([+-]?([0-9]*.[0-9]+|[0-9]+))dB", value)) - parsed = pow(10, strtod(r[1].c_str(), NULL) / 20); - else { - wxMessageBox(wxT("Invalid volume"), _T("Error"), wxICON_EXCLAMATION | wxOK, win); - return -1; - } - last = value; - return parsed; - } - void recent_rom_selected(emulator_instance& inst, const recentfiles::multirom& file) { romload_request req; @@ -638,13 +617,6 @@ namespace return ret; } - std::pair UI_controller_index_by_logical(emulator_instance& inst, unsigned lid) - { - std::pair ret; - inst.iqueue->run([&ret, lid]() { ret = CORE().controls->lcid_to_pcid(lid); }); - return ret; - } - void set_speed(emulator_instance& inst, double target) { if(target < 0) @@ -669,11 +641,6 @@ namespace } } - std::string movie_path(emulator_instance& inst) - { - return inst.setcache->get("moviepath"); - } - bool is_lsnes_movie(const std::string& filename) { std::istream* s = NULL; diff --git a/src/platform/wxwidgets/status.cpp b/src/platform/wxwidgets/status.cpp index a0f8cf0b..7ed77f81 100644 --- a/src/platform/wxwidgets/status.cpp +++ b/src/platform/wxwidgets/status.cpp @@ -11,18 +11,6 @@ #define STATWIDTH 40 #define MAXSTATUS 15 -namespace -{ - std::string string_pad(const std::string& x, size_t width) - { - if(x.length() >= width) - return x; - std::string y = x; - y.append(width - y.length(), ' '); - return y; - } -} - wxwin_status::panel::panel(wxWindow* _parent, emulator_instance& _inst, wxWindow* focuswin, unsigned lines) : text_framebuffer_panel(_parent, STATWIDTH, lines ? lines : MAXSTATUS, wxID_ANY, focuswin), inst(_inst) { -- 2.11.4.GIT