From 90e994471a385d2b965e3843e1f693ccba6fb699 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Sun, 17 Aug 2014 13:45:50 -0400
Subject: [PATCH] Common: Move header guards over to pragma once

Also replaced C headers with the C++ equivalent ones
---
 src/common/atomic.h                 |  5 +----
 src/common/atomic_gcc.h             |  5 +----
 src/common/atomic_win32.h           |  5 +----
 src/common/break_points.h           |  5 +----
 src/common/chunk_file.h             |  5 +----
 src/common/common.h                 | 11 ++++-------
 src/common/common_funcs.h           |  5 +----
 src/common/common_paths.h           |  5 +----
 src/common/common_types.h           |  2 +-
 src/common/console_listener.h       |  5 +----
 src/common/cpu_detect.h             |  5 +----
 src/common/debug_interface.h        |  7 ++-----
 src/common/extended_trace.h         |  5 +----
 src/common/fifo_queue.h             |  6 +-----
 src/common/file_search.h            |  7 +------
 src/common/file_util.h              |  6 +-----
 src/common/fixed_size_queue.h       |  7 +------
 src/common/hash.h                   |  5 +----
 src/common/linear_disk_cache.h      |  6 +-----
 src/common/log.h                    |  5 +----
 src/common/log_manager.h            |  7 ++-----
 src/common/math_util.h              |  6 +-----
 src/common/mem_arena.h              |  5 +----
 src/common/memory_util.h            |  6 +-----
 src/common/msg_handler.h            |  5 +----
 src/common/platform.h               |  5 +----
 src/common/std_condition_variable.h |  4 +---
 src/common/std_mutex.h              |  5 +----
 src/common/std_thread.h             |  5 +----
 src/common/string_util.h            | 12 ++++--------
 src/common/thread.h                 |  5 +----
 src/common/thunk.h                  |  5 +----
 src/common/timer.h                  |  5 +----
 33 files changed, 41 insertions(+), 146 deletions(-)

diff --git a/src/common/atomic.h b/src/common/atomic.h
index ff2fb23d3f..941f5ad5ea 100644
--- a/src/common/atomic.h
+++ b/src/common/atomic.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _ATOMIC_H_
-#define _ATOMIC_H_
+#pragma once
 
 #ifdef _WIN32
 
@@ -15,5 +14,3 @@
 #include "common/atomic_gcc.h"
 
 #endif
-
-#endif
diff --git a/src/common/atomic_gcc.h b/src/common/atomic_gcc.h
index 953c82c6c9..117e342f6b 100644
--- a/src/common/atomic_gcc.h
+++ b/src/common/atomic_gcc.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _ATOMIC_GCC_H_
-#define _ATOMIC_GCC_H_
+#pragma once
 
 #include "common/common.h"
 
@@ -109,5 +108,3 @@ LONG SyncInterlockedExchange(LONG *Dest, LONG Val)
 #endif
 }
 #endif
-
-#endif
diff --git a/src/common/atomic_win32.h b/src/common/atomic_win32.h
index f8ec80520b..0808905f0d 100644
--- a/src/common/atomic_win32.h
+++ b/src/common/atomic_win32.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _ATOMIC_WIN32_H_
-#define _ATOMIC_WIN32_H_
+#pragma once
 
 #include "common/common.h"
 #include <intrin.h>
@@ -68,5 +67,3 @@ inline void AtomicStoreRelease(volatile u32& dest, u32 value) {
 }
 
 }
-
-#endif
diff --git a/src/common/break_points.h b/src/common/break_points.h
index da14ca7f3b..cf3884fbca 100644
--- a/src/common/break_points.h
+++ b/src/common/break_points.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _DEBUGGER_BREAKPOINTS_H
-#define _DEBUGGER_BREAKPOINTS_H
+#pragma once
 
 #include <vector>
 #include <string>
@@ -98,5 +97,3 @@ public:
 
     void Clear() { m_MemChecks.clear(); };
 };
-
-#endif
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index 8c9f839dac..2b0f120e64 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -15,8 +15,7 @@
 // Official SVN repository and contact information can be found at
 // http://code.google.com/p/dolphin-emu/
 
-#ifndef _POINTERWRAP_H_
-#define _POINTERWRAP_H_
+#pragma once
 
 // Extremely simple serialization framework.
 
@@ -871,5 +870,3 @@ private:
         char GitVersion[32];
     };
 }; */
-
-#endif  // _POINTERWRAP_H_
diff --git a/src/common/common.h b/src/common/common.h
index 09027cae1a..cb69eabe4e 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -2,15 +2,14 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _COMMON_H_
-#define _COMMON_H_
+#pragma once
 
 // DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
 // since it slows down the build a lot.
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 // Force enable logging in the right modes. For some reason, something had changed
 // so that debugfast no longer logged.
