summaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:16:45 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:33:42 -0700
commit7af4c5b5c561362cb1135ab504095ae667a9270a (patch)
tree49ffd3008d7634ba36f3951493a68e928407ce89 /src/compat
parent8d7f1dadeeb1dc1609b72de5a4ee3a5247b0e9e6 (diff)
downloadtmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.gz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.bz2
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.xz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.zip
This is more reliable
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/attr.hpp17
-rw-r--r--src/compat/cast.hpp11
-rw-r--r--src/compat/fun.hpp9
-rw-r--r--src/compat/fwd.hpp7
-rw-r--r--src/compat/iter.hpp9
-rw-r--r--src/compat/memory.hpp11
-rw-r--r--src/compat/nullpo.hpp23
-rw-r--r--src/compat/rawmem.hpp13
-rw-r--r--src/compat/time_t.hpp9
9 files changed, 41 insertions, 68 deletions
diff --git a/src/compat/attr.hpp b/src/compat/attr.hpp
index 73fcfc4..238a5d5 100644
--- a/src/compat/attr.hpp
+++ b/src/compat/attr.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_ATTR_HPP
-#define TMWA_COMPAT_ATTR_HPP
+#pragma once
// attr.hpp - Attributes.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,16 +18,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
{
-# ifdef __clang__
-# define FALLTHROUGH [[clang::fallthrough]]
-# else
-# define FALLTHROUGH /* fallthrough */
-# endif
+#ifdef __clang__
+# define FALLTHROUGH [[clang::fallthrough]]
+#else
+# define FALLTHROUGH /* fallthrough */
+#endif
} // namespace tmwa
-
-#endif // TMWA_COMPAT_ATTR_HPP
diff --git a/src/compat/cast.hpp b/src/compat/cast.hpp
index 38a8997..35dbc62 100644
--- a/src/compat/cast.hpp
+++ b/src/compat/cast.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_CAST_HPP
-#define TMWA_COMPAT_CAST_HPP
+#pragma once
// cast.hpp - Change the type of a variable.
//
// Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,10 +18,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <utility>
-# include <type_traits>
+#include <utility>
+#include <type_traits>
namespace tmwa
@@ -71,5 +70,3 @@ typename std::remove_pointer<T>::type *sign_cast(U *u)
return reinterpret_cast<T_ *>(u);
}
} // namespace tmwa
-
-#endif // TMWA_COMPAT_CAST_HPP
diff --git a/src/compat/fun.hpp b/src/compat/fun.hpp
index 53a0ed6..8073fe7 100644
--- a/src/compat/fun.hpp
+++ b/src/compat/fun.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_FUN_HPP
-#define TMWA_COMPAT_FUN_HPP
+#pragma once
// fun.hpp - Functional placeholders.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,14 +18,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <functional>
+#include <functional>
namespace tmwa
{
namespace ph = std::placeholders;
} // namespace tmwa
-
-#endif // TMWA_COMPAT_FUN_HPP
diff --git a/src/compat/fwd.hpp b/src/compat/fwd.hpp
index 729b963..45f3c24 100644
--- a/src/compat/fwd.hpp
+++ b/src/compat/fwd.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_FWD_HPP
-#define TMWA_COMPAT_FWD_HPP
+#pragma once
// compat/fwd.hpp - list of type names for compat libs
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,12 +18,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "../sanity.hpp"
+#include "../sanity.hpp"
namespace tmwa
{
// meh, add more when I feel like it
} // namespace tmwa
-
-#endif // TMWA_COMPAT_FWD_HPP
diff --git a/src/compat/iter.hpp b/src/compat/iter.hpp
index 7ed24da..ff146a0 100644
--- a/src/compat/iter.hpp
+++ b/src/compat/iter.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_ITER_HPP
-#define TMWA_COMPAT_ITER_HPP
+#pragma once
// iter.hpp - tools for dealing with iterators
//
// Copyright © 2012-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,9 +18,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <iterator>
+#include <iterator>
namespace tmwa
@@ -152,5 +151,3 @@ IteratorPair<FilterIterator<T, F, C>> filter_iterator(C *c, F f=is_truthy<T>)
return {FilterIterator<T, F, C>(c, f), FilterIterator<T, F, C>(c, f)};
}
} // namespace tmwa
-
-#endif // TMWA_COMPAT_ITER_HPP
diff --git a/src/compat/memory.hpp b/src/compat/memory.hpp
index 702951c..566cc8b 100644
--- a/src/compat/memory.hpp
+++ b/src/compat/memory.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_MEMORY_HPP
-#define TMWA_COMPAT_MEMORY_HPP
+#pragma once
// memory.hpp - I forget ...
//
// Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,10 +18,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <memory>
-# include <type_traits>
+#include <memory>
+#include <type_traits>
namespace tmwa
@@ -45,5 +44,3 @@ typename std::enable_if<is_array_of_unknown_bound<T>::value, std::unique_ptr<T,
return std::unique_ptr<E[], D>(new E[sz]());
}
} // namespace tmwa
-
-#endif // TMWA_COMPAT_MEMORY_HPP
diff --git a/src/compat/nullpo.hpp b/src/compat/nullpo.hpp
index 6e12f78..5be674a 100644
--- a/src/compat/nullpo.hpp
+++ b/src/compat/nullpo.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_NULLPO_HPP
-#define TMWA_COMPAT_NULLPO_HPP
+#pragma once
// nullpo.hpp - Non-fatal pointer assertions.
//
// Copyright © ????-2004 Athena Dev Teams
@@ -31,19 +30,19 @@
/// nullpo_retv(cond) - just return (function returns void)
/// nullpo_retr(rv, cond) - return given value instead
-# ifndef BUG_FREE
-# define nullpo_retr(ret, t) \
+#ifndef BUG_FREE
+# define nullpo_retr(ret, t) \
if (nullpo_chk(__FILE__, __LINE__, __PRETTY_FUNCTION__, t)) \
return ret;
-# else // BUG_FREE
-# define nullpo_retr(ret, t) /*t*/
-# endif // BUG_FREE
+#else // BUG_FREE
+# define nullpo_retr(ret, t) /*t*/
+#endif // BUG_FREE
-# define nullpo_retn(t) nullpo_retr(nullptr, t)
-# define nullpo_retz(t) nullpo_retr(0, t)
-# define nullpo_retv(t) nullpo_retr(, t)
+#define nullpo_retn(t) nullpo_retr(nullptr, t)
+#define nullpo_retz(t) nullpo_retr(0, t)
+#define nullpo_retv(t) nullpo_retr(, t)
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -63,5 +62,3 @@ bool nullpo_chk(const char *file, int line, const char *func, T *target)
return nullpo_chk(file, line, func, static_cast<const void *>(target));
}
} // namespace tmwa
-
-#endif // TMWA_COMPAT_NULLPO_HPP
diff --git a/src/compat/rawmem.hpp b/src/compat/rawmem.hpp
index dd038be..c271a56 100644
--- a/src/compat/rawmem.hpp
+++ b/src/compat/rawmem.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_RAWMEM_HPP
-#define TMWA_COMPAT_RAWMEM_HPP
+#pragma once
// rawmem.hpp - Ignore poisoning and really frob this memory unsafely.
//
// Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,11 +18,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include <cstddef>
-# include <cstdint>
-# include <cstring>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -51,5 +50,3 @@ void really_memset0(uint8_t *dest, size_t n)
memset(dest, '\0', n);
}
} // namespace tmwa
-
-#endif // TMWA_COMPAT_RAWMEM_HPP
diff --git a/src/compat/time_t.hpp b/src/compat/time_t.hpp
index 60005d0..9e7cf25 100644
--- a/src/compat/time_t.hpp
+++ b/src/compat/time_t.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_COMPAT_TIMET_HPP
-#define TMWA_COMPAT_TIMET_HPP
+#pragma once
// time_t.hpp - time_t with a reliable representation
//
// Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,14 +18,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
// TODO fix this ordering violation by promoting TimeT here
-# include "../mmo/utils.hpp"
+#include "../mmo/utils.hpp"
namespace tmwa
{
} // namespace tmwa
-
-#endif // TMWA_COMPAT_TIMET_HPP