Skip to content

Commit

Permalink
Rename macros with two leading underscores
Browse files Browse the repository at this point in the history
These names are reserved for the compiler/library implementations.
  • Loading branch information
ShadowNinja authored and kwolekr committed Oct 14, 2015
1 parent 6f4d6cb commit 6f2d785
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 113 deletions.
4 changes: 2 additions & 2 deletions src/camera.cpp
Expand Up @@ -79,7 +79,7 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,

m_camera_mode(CAMERA_MODE_FIRST)
{
//dstream<<__FUNCTION_NAME<<std::endl;
//dstream<<FUNCTION_NAME<<std::endl;

// note: making the camera node a child of the player node
// would lead to unexpected behaviour, so we don't do that.
Expand Down Expand Up @@ -494,7 +494,7 @@ void Camera::updateViewingRange(f32 frametime_in, f32 busytime_in)
return;
m_frametime_counter = 0.2; // Same as ClientMap::updateDrawList interval

/*dstream<<__FUNCTION_NAME
/*dstream<<FUNCTION_NAME
<<": Collected "<<m_added_frames<<" frames, total of "
<<m_added_busytime<<"s."<<std::endl;
Expand Down
20 changes: 10 additions & 10 deletions src/client.cpp
Expand Up @@ -98,7 +98,7 @@ MeshUpdateQueue::~MeshUpdateQueue()
*/
void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

assert(data); // pre-condition

Expand Down Expand Up @@ -323,7 +323,7 @@ void Client::connect(Address address,
const std::string &address_name,
bool is_local_server)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

initLocalMapSaving(address, address_name, is_local_server);

Expand All @@ -333,7 +333,7 @@ void Client::connect(Address address,

void Client::step(float dtime)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

// Limit a bit
if(dtime > 2.0)
Expand Down Expand Up @@ -824,7 +824,7 @@ void Client::initLocalMapSaving(const Address &address,

void Client::ReceiveAll()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
u32 start_ms = porting::getTimeMs();
for(;;)
{
Expand All @@ -850,7 +850,7 @@ void Client::ReceiveAll()

void Client::Receive()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
NetworkPacket pkt;
m_con.Receive(&pkt);
ProcessData(&pkt);
Expand All @@ -867,7 +867,7 @@ inline void Client::handleCommand(NetworkPacket* pkt)
*/
void Client::ProcessData(NetworkPacket *pkt)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

ToClientCommand command = (ToClientCommand) pkt->getCommand();
u32 sender_peer_id = pkt->getPeerId();
Expand Down Expand Up @@ -1213,7 +1213,7 @@ void Client::sendChangePassword(const std::string &oldpassword,

void Client::sendDamage(u8 damage)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
pkt << damage;
Expand All @@ -1222,7 +1222,7 @@ void Client::sendDamage(u8 damage)

void Client::sendBreath(u16 breath)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

NetworkPacket pkt(TOSERVER_BREATH, sizeof(u16));
pkt << breath;
Expand All @@ -1231,15 +1231,15 @@ void Client::sendBreath(u16 breath)

void Client::sendRespawn()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

NetworkPacket pkt(TOSERVER_RESPAWN, 0);
Send(&pkt);
}

void Client::sendReady()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

NetworkPacket pkt(TOSERVER_CLIENT_READY,
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
Expand Down
2 changes: 1 addition & 1 deletion src/clientiface.cpp
Expand Up @@ -67,7 +67,7 @@ void RemoteClient::GetNextBlocks (
float dtime,
std::vector<PrioritySortedBlockTransfer> &dest)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);


// Increment timers
Expand Down
4 changes: 2 additions & 2 deletions src/clientmap.cpp
Expand Up @@ -81,7 +81,7 @@ ClientMap::~ClientMap()

MapSector * ClientMap::emergeSector(v2s16 p2d)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
// Check that it doesn't exist already
try{
return getSectorNoGenerate(p2d);
Expand Down Expand Up @@ -400,7 +400,7 @@ struct MeshBufListList

void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;

Expand Down
2 changes: 1 addition & 1 deletion src/content_cao.cpp
Expand Up @@ -465,7 +465,7 @@ void ItemCAO::updateTexture()
}
catch(SerializationError &e)
{
warningstream<<__FUNCTION_NAME
warningstream<<FUNCTION_NAME
<<": error deSerializing itemstring \""
<<m_itemstring<<std::endl;
}
Expand Down
6 changes: 3 additions & 3 deletions src/content_nodemeta.cpp
Expand Up @@ -154,9 +154,9 @@ void content_nodemeta_deserialize_legacy(std::istream &is,

if(version > 1)
{
infostream<<__FUNCTION_NAME<<": version "<<version<<" not supported"
infostream<<FUNCTION_NAME<<": version "<<version<<" not supported"
<<std::endl;
throw SerializationError(__FUNCTION_NAME);
throw SerializationError(FUNCTION_NAME);
}

u16 count = readU16(is);
Expand All @@ -174,7 +174,7 @@ void content_nodemeta_deserialize_legacy(std::istream &is,

if(meta->get(p) != NULL)
{
warningstream<<__FUNCTION_NAME<<": "
warningstream<<FUNCTION_NAME<<": "
<<"already set data at position"
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
<<std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/content_sao.cpp
Expand Up @@ -393,7 +393,7 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)

std::string LuaEntitySAO::getStaticData()
{
verbosestream<<__FUNCTION_NAME<<std::endl;
verbosestream<<FUNCTION_NAME<<std::endl;
std::ostringstream os(std::ios::binary);
// version
writeU8(os, 1);
Expand Down
14 changes: 5 additions & 9 deletions src/debug.h
Expand Up @@ -35,13 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifdef _MSC_VER
#include <eh.h>
#endif
#define __NORETURN __declspec(noreturn)
#define __FUNCTION_NAME __FUNCTION__
#define NORETURN __declspec(noreturn)
#define FUNCTION_NAME __FUNCTION__
#else
#define __NORETURN __attribute__ ((__noreturn__))
#define __FUNCTION_NAME __PRETTY_FUNCTION__
#define NORETURN __attribute__ ((__noreturn__))
#define FUNCTION_NAME __PRETTY_FUNCTION__
#endif
Expand All @@ -57,16 +53,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,

/* Abort program execution immediately
*/
__NORETURN extern void fatal_error_fn(
NORETURN extern void fatal_error_fn(
const char *msg, const char *file,
unsigned int line, const char *function);

#define FATAL_ERROR(msg) \
fatal_error_fn((msg), __FILE__, __LINE__, __FUNCTION_NAME)
fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME)

#define FATAL_ERROR_IF(expr, msg) \
((expr) \
? fatal_error_fn((msg), __FILE__, __LINE__, __FUNCTION_NAME) \
? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \
: (void)(0))

/*
Expand All @@ -75,14 +71,14 @@ __NORETURN extern void fatal_error_fn(
defined)
*/

__NORETURN extern void sanity_check_fn(
NORETURN extern void sanity_check_fn(
const char *assertion, const char *file,
unsigned int line, const char *function);

#define SANITY_CHECK(expr) \
((expr) \
? (void)(0) \
: sanity_check_fn(#expr, __FILE__, __LINE__, __FUNCTION_NAME))
: sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME))

#define sanity_check(expr) SANITY_CHECK(expr)

Expand Down
2 changes: 1 addition & 1 deletion src/emerge.cpp
Expand Up @@ -627,7 +627,7 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,

void *EmergeThread::run()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
BEGIN_DEBUG_EXCEPTION_HANDLER

v3s16 pos;
Expand Down
8 changes: 4 additions & 4 deletions src/environment.cpp
Expand Up @@ -70,7 +70,7 @@ Environment::~Environment()

void Environment::addPlayer(Player *player)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
/*
Check that peer_ids are unique.
Also check that names are unique.
Expand Down Expand Up @@ -982,7 +982,7 @@ void ServerEnvironment::clearAllObjects()

void ServerEnvironment::step(float dtime)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

//TimeTaker timer("ServerEnv step");

Expand Down Expand Up @@ -2028,7 +2028,7 @@ ClientMap & ClientEnvironment::getClientMap()

void ClientEnvironment::addPlayer(Player *player)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);
/*
It is a failure if player is local and there already is a local
player
Expand All @@ -2052,7 +2052,7 @@ LocalPlayer * ClientEnvironment::getLocalPlayer()

void ClientEnvironment::step(float dtime)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

/* Step time of day */
stepTimeOfDay(dtime);
Expand Down
2 changes: 1 addition & 1 deletion src/httpfetch.cpp
Expand Up @@ -616,7 +616,7 @@ class CurlFetchThread : public Thread

void *run()
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

CurlHandlePool pool;

Expand Down
4 changes: 2 additions & 2 deletions src/inventory.cpp
Expand Up @@ -126,7 +126,7 @@ ItemStack::ItemStack(std::string name_, u16 count_,

void ItemStack::serialize(std::ostream &os) const
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

if(empty())
return;
Expand All @@ -151,7 +151,7 @@ void ItemStack::serialize(std::ostream &os) const

void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

clear();

Expand Down
2 changes: 1 addition & 1 deletion src/inventorymanager.cpp
Expand Up @@ -886,7 +886,7 @@ bool getCraftingResult(Inventory *inv, ItemStack& result,
std::vector<ItemStack> &output_replacements,
bool decrementInput, IGameDef *gamedef)
{
DSTACK(__FUNCTION_NAME);
DSTACK(FUNCTION_NAME);

result.clear();

Expand Down

0 comments on commit 6f2d785

Please sign in to comment.