@@ -200,5 +199,3 @@ inline double bswapd(double f) {
 }
 
 #include "swap.h"
-
-#endif // _COMMON_H_
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index dca4dc47fb..c18afe1192 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _COMMONFUNCS_H_
-#define _COMMONFUNCS_H_
+#pragma once
 
 #ifdef _WIN32
 #define SLEEP(x) Sleep(x)
@@ -233,5 +232,3 @@ inline T FromBigEndian(T data)
 }
 
 }  // Namespace Common
-
-#endif // _COMMONFUNCS_H_
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 252e93fa9f..a36de92276 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _COMMON_PATHS_H_
-#define _COMMON_PATHS_H_
+#pragma once
 
 // Make sure we pick up USER_DIR if set in config.h
 #include "common/common.h"
@@ -75,5 +74,3 @@
 
 // Files in the directory returned by GetUserPath(D_SYSCONF_IDX)
 #define SYSCONF    "SYSCONF"
-
-#endif // _COMMON_PATHS_H_
diff --git a/src/common/common_types.h b/src/common/common_types.h
index 4024105075..9d41e59715 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -24,7 +24,7 @@
 
 #pragma once 
 
-#include <math.h>
+#include <cmath>
 #include <xmmintrin.h> // data_types__m128.cpp
 
 #ifdef _WIN32
diff --git a/src/common/console_listener.h b/src/common/console_listener.h
index 224d170172..3c0e420c68 100644
--- a/src/common/console_listener.h
+++ b/src/common/console_listener.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _CONSOLELISTENER_H
-#define _CONSOLELISTENER_H
+#pragma once
 
 #include "common/log_manager.h"
 
@@ -37,5 +36,3 @@ private:
 #endif
     bool bUseColor;
 };
-
-#endif  // _CONSOLELISTENER_H
diff --git a/src/common/cpu_detect.h b/src/common/cpu_detect.h
index e93cf333af..def6afdeef 100644
--- a/src/common/cpu_detect.h
+++ b/src/common/cpu_detect.h
@@ -4,8 +4,7 @@
 
 
 // Detect the cpu, so we'll know which optimizations to use
-#ifndef _CPUDETECT_H_
-#define _CPUDETECT_H_
+#pragma once
 
 #include <string>
 
@@ -77,5 +76,3 @@ private:
 };
 
 extern CPUInfo cpu_info;
-
-#endif // _CPUDETECT_H_
diff --git a/src/common/debug_interface.h b/src/common/debug_interface.h
index 49cc54a805..32f55cb59d 100644
--- a/src/common/debug_interface.h
+++ b/src/common/debug_interface.h
@@ -1,8 +1,7 @@
-#ifndef _DEBUGINTERFACE_H
-#define _DEBUGINTERFACE_H
+#pragma once
 
+#include <cstring>
 #include <string>
-#include <string.h>
 
 class DebugInterface
 {
@@ -35,5 +34,3 @@ public:
     virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
     virtual std::string getDescription(unsigned int /*address*/) = 0;
 };
-
-#endif
diff --git a/src/common/extended_trace.h b/src/common/extended_trace.h
index 1552e901bd..ed3113a24b 100644
--- a/src/common/extended_trace.h
+++ b/src/common/extended_trace.h
@@ -12,8 +12,7 @@
 //
 // ----------------------------------------------------------------------------------------
 
-#ifndef _EXTENDEDTRACE_H_INCLUDED_
-#define _EXTENDEDTRACE_H_INCLUDED_
+#pragma once
 
 #if defined(WIN32)
 
@@ -49,5 +48,3 @@ extern char g_uefbuf[UEFBUFSIZE];
 #define STACKTRACE2(file, eip, esp, ebp)            ((void)0)
 
 #endif    // WIN32
-
-#endif    // _EXTENDEDTRACE_H_INCLUDED_
diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h
index 4e80f53b4c..78a8f561d1 100644
--- a/src/common/fifo_queue.h
+++ b/src/common/fifo_queue.h
@@ -1,6 +1,4 @@
-
-#ifndef _FIFO_QUEUE_H_
-#define _FIFO_QUEUE_H_
+#pragma once
 
 // a simple lockless thread-safe,
 // single reader, single writer queue
@@ -111,5 +109,3 @@ private:
 };
 
 }
-
-#endif
diff --git a/src/common/file_search.h b/src/common/file_search.h
index 2a9ff801f6..f966a008de 100644
--- a/src/common/file_search.h
+++ b/src/common/file_search.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _FILESEARCH_H_
-#define _FILESEARCH_H_
+#pragma once
 
 #include <string>
 #include <vector>
@@ -23,6 +21,3 @@ private:
 
     XStringVector m_FileNames;
 };
