Skip to content

Commit

Permalink
C++ modernize: Pragma once (#6264)
Browse files Browse the repository at this point in the history
* Migrate cpp headers to pragma once
  • Loading branch information
nerzhul committed Aug 17, 2017
1 parent c738d1e commit 921151d
Show file tree
Hide file tree
Showing 236 changed files with 288 additions and 1,028 deletions.
6 changes: 1 addition & 5 deletions src/activeobject.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef ACTIVEOBJECT_HEADER
#define ACTIVEOBJECT_HEADER
#pragma once

#include "irr_aabb3d.h"
#include <string>
Expand Down Expand Up @@ -102,6 +101,3 @@ class ActiveObject
protected:
u16 m_id; // 0 is invalid, "no id"
};

#endif

5 changes: 1 addition & 4 deletions src/ban.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef BAN_HEADER
#define BAN_HEADER
#pragma once

#include "util/string.h"
#include "threading/thread.h"
Expand Down Expand Up @@ -48,5 +47,3 @@ class BanManager
StringMap m_ips;
bool m_modified = false;
};

#endif
5 changes: 1 addition & 4 deletions src/camera.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CAMERA_HEADER
#define CAMERA_HEADER
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "inventory.h"
Expand Down Expand Up @@ -232,5 +231,3 @@ class Camera

std::list<Nametag *> m_nametags;
};

#endif
5 changes: 1 addition & 4 deletions src/cavegen.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CAVEGEN_HEADER
#define CAVEGEN_HEADER
#pragma once

#define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1

Expand Down Expand Up @@ -241,5 +240,3 @@ class CavesV6

inline s16 getSurfaceFromHeightmap(v3s16 p);
};

#endif
6 changes: 1 addition & 5 deletions src/chat.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CHAT_HEADER
#define CHAT_HEADER
#pragma once

#include <string>
#include <vector>
Expand Down Expand Up @@ -287,6 +286,3 @@ class ChatBackend
ChatBuffer m_recent_buffer;
ChatPrompt m_prompt;
};

#endif

5 changes: 1 addition & 4 deletions src/chat_interface.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CHAT_INTERFACE_H
#define CHAT_INTERFACE_H
#pragma once

#include "util/container.h"
#include <string>
Expand Down Expand Up @@ -78,5 +77,3 @@ struct ChatInterface {
MutexedQueue<ChatEvent *> command_queue; // chat backend --> server
MutexedQueue<ChatEvent *> outgoing_queue; // server --> chat backend
};

#endif
5 changes: 1 addition & 4 deletions src/chatmessage.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef MT_CHATMESSAGE_H
#define MT_CHATMESSAGE_H
#pragma once

#include <string>
#include <ctime>
Expand Down Expand Up @@ -47,5 +46,3 @@ struct ChatMessage
std::wstring sender = L"";
std::time_t timestamp = std::time(0);
};

#endif
5 changes: 1 addition & 4 deletions src/client.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENT_HEADER
#define CLIENT_HEADER
#pragma once

#include "network/connection.h"
#include "clientenvironment.h"
Expand Down Expand Up @@ -718,5 +717,3 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
u64 m_csm_flavour_limits = CSMFlavourLimit::CSM_FL_NONE;
u32 m_csm_noderange_limit = 8;
};

#endif // !CLIENT_HEADER
5 changes: 1 addition & 4 deletions src/client/clientlauncher.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef __CLIENT_LAUNCHER_H__
#define __CLIENT_LAUNCHER_H__
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "client/inputhandler.h"
Expand Down Expand Up @@ -69,5 +68,3 @@ class ClientLauncher
std::string current_address = "does-not-exist";
int current_port = 0;
};

#endif
5 changes: 1 addition & 4 deletions src/client/inputhandler.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef INPUT_HANDLER_H
#define INPUT_HANDLER_H
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "joystick_controller.h"
Expand Down Expand Up @@ -393,5 +392,3 @@ class RandomInputHandler : public InputHandler
bool leftreleased = false;
bool rightreleased = false;
};

#endif
5 changes: 1 addition & 4 deletions src/client/joystick_controller.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef JOYSTICK_HEADER
#define JOYSTICK_HEADER
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "keys.h"
Expand Down Expand Up @@ -168,5 +167,3 @@ class JoystickController {
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_past_pressed_keys;
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_past_released_keys;
};

#endif
5 changes: 1 addition & 4 deletions src/client/keys.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef KEYS_HEADER
#define KEYS_HEADER
#pragma once

#include <list>

Expand Down Expand Up @@ -114,5 +113,3 @@ class KeyType
};

typedef KeyType::T GameKeyType;

#endif
4 changes: 1 addition & 3 deletions src/client/tile.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef TILE_HEADER
#define TILE_HEADER
#pragma once

