Common: Move header guards over to pragma once

Also replaced C headers with the C++ equivalent ones
This commit is contained in:
Lioncash 2014-08-17 13:45:50 -04:00
parent d1c2b76ad1
commit 90e994471a
33 changed files with 41 additions and 146 deletions

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _ATOMIC_H_ #pragma once
#define _ATOMIC_H_
#ifdef _WIN32 #ifdef _WIN32
@ -15,5 +14,3 @@
#include "common/atomic_gcc.h" #include "common/atomic_gcc.h"
#endif #endif
#endif

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _ATOMIC_GCC_H_ #pragma once
#define _ATOMIC_GCC_H_
#include "common/common.h" #include "common/common.h"
@ -109,5 +108,3 @@ LONG SyncInterlockedExchange(LONG *Dest, LONG Val)
#endif #endif
} }
#endif #endif
#endif

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _ATOMIC_WIN32_H_ #pragma once
#define _ATOMIC_WIN32_H_
#include "common/common.h" #include "common/common.h"
#include <intrin.h> #include <intrin.h>
@ -68,5 +67,3 @@ inline void AtomicStoreRelease(volatile u32& dest, u32 value) {
} }
} }
#endif

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _DEBUGGER_BREAKPOINTS_H #pragma once
#define _DEBUGGER_BREAKPOINTS_H
#include <vector> #include <vector>
#include <string> #include <string>
@ -98,5 +97,3 @@ public:
void Clear() { m_MemChecks.clear(); }; void Clear() { m_MemChecks.clear(); };
}; };
#endif

View File

@ -15,8 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _POINTERWRAP_H_ #pragma once
#define _POINTERWRAP_H_
// Extremely simple serialization framework. // Extremely simple serialization framework.
@ -871,5 +870,3 @@ private:
char GitVersion[32]; char GitVersion[32];
}; };
}; */ }; */
#endif // _POINTERWRAP_H_

View File

@ -2,15 +2,14 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _COMMON_H_ #pragma once
#define _COMMON_H_
// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file // DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
// since it slows down the build a lot. // since it slows down the build a lot.
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <cstdio>
#include <string.h> #include <cstring>
// Force enable logging in the right modes. For some reason, something had changed // Force enable logging in the right modes. For some reason, something had changed
// so that debugfast no longer logged. // so that debugfast no longer logged.
@ -200,5 +199,3 @@ inline double bswapd(double f) {
} }
#include "swap.h" #include "swap.h"
#endif // _COMMON_H_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _COMMONFUNCS_H_ #pragma once
#define _COMMONFUNCS_H_
#ifdef _WIN32 #ifdef _WIN32
#define SLEEP(x) Sleep(x) #define SLEEP(x) Sleep(x)
@ -233,5 +232,3 @@ inline T FromBigEndian(T data)
} }
} // Namespace Common } // Namespace Common
#endif // _COMMONFUNCS_H_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _COMMON_PATHS_H_ #pragma once
#define _COMMON_PATHS_H_
// Make sure we pick up USER_DIR if set in config.h // Make sure we pick up USER_DIR if set in config.h
#include "common/common.h" #include "common/common.h"
@ -75,5 +74,3 @@
// Files in the directory returned by GetUserPath(D_SYSCONF_IDX) // Files in the directory returned by GetUserPath(D_SYSCONF_IDX)
#define SYSCONF "SYSCONF" #define SYSCONF "SYSCONF"
#endif // _COMMON_PATHS_H_

View File

@ -24,7 +24,7 @@
#pragma once #pragma once
#include <math.h> #include <cmath>
#include <xmmintrin.h> // data_types__m128.cpp #include <xmmintrin.h> // data_types__m128.cpp
#ifdef _WIN32 #ifdef _WIN32

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _CONSOLELISTENER_H #pragma once
#define _CONSOLELISTENER_H
#include "common/log_manager.h" #include "common/log_manager.h"
@ -37,5 +36,3 @@ private:
#endif #endif
bool bUseColor; bool bUseColor;
}; };
#endif // _CONSOLELISTENER_H

View File

@ -4,8 +4,7 @@
// Detect the cpu, so we'll know which optimizations to use // Detect the cpu, so we'll know which optimizations to use
#ifndef _CPUDETECT_H_ #pragma once
#define _CPUDETECT_H_
#include <string> #include <string>
@ -77,5 +76,3 @@ private:
}; };
extern CPUInfo cpu_info; extern CPUInfo cpu_info;
#endif // _CPUDETECT_H_

View File

@ -1,8 +1,7 @@
#ifndef _DEBUGINTERFACE_H #pragma once
#define _DEBUGINTERFACE_H
#include <cstring>
#include <string> #include <string>
#include <string.h>
class DebugInterface class DebugInterface
{ {
@ -35,5 +34,3 @@ public:
virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
virtual std::string getDescription(unsigned int /*address*/) = 0; virtual std::string getDescription(unsigned int /*address*/) = 0;
}; };
#endif

View File

@ -12,8 +12,7 @@
// //
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
#ifndef _EXTENDEDTRACE_H_INCLUDED_ #pragma once
#define _EXTENDEDTRACE_H_INCLUDED_
#if defined(WIN32) #if defined(WIN32)
@ -49,5 +48,3 @@ extern char g_uefbuf[UEFBUFSIZE];
#define STACKTRACE2(file, eip, esp, ebp) ((void)0) #define STACKTRACE2(file, eip, esp, ebp) ((void)0)
#endif // WIN32 #endif // WIN32
#endif // _EXTENDEDTRACE_H_INCLUDED_

View File

@ -1,6 +1,4 @@
#pragma once
#ifndef _FIFO_QUEUE_H_
#define _FIFO_QUEUE_H_
// a simple lockless thread-safe, // a simple lockless thread-safe,
// single reader, single writer queue // single reader, single writer queue
@ -111,5 +109,3 @@ private:
}; };
} }
#endif

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _FILESEARCH_H_
#define _FILESEARCH_H_
#include <string> #include <string>
#include <vector> #include <vector>
@ -23,6 +21,3 @@ private:
XStringVector m_FileNames; XStringVector m_FileNames;
}; };
#endif // _FILESEARCH_H_

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _FILEUTIL_H_
#define _FILEUTIL_H_
#include <fstream> #include <fstream>
#include <cstdio> #include <cstdio>
@ -220,5 +218,3 @@ void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmod
fstream.open(filename.c_str(), openmode); fstream.open(filename.c_str(), openmode);
#endif #endif
} }
#endif

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _FIXED_SIZE_QUEUE_H_
#define _FIXED_SIZE_QUEUE_H_
// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the // STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
// real STL classes. // real STL classes.
@ -70,6 +68,3 @@ public:
return count; return count;
} }
}; };
#endif // _FIXED_SIZE_QUEUE_H_

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _HASH_H_
#define _HASH_H_
#include "common/common.h" #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 GetMurmurHash3(const u8 *src, int len, u32 samples);
u64 GetHash64(const u8 *src, int len, u32 samples); u64 GetHash64(const u8 *src, int len, u32 samples);
void SetHash64Function(bool useHiresTextures); void SetHash64Function(bool useHiresTextures);
#endif // _HASH_H_

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _LINEAR_DISKCACHE
#define _LINEAR_DISKCACHE
#include "common/common.h" #include "common/common.h"
#include <fstream> #include <fstream>
@ -187,5 +185,3 @@ private:
std::fstream m_file; std::fstream m_file;
u32 m_num_entries; u32 m_num_entries;
}; };
#endif // _LINEAR_DISKCACHE

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _LOG_H_ #pragma once
#define _LOG_H_
#define LOGGING #define LOGGING
@ -160,5 +159,3 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
#else // GEKKO #else // GEKKO
#define _assert_msg_(_t_, _a_, _fmt_, ...) #define _assert_msg_(_t_, _a_, _fmt_, ...)
#endif #endif
#endif // _LOG_H_

View File