-
-#endif // _FILESEARCH_H_
-
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 5edb43f6ae..0871734d48 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _FILEUTIL_H_
-#define _FILEUTIL_H_
+#pragma once
 
 #include <fstream>
 #include <cstdio>
@@ -220,5 +218,3 @@ void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmod
 	fstream.open(filename.c_str(), openmode);
 #endif
 }
-
-#endif
diff --git a/src/common/fixed_size_queue.h b/src/common/fixed_size_queue.h
index 1f507f4ae9..1e3a5dea68 100644
--- a/src/common/fixed_size_queue.h
+++ b/src/common/fixed_size_queue.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _FIXED_SIZE_QUEUE_H_
-#define _FIXED_SIZE_QUEUE_H_
+#pragma once
 
 // STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
 // real STL classes.
@@ -70,6 +68,3 @@ public:
         return count;
     }
 };
-
-#endif // _FIXED_SIZE_QUEUE_H_
-
diff --git a/src/common/hash.h b/src/common/hash.h
index c69908415e..29f699d7f8 100644
--- a/src/common/hash.h
+++ b/src/common/hash.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _HASH_H_
-#define _HASH_H_
+#pragma once
 
 #include "common/common.h"
 
@@ -17,4 +15,3 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples);
 u64 GetMurmurHash3(const u8 *src, int len, u32 samples);
 u64 GetHash64(const u8 *src, int len, u32 samples);
 void SetHash64Function(bool useHiresTextures);
-#endif // _HASH_H_
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h
index a246876153..96dce31559 100644
--- a/src/common/linear_disk_cache.h
+++ b/src/common/linear_disk_cache.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _LINEAR_DISKCACHE
-#define _LINEAR_DISKCACHE
+#pragma once
 
 #include "common/common.h"
 #include <fstream>
@@ -187,5 +185,3 @@ private:
     std::fstream m_file;
     u32 m_num_entries;
 };
-
-#endif  // _LINEAR_DISKCACHE
diff --git a/src/common/log.h b/src/common/log.h
index e923224eda..f1f6ffae64 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _LOG_H_
-#define _LOG_H_
+#pragma once
 
 #define LOGGING
 
@@ -160,5 +159,3 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
 #else // GEKKO
 #define _assert_msg_(_t_, _a_, _fmt_, ...)
 #endif
-
-#endif // _LOG_H_
diff --git a/src/common/log_manager.h b/src/common/log_manager.h
index 6d3d7c7ff8..81d8088252 100644
--- a/src/common/log_manager.h
+++ b/src/common/log_manager.h
@@ -2,16 +2,15 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _LOGMANAGER_H_
-#define _LOGMANAGER_H_
+#pragma once
 
 #include "common/log.h"
 #include "common/string_util.h"
 #include "common/thread.h"
 #include "common/file_util.h"
 
+#include <cstring>
 #include <set>
-#include <string.h>
 
 #define MAX_MESSAGES 8000
 #define MAX_MSGLEN  1024
@@ -165,5 +164,3 @@ public:
     static void Init();
     static void Shutdown();
 };
-
-#endif // _LOGMANAGER_H_
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 9167d20122..65220fbdf0 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _MATH_UTIL_H_
-#define _MATH_UTIL_H_
+#pragma once
 
 #include "common/common.h"
 
@@ -196,5 +194,3 @@ public:
 
     float data[16];
 };
-
-#endif // _MATH_UTIL_H_
diff --git a/src/common/mem_arena.h b/src/common/mem_arena.h
index 667efbea91..b5f0aa890c 100644
--- a/src/common/mem_arena.h
+++ b/src/common/mem_arena.h
@@ -15,8 +15,7 @@
 // Official SVN repository and contact information can be found at
 // http://code.google.com/p/dolphin-emu/
 
-#ifndef _MEMARENA_H_
-#define _MEMARENA_H_
+#pragma once
 
 #ifdef _WIN32
 #include <windows.h>
@@ -77,5 +76,3 @@ struct MemoryView
 // a passed-in list of MemoryView structures.
 u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
 void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
-
-#endif // _MEMARENA_H_
diff --git a/src/common/memory_util.h b/src/common/memory_util.h
index 49b2589da3..922bd44b2f 100644
--- a/src/common/memory_util.h
+++ b/src/common/memory_util.h
@@ -2,9 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-
-#ifndef _MEMORYUTIL_H
-#define _MEMORYUTIL_H
+#pragma once
 
 #ifndef _WIN32
 #include <sys/mman.h>
@@ -21,5 +19,3 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
 std::string MemUsage();
 
 inline int GetPageSize() { return 4096; }