#include "irrlichttypes.h"
#include "irr_v3d.h"
Expand Down Expand Up @@ -330,4 +329,3 @@ struct TileSpec
//! The first is base texture, the second is overlay.
TileLayer layers[MAX_TILE_LAYERS];
};
#endif
5 changes: 1 addition & 4 deletions src/clientenvironment.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENT_ENVIRONMENT_HEADER
#define CLIENT_ENVIRONMENT_HEADER
#pragma once

#include <ISceneManager.h>
#include "environment.h"
Expand Down Expand Up @@ -158,5 +157,3 @@ class ClientEnvironment : public Environment
std::list<std::string> m_player_names;
v3s16 m_camera_offset;
};

#endif
6 changes: 2 additions & 4 deletions src/clientiface.h
Expand Up @@ -16,8 +16,8 @@ You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _CLIENTIFACE_H_
#define _CLIENTIFACE_H_

#pragma once

#include "irr_v3d.h" // for irrlicht datatypes

Expand Down Expand Up @@ -500,5 +500,3 @@ class ClientInterface {

static const char *statenames[];
};

#endif
6 changes: 1 addition & 5 deletions src/clientmap.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENTMAP_HEADER
#define CLIENTMAP_HEADER
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "map.h"
Expand Down Expand Up @@ -137,6 +136,3 @@ class ClientMap : public Map, public scene::ISceneNode
bool m_cache_bilinear_filter;
bool m_cache_anistropic_filter;
};

#endif

5 changes: 1 addition & 4 deletions src/clientmedia.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENTMEDIA_HEADER
#define CLIENTMEDIA_HEADER
#pragma once

#include "irrlichttypes.h"
#include "filecache.h"
Expand Down Expand Up @@ -147,5 +146,3 @@ class ClientMediaDownloader
std::string m_name_bound = "";

};

#endif // !CLIENTMEDIA_HEADER
5 changes: 1 addition & 4 deletions src/clientobject.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENTOBJECT_HEADER
#define CLIENTOBJECT_HEADER
#pragma once

#include "irrlichttypes_extrabloated.h"
#include "activeobject.h"
Expand Down Expand Up @@ -106,5 +105,3 @@ struct DistanceSortedActiveObject
return d < other.d;
}
};

#endif
5 changes: 1 addition & 4 deletions src/clientsimpleobject.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENTSIMPLEOBJECT_HEADER
#define CLIENTSIMPLEOBJECT_HEADER
#pragma once

#include "irrlichttypes_bloated.h"
class ClientEnvironment;
Expand All @@ -34,5 +33,3 @@ class ClientSimpleObject

virtual void step(float dtime) {}
};

#endif
5 changes: 1 addition & 4 deletions src/cloudparams.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLOUDPARAMS_HEADER
#define CLOUDPARAMS_HEADER
#pragma once

struct CloudParams
{
Expand All @@ -29,5 +28,3 @@ struct CloudParams
float height;
v2f speed;
};

#endif
7 changes: 1 addition & 6 deletions src/clouds.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLOUDS_HEADER
#define CLOUDS_HEADER
#pragma once

#include "irrlichttypes_extrabloated.h"
#include <iostream>
Expand Down Expand Up @@ -143,7 +142,3 @@ class Clouds : public scene::ISceneNode
bool m_camera_inside_cloud = false;

};



#endif
6 changes: 1 addition & 5 deletions src/cmake_config.h.in
@@ -1,7 +1,6 @@
// Filled in by the build system

#ifndef CMAKE_CONFIG_H
#define CMAKE_CONFIG_H
#pragma once

#define PROJECT_NAME "@PROJECT_NAME@"
#define PROJECT_NAME_C "@PROJECT_NAME_CAPITALIZED@"
Expand Down Expand Up @@ -34,6 +33,3 @@
#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H
#cmakedefine01 CURSES_HAVE_NCURSESW_NCURSES_H
#cmakedefine01 CURSES_HAVE_NCURSESW_CURSES_H

#endif

6 changes: 1 addition & 5 deletions src/cmake_config_githash.h.in
@@ -1,10 +1,6 @@
// Filled in by the build system
// Separated from cmake_config.h to avoid excessive rebuilds on every commit

#ifndef CMAKE_CONFIG_GITHASH_H
#define CMAKE_CONFIG_GITHASH_H
#pragma once

#define VERSION_GITHASH "@VERSION_GITHASH@"

#endif

7 changes: 1 addition & 6 deletions src/collision.h
Expand Up @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef COLLISION_HEADER
#define COLLISION_HEADER
#pragma once

#include "irrlichttypes_bloated.h"
#include <vector>
Expand Down Expand Up @@ -76,7 +75,3 @@ bool wouldCollideWithCeiling(
const std::vector<aabb3f> &staticboxes,
const aabb3f &movingbox,
f32 y_increase, f32 d);


#endif

0 comments on commit 921151d

Please sign in to comment.