Fix Win32 (or GCC 4.8?) compilation

This commit is contained in:
Ilari Liusvaara 2013-09-27 22:57:24 +03:00
parent a41894d5d3
commit 06f099f877
7 changed files with 51 additions and 32 deletions

View file

@ -0,0 +1,11 @@
#ifndef _library__eatarg__hpp__included__
#define _library__eatarg__hpp__included__
void __attribute__((noinline)) _eat_argument(void* arg);
template<typename T> void eat_argument(T arg) {
T* arg2 = &arg;
_eat_argument((void*)arg2);
}
#endif

View file

@ -49,7 +49,7 @@ template<class T>
class recent_files
{
public:
recent_files(const std::string& cfgfile, size_t maxcount);
recent_files(const std::string& cfgfile, size_t maxcount) __attribute__((noinline));
void add(const T& file);
void add_hook(recent_files_hook& h);
void remove_hook(recent_files_hook& h);

View file

@ -11,7 +11,7 @@ class recent_menu : public wxMenu
{
public:
recent_menu(wxWindow* win, int wxid_low, int wxid_high, const std::string& cfg,
void (*cb)(const T& name));
void (*cb)(const T& name)) __attribute__((noinline));
void on_select(wxCommandEvent& e);
void update();
void add(const T& file);

5
src/library/eatarg.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "eatarg.hpp"
void _eat_argument(void* arg)
{
}

View file

@ -1,4 +1,5 @@
#include "memorysearch.hpp"
#include "eatarg.hpp"
#include "minmax.hpp"
#include "serialization.hpp"
#include "int24.hpp"
@ -362,31 +363,31 @@ template<typename T> void memory_search::s_seqgt() throw() { search(search_seqgt
template<typename T> void memorysearch_pull_type(memory_search& s)
{
T val;
s.s_value<T>(val);
s.s_difference<T>(val);
s.s_lt<T>();
s.s_le<T>();
s.s_eq<T>();
s.s_ne<T>();
s.s_ge<T>();
s.s_gt<T>();
s.s_seqlt<T>();
s.s_seqle<T>();
s.s_seqge<T>();
s.s_seqgt<T>();
eat_argument(&memory_search::s_value<T>);
eat_argument(&memory_search::s_difference<T>);
eat_argument(&memory_search::s_lt<T>);
eat_argument(&memory_search::s_le<T>);
eat_argument(&memory_search::s_eq<T>);
eat_argument(&memory_search::s_ne<T>);
eat_argument(&memory_search::s_ge<T>);
eat_argument(&memory_search::s_gt<T>);
eat_argument(&memory_search::s_seqlt<T>);
eat_argument(&memory_search::s_seqle<T>);
eat_argument(&memory_search::s_seqge<T>);
eat_argument(&memory_search::s_seqgt<T>);
}
template<typename T> void memorysearch_pull_type2(memory_search& s)
{
T val;
s.s_value<T>(val);
s.s_difference<T>(val);
s.s_lt<T>();
s.s_le<T>();
s.s_eq<T>();
s.s_ne<T>();
s.s_ge<T>();
s.s_gt<T>();
eat_argument(&memory_search::s_value<T>);
eat_argument(&memory_search::s_difference<T>);
eat_argument(&memory_search::s_lt<T>);
eat_argument(&memory_search::s_le<T>);
eat_argument(&memory_search::s_eq<T>);
eat_argument(&memory_search::s_ne<T>);
eat_argument(&memory_search::s_ge<T>);
eat_argument(&memory_search::s_gt<T>);
}
void memorysearch_pull_all(memory_search& s)

View file

@ -1,5 +1,6 @@
#include "recentfiles.hpp"
#include "zip.hpp"
#include "eatarg.hpp"
#include "json.hpp"
#include "string.hpp"
#include <fstream>
@ -247,13 +248,13 @@ recent_files_hook::~recent_files_hook()
void _dummy_63263632747434353545()
{
recent_files<recentfile_path> x("", 0);
x.add(recentfile_path(""));
x.add_hook(*(recent_files_hook*)NULL);
x.remove_hook(*(recent_files_hook*)NULL);
x.get();
eat_argument(&recent_files<recentfile_path>::add);
eat_argument(&recent_files<recentfile_path>::add_hook);
eat_argument(&recent_files<recentfile_path>::remove_hook);
eat_argument(&recent_files<recentfile_path>::get);
recent_files<recentfile_multirom> y("", 0);
y.add(recentfile_multirom());
y.add_hook(*(recent_files_hook*)NULL);
y.remove_hook(*(recent_files_hook*)NULL);
y.get();
eat_argument(&recent_files<recentfile_multirom>::add);
eat_argument(&recent_files<recentfile_multirom>::add_hook);
eat_argument(&recent_files<recentfile_multirom>::remove_hook);
eat_argument(&recent_files<recentfile_multirom>::get);
}

View file

@ -1,5 +1,6 @@
#include "platform/wxwidgets/menu_recent.hpp"
#include "platform/wxwidgets/platform.hpp"
#include "library/eatarg.hpp"
template<class T>
recent_menu<T>::recent_menu(wxWindow* win, int wxid_low, int wxid_high, const std::string& cfg,
@ -63,6 +64,6 @@ void _dummy_3642632773273272787237272723()
{
recent_menu<recentfile_path> x(NULL, 0, 0, "", NULL);
recent_menu<recentfile_multirom> y(NULL, 0, 0, "", NULL);
x.add(recentfile_path());
y.add(recentfile_multirom());
eat_argument(&recent_menu<recentfile_path>::add);
eat_argument(&recent_menu<recentfile_multirom>::add);
}