@ -2,16 +2,15 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _LOGMANAGER_H_ #pragma once
#define _LOGMANAGER_H_
#include "common/log.h" #include "common/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/thread.h" #include "common/thread.h"
#include "common/file_util.h" #include "common/file_util.h"
#include <cstring>
#include <set> #include <set>
#include <string.h>
#define MAX_MESSAGES 8000 #define MAX_MESSAGES 8000
#define MAX_MSGLEN 1024 #define MAX_MSGLEN 1024
@ -165,5 +164,3 @@ public:
static void Init(); static void Init();
static void Shutdown(); static void Shutdown();
}; };
#endif // _LOGMANAGER_H_

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _MATH_UTIL_H_
#define _MATH_UTIL_H_
#include "common/common.h" #include "common/common.h"
@ -196,5 +194,3 @@ public:
float data[16]; float data[16];
}; };
#endif // _MATH_UTIL_H_

View File

@ -15,8 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMARENA_H_ #pragma once
#define _MEMARENA_H_
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -77,5 +76,3 @@ struct MemoryView
// a passed-in list of MemoryView structures. // a passed-in list of MemoryView structures.
u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena *arena); 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); void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
#endif // _MEMARENA_H_

View File

@ -2,9 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#ifndef _MEMORYUTIL_H
#define _MEMORYUTIL_H
#ifndef _WIN32 #ifndef _WIN32
#include <sys/mman.h> #include <sys/mman.h>
@ -21,5 +19,3 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
std::string MemUsage(); std::string MemUsage();
inline int GetPageSize() { return 4096; } inline int GetPageSize() { return 4096; }
#endif

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _MSGHANDLER_H_ #pragma once
#define _MSGHANDLER_H_
#include <string> #include <string>
@ -69,5 +68,3 @@ void SetEnableAlert(bool enable);
#define AskYesNoT(format, ...) ; #define AskYesNoT(format, ...) ;
#define CriticalAlertT(format, ...) ; #define CriticalAlertT(format, ...) ;
#endif #endif
#endif // _MSGHANDLER_H_

View File

@ -22,8 +22,7 @@
* http://code.google.com/p/gekko-gc-emu/ * http://code.google.com/p/gekko-gc-emu/
*/ */
#ifndef COMMON_PLATFORM_H_ #pragma once
#define COMMON_PLATFORM_H_
#include "common/common_types.h" #include "common/common_types.h"
@ -110,5 +109,3 @@ typedef void EXCEPTION_POINTERS;
#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ #define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
#endif // COMMON_PLATFORM_H_

View File

@ -1,6 +1,5 @@
#ifndef CONDITION_VARIABLE_H_ #pragma once
#define CONDITION_VARIABLE_H_
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@ -167,4 +166,3 @@ private:
} }
#endif #endif
#endif

View File

@ -1,6 +1,4 @@
#pragma once
#ifndef MUTEX_H_
#define MUTEX_H_
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #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
#endif

View File

@ -1,6 +1,4 @@
#pragma once
#ifndef STD_THREAD_H_
#define STD_THREAD_H_
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@ -314,4 +312,3 @@ inline thread::id get_id()
#undef THREAD_HANDLE #undef THREAD_HANDLE
#endif #endif
#endif

View File

@ -2,15 +2,13 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _STRINGUTIL_H_ #pragma once
#define _STRINGUTIL_H_
#include <stdarg.h> #include <cstdarg>
#include <iomanip>
#include <vector>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip> #include <vector>
#include "common/common.h" #include "common/common.h"
@ -113,5 +111,3 @@ inline std::string UTF8ToTStr(const std::string& str)
#endif #endif
#endif #endif
#endif // _STRINGUTIL_H_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _THREAD_H_ #pragma once
#define _THREAD_H_
#include "common/std_condition_variable.h" #include "common/std_condition_variable.h"
#include "common/std_mutex.h" #include "common/std_mutex.h"
@ -152,5 +151,3 @@ inline void YieldCPU()
void SetCurrentThreadName(const char *name); void SetCurrentThreadName(const char *name);
} // namespace Common } // namespace Common
#endif // _THREAD_H_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _THUNK_H_ #pragma once
#define _THUNK_H_
#include <map> #include <map>
@ -41,5 +40,3 @@ private:
void Shutdown(); void Shutdown();
void Reset(); void Reset();
}; };
#endif // _THUNK_H_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef _TIMER_H_ #pragma once
#define _TIMER_H_
#include "common/common.h" #include "common/common.h"
#include <string> #include <string>
@ -42,5 +41,3 @@ private:
}; };
} // Namespace Common } // Namespace Common
#endif // _TIMER_H_