Eliminate use of __attribute__

Ideally this would be standard C++, but here I've settled for things that should be supported by both clang and VS/cl.exe:
- Deprecated attribute retained, but now uses __declspec syntax
- Packed attribute replaced with pragma pack, except one instance where it unnecessary
- Aligned attribute replaced with explicit padding bytes inserted in the structs where needed
- Unused attribute simply removed (though where possible, the unused entities were also removed)
This commit is contained in:
2014-12-02 13:07:11 -05:00
parent d61c0a5c1e
commit 03c64ebd7b
20 changed files with 545 additions and 83 deletions

View File

@@ -22,7 +22,7 @@
extern sf::Texture bg_gworld;
void cButton::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
void cButton::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){
throw xHandlerNotSupported(true);
}
@@ -388,11 +388,11 @@ void cLedGroup::hide(std::string id){
choices[id]->hide();
}
void cLedGroup::setFormat(eFormat prop __attribute__((unused)), short val __attribute__((unused))) throw(xUnsupportedProp) {
void cLedGroup::setFormat(eFormat prop, short val) throw(xUnsupportedProp) {
throw xUnsupportedProp(prop);
}
short cLedGroup::getFormat(eFormat prop __attribute__((unused))) throw(xUnsupportedProp) {
short cLedGroup::getFormat(eFormat prop) throw(xUnsupportedProp) {
throw xUnsupportedProp(prop);
}

View File

@@ -256,11 +256,11 @@ cControl::cControl(eControlType t, cDialog& p) : parent(&p), inWindow(&p.win), t
cControl::cControl(eControlType t, sf::RenderWindow& p) : parent(NULL), inWindow(&p), type(t), visible(true), key({false, 0, mod_none}), frameStyle(0) {}
bool cControl::triggerClickHandler(cDialog& __attribute__((unused)), std::string __attribute__((unused)), eKeyMod __attribute__((unused)), location __attribute__((unused))){
bool cControl::triggerClickHandler(cDialog&, std::string, eKeyMod, location){
return true;
}
bool cControl::triggerFocusHandler(cDialog& me __attribute__((unused)), std::string id __attribute__((unused)), bool losingFocus __attribute__((unused))){
bool cControl::triggerFocusHandler(cDialog& me, std::string id, bool losingFocus){
return true;
}

View File

@@ -150,12 +150,12 @@ cStringChoice::cStringChoice(
void cStringChoice::attachHandlers() {
using namespace std::placeholders;
dlg["left"].attachClickHandler(std::bind(&cStringChoice::onLeft,this,_1,_2));
dlg["right"].attachClickHandler(std::bind(&cStringChoice::onRight,this,_1,_2));
dlg["done"].attachClickHandler(std::bind(&cStringChoice::onOkay,this,_1,_2));
dlg["cancel"].attachClickHandler(std::bind(&cStringChoice::onCancel,this,_1,_2));
dlg["left"].attachClickHandler(std::bind(&cStringChoice::onLeft,this));
dlg["right"].attachClickHandler(std::bind(&cStringChoice::onRight,this));
dlg["done"].attachClickHandler(std::bind(&cStringChoice::onOkay,this,_1));
dlg["cancel"].attachClickHandler(std::bind(&cStringChoice::onCancel,this,_1));
leds = &dynamic_cast<cLedGroup&>(dlg["strings"]);
leds->attachFocusHandler(std::bind(&cStringChoice::onSelect,this,_1,_3));
leds->attachFocusHandler(std::bind(&cStringChoice::onSelect,this,_3));
}
size_t cStringChoice::show(std::string select){
@@ -193,32 +193,32 @@ void cStringChoice::fillPage(){
}
}
bool cStringChoice::onLeft(cDialog& me __attribute__((unused)), std::string id __attribute__((unused))){
bool cStringChoice::onLeft(){
if(page == 0) page = strings.size() / per_page;
else page--;
fillPage();
return true;
}
bool cStringChoice::onRight(cDialog& me __attribute__((unused)), std::string id __attribute__((unused))){
bool cStringChoice::onRight(){
if(page == strings.size() / per_page) page = 0;
else page++;
fillPage();
return true;
}
bool cStringChoice::onCancel(cDialog& me, std::string id __attribute__((unused))){
bool cStringChoice::onCancel(cDialog& me){
me.toast();
return true;
}
bool cStringChoice::onOkay(cDialog& me, std::string id __attribute__((unused))){
bool cStringChoice::onOkay(cDialog& me){
dlg.setResult(cur);
me.toast();
return true;
}
bool cStringChoice::onSelect(cDialog& me, bool losing) {
bool cStringChoice::onSelect(bool losing) {
if(losing) return true;
int i = boost::lexical_cast<int>(leds->getSelected().substr(3));
cur = page * 40 + i - 1;

View File

@@ -82,11 +82,11 @@ public:
class cStringChoice {
static const size_t per_page;
cDialog dlg;
bool onLeft(cDialog& me, std::string id);
bool onRight(cDialog& me, std::string id);
bool onCancel(cDialog& me, std::string id);
bool onOkay(cDialog& me, std::string id);
bool onSelect(cDialog& me, bool losing);
bool onLeft();
bool onRight();
bool onCancel(cDialog& me);
bool onOkay(cDialog& me);
bool onSelect(bool losing);
void attachHandlers();
void fillPage();
std::vector<std::string> strings;

View File

@@ -11,11 +11,11 @@
#include "dialog.h"
#include "graphtool.h"
void cTextField::attachClickHandler(click_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
void cTextField::attachClickHandler(click_callback_t f) throw(xHandlerNotSupported){
throw xHandlerNotSupported(false);
}
void cTextField::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(){
void cTextField::attachFocusHandler(focus_callback_t f) throw(){
onFocus = f;
}
@@ -29,7 +29,7 @@ bool cTextField::triggerFocusHandler(cDialog& me, std::string id, bool losingFoc
return passed;
}
void cTextField::setFormat(eFormat prop, short val __attribute__((unused))) throw(xUnsupportedProp){
void cTextField::setFormat(eFormat prop, short val) throw(xUnsupportedProp){
throw xUnsupportedProp(prop);
}

View File

@@ -18,7 +18,7 @@ void cTextMsg::attachClickHandler(click_callback_t f) throw(){
clickable = onClick != NULL;
}
void cTextMsg::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
void cTextMsg::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){
throw xHandlerNotSupported(true);
}

View File

@@ -76,7 +76,7 @@ void cPict::attachClickHandler(click_callback_t f) throw(){
}
}
void cPict::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
void cPict::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){
throw xHandlerNotSupported(true);
}