-
-#endif
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h
index bde2808fab..7c5319ec31 100644
--- a/src/common/msg_handler.h
+++ b/src/common/msg_handler.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _MSGHANDLER_H_
-#define _MSGHANDLER_H_
+#pragma once
 
 #include <string>
 
@@ -69,5 +68,3 @@ void SetEnableAlert(bool enable);
     #define AskYesNoT(format, ...) ;
     #define CriticalAlertT(format, ...) ;
 #endif
-
-#endif // _MSGHANDLER_H_
diff --git a/src/common/platform.h b/src/common/platform.h
index b02b52cd28..d9f095433c 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -22,8 +22,7 @@
  * http://code.google.com/p/gekko-gc-emu/
  */
 
-#ifndef COMMON_PLATFORM_H_
-#define COMMON_PLATFORM_H_
+#pragma once
 
 #include "common/common_types.h"
 
@@ -110,5 +109,3 @@ typedef void EXCEPTION_POINTERS;
 
 #define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) &&  (__GNUC__ > (major) || \
     (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
-
-#endif // COMMON_PLATFORM_H_
diff --git a/src/common/std_condition_variable.h b/src/common/std_condition_variable.h
index 8964b4f6fa..ad2022f5ac 100644
--- a/src/common/std_condition_variable.h
+++ b/src/common/std_condition_variable.h
@@ -1,6 +1,5 @@
 
-#ifndef CONDITION_VARIABLE_H_
-#define CONDITION_VARIABLE_H_
+#pragma once
 
 #define GCC_VER(x,y,z)    ((x) * 10000 + (y) * 100 + (z))
 #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -167,4 +166,3 @@ private:
 }
 
 #endif
-#endif
diff --git a/src/common/std_mutex.h b/src/common/std_mutex.h
index 26eb58b62c..5711d791bc 100644
--- a/src/common/std_mutex.h
+++ b/src/common/std_mutex.h
@@ -1,6 +1,4 @@
-
-#ifndef MUTEX_H_
-#define MUTEX_H_
+#pragma once
 
 #define GCC_VER(x,y,z)    ((x) * 10000 + (y) * 100 + (z))
 #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -362,4 +360,3 @@ void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y)
 }
 
 #endif
-#endif
diff --git a/src/common/std_thread.h b/src/common/std_thread.h
index 9ed0072c39..ce1336ee72 100644
--- a/src/common/std_thread.h
+++ b/src/common/std_thread.h
@@ -1,6 +1,4 @@
-
-#ifndef STD_THREAD_H_
-#define STD_THREAD_H_
+#pragma once
 
 #define GCC_VER(x,y,z)    ((x) * 10000 + (y) * 100 + (z))
 #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -314,4 +312,3 @@ inline thread::id get_id()
 #undef THREAD_HANDLE
 
 #endif
-#endif
diff --git a/src/common/string_util.h b/src/common/string_util.h
index b3c99a807c..ba4cd363e6 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -2,15 +2,13 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _STRINGUTIL_H_
-#define _STRINGUTIL_H_
+#pragma once
 
-#include <stdarg.h>
-
-#include <vector>
+#include <cstdarg>
+#include <iomanip>
 #include <string>
 #include <sstream>
-#include <iomanip>
+#include <vector>
 
 #include "common/common.h"
 
@@ -113,5 +111,3 @@ inline std::string UTF8ToTStr(const std::string& str)
 #endif
 
 #endif
-
-#endif // _STRINGUTIL_H_
diff --git a/src/common/thread.h b/src/common/thread.h
index d72ac7b47a..ff2c1d8bea 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _THREAD_H_
-#define _THREAD_H_
+#pragma once
 
 #include "common/std_condition_variable.h"
 #include "common/std_mutex.h"
@@ -152,5 +151,3 @@ inline void YieldCPU()
 void SetCurrentThreadName(const char *name);
     
 } // namespace Common
-
-#endif // _THREAD_H_
diff --git a/src/common/thunk.h b/src/common/thunk.h
index 2c2f23cd02..90c8be8883 100644
--- a/src/common/thunk.h
+++ b/src/common/thunk.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _THUNK_H_
-#define _THUNK_H_
+#pragma once
 
 #include <map>
 
@@ -41,5 +40,3 @@ private:
     void Shutdown();
     void Reset();
 };
-
-#endif // _THUNK_H_
diff --git a/src/common/timer.h b/src/common/timer.h
index cfa5cf6091..86418e7a74 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -2,8 +2,7 @@
 // Licensed under GPLv2
 // Refer to the license.txt file included.
 
-#ifndef _TIMER_H_
-#define _TIMER_H_
+#pragma once
 
 #include "common/common.h"
 #include <string>
@@ -42,5 +41,3 @@ private:
 };
 
 } // Namespace Common
-
-#endif // _TIMER_H_