Commit 4e89d233 by alokp@chromium.org

Cleaned up Common.h. Removed unnecessary includes and typedefs. Removed tabs…

Cleaned up Common.h. Removed unnecessary includes and typedefs. Removed tabs from PoolAlloc.h and replaced UINT_PTR with uintptr_t. Review URL: http://codereview.appspot.com/1221041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@289 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent cff1aff5
...@@ -7,46 +7,17 @@ ...@@ -7,46 +7,17 @@
#ifndef _COMMON_INCLUDED_ #ifndef _COMMON_INCLUDED_
#define _COMMON_INCLUDED_ #define _COMMON_INCLUDED_
#ifdef _WIN32 #include <assert.h>
#include <basetsd.h> #include <stdio.h>
#elif defined (solaris)
#include <sys/int_types.h>
#define UINT_PTR uintptr_t
#else
#include <stdint.h>
#define UINT_PTR uintptr_t
#endif
/* windows only pragma */
#ifdef _MSC_VER
#pragma warning(disable : 4786) // Don't warn about too long identifiers
#pragma warning(disable : 4514) // unused inline method
#pragma warning(disable : 4201) // nameless union
#endif
// #include <map>
// Doing the push and pop below for warnings does not leave the warning state #include <string>
// the way it was. This seems like a defect in the compiler. We would like #include <vector>
// to do this, but since it does not work correctly right now, it is turned
// off.
//
//??#pragma warning(push, 3)
#include <set> #include "compiler/PoolAlloc.h"
#include <vector>
#include <map>
#include <list>
#include <string>
#include <stdio.h>
//??#pragma warning(pop)
typedef int TSourceLoc; typedef int TSourceLoc;
#include <assert.h>
#include "compiler/PoolAlloc.h"
// //
// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme. // Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
// //
...@@ -82,20 +53,6 @@ public: ...@@ -82,20 +53,6 @@ public:
TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {} TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {}
}; };
template <class T> class TList : public std::list<T, pool_allocator<T> > {
public:
typedef typename std::list<T, pool_allocator<T> >::size_type size_type;
TList() : std::list<T, pool_allocator<T> >() {}
TList(const pool_allocator<T>& a) : std::list<T, pool_allocator<T> >(a) {}
TList(size_type i): std::list<T, pool_allocator<T> >(i) {}
};
// This is called TStlSet, because TSet is taken by an existing compiler class.
template <class T, class CMP> class TStlSet : public std::set<T, CMP, pool_allocator<T> > {
// No pool allocator versions of constructors in std::set.
};
template <class K, class D, class CMP = std::less<K> > template <class K, class D, class CMP = std::less<K> >
class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D> > > { class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D> > > {
public: public:
...@@ -113,12 +70,6 @@ public: ...@@ -113,12 +70,6 @@ public:
typedef std::basic_string<char> TPersistString; typedef std::basic_string<char> TPersistString;
// //
// templatized min and max functions.
//
template <class T> T Min(const T a, const T b) { return a < b ? a : b; }
template <class T> T Max(const T a, const T b) { return a > b ? a : b; }
//
// Create a TString object from an integer. // Create a TString object from an integer.
// //
inline const TString String(const int i, const int base = 10) inline const TString String(const int i, const int base = 10)
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_ #ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_ #define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
#include <set>
#include "compiler/intermediate.h" #include "compiler/intermediate.h"
#include "compiler/ParseHelper.h" #include "compiler/ParseHelper.h"
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#ifndef COMPILER_OUTPUTHLSL_H_ #ifndef COMPILER_OUTPUTHLSL_H_
#define COMPILER_OUTPUTHLSL_H_ #define COMPILER_OUTPUTHLSL_H_
#include <list>
#include <set>
#include "compiler/intermediate.h" #include "compiler/intermediate.h"
#include "compiler/ParseHelper.h" #include "compiler/ParseHelper.h"
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "compiler/PoolAlloc.h" #include "compiler/PoolAlloc.h"
#include "compiler/osinclude.h"
#include "compiler/Common.h" #include "compiler/Common.h"
#include "compiler/InitializeGlobals.h" #include "compiler/InitializeGlobals.h"
#include "compiler/osinclude.h"
OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX; OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
...@@ -277,7 +277,7 @@ void* TPoolAllocator::allocate(size_t numBytes) ...@@ -277,7 +277,7 @@ void* TPoolAllocator::allocate(size_t numBytes)
currentPageOffset = pageSize; // make next allocation come from a new page currentPageOffset = pageSize; // make next allocation come from a new page
// No guard blocks for multi-page allocations (yet) // No guard blocks for multi-page allocations (yet)
return reinterpret_cast<void*>(reinterpret_cast<UINT_PTR>(memory) + headerSkip); return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(memory) + headerSkip);
} }
// //
......
...@@ -244,7 +244,7 @@ public: ...@@ -244,7 +244,7 @@ public:
totalSize = size; totalSize = size;
if (isArray()) if (isArray())
totalSize *= Max(getArraySize(), getMaxArraySize()); totalSize *= std::max(getArraySize(), getMaxArraySize());
return totalSize; return totalSize;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment