From 92afaf38ec4881246f78629da22ba6293df46af5 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 14 Apr 2021 15:35:49 +1000 Subject: [PATCH] build: avoid double underscore header guards --- alloc/fwd.hpp | 6 +----- bezier.hpp | 7 ++----- colour.hpp | 5 +---- coord.hpp | 7 ++----- exe.hpp | 7 ++----- float.hpp | 4 +--- fourcc.hpp | 8 ++------ gcc.hpp | 5 +---- geom/cylinder.hpp | 5 +---- geom/sphere.hpp | 5 +---- hash/adler.hpp | 7 ++----- hash/fasthash.hpp | 7 ++----- hash/fnv1a.hpp | 7 ++----- hash/fwd.hpp | 7 ++----- hash/murmur.hpp | 7 ++----- hash/murmur/murmur1.hpp | 7 ++----- hash/murmur/murmur2.hpp | 8 ++------ hash/murmur/murmur3.hpp | 8 ++------ hash/wang.hpp | 7 ++----- io.hpp | 7 ++----- io_posix.hpp | 7 ++----- library.hpp | 5 +---- library_posix.hpp | 7 ++----- library_win32.hpp | 5 +---- memory/system.hpp | 7 ++----- posix/fwd.hpp | 5 +---- posix/map.hpp | 5 +---- quaternion.hpp | 7 ++----- rational.hpp | 8 ++------ roots/bisection.hpp | 5 +---- stats.hpp | 7 ++----- stream.hpp | 6 +----- term.hpp | 7 ++----- time.hpp | 5 +---- types/string.hpp | 5 +---- version.hpp | 8 ++------ win32/registry.hpp | 5 +---- zlib.hpp | 7 ++----- 38 files changed, 61 insertions(+), 181 deletions(-) diff --git a/alloc/fwd.hpp b/alloc/fwd.hpp index 4865b767..6f728b84 100644 --- a/alloc/fwd.hpp +++ b/alloc/fwd.hpp @@ -6,9 +6,7 @@ * Copyright 2016 Danny Robson */ -#ifndef __UTIL_ALLOC_FWD_HPP -#define __UTIL_ALLOC_FWD_HPP - +#pragma once namespace cruft::alloc { namespace raw { @@ -31,5 +29,3 @@ namespace cruft::alloc { template class arena; template class allocator; } - -#endif diff --git a/bezier.hpp b/bezier.hpp index 07c2ce62..61d84f2b 100644 --- a/bezier.hpp +++ b/bezier.hpp @@ -6,8 +6,7 @@ * Copyright 2015-2016 Danny Robson */ -#ifndef __UTIL_BEZIER_HPP -#define __UTIL_BEZIER_HPP +#pragma once #include "point.hpp" #include "region.hpp" @@ -72,6 +71,4 @@ namespace cruft { template std::ostream& operator<< (std::ostream&, const bezier&); -} - -#endif +} \ No newline at end of file diff --git a/colour.hpp b/colour.hpp index 819b6e78..da0b3bce 100644 --- a/colour.hpp +++ b/colour.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2017 Danny Robson */ -#ifndef __UTIL_COLOUR_HPP -#define __UTIL_COLOUR_HPP +#pragma once #include "coord.hpp" @@ -121,5 +120,3 @@ namespace cruft { template constexpr auto is_colour_v = is_colour::value; } - -#endif diff --git a/coord.hpp b/coord.hpp index 7f6bb7ed..664401bb 100644 --- a/coord.hpp +++ b/coord.hpp @@ -6,10 +6,7 @@ * Copyright 2012-2015 Danny Robson */ -#ifndef __UTIL_COORD_HPP -#define __UTIL_COORD_HPP +#pragma once #include "coord/base.hpp" -#include "coord/ops.hpp" - -#endif +#include "coord/ops.hpp" \ No newline at end of file diff --git a/exe.hpp b/exe.hpp index 9c15a4c8..c650426b 100644 --- a/exe.hpp +++ b/exe.hpp @@ -6,14 +6,11 @@ * Copyright 2010-2012 Danny Robson */ -#ifndef __UTIL_EXE_HPP -#define __UTIL_EXE_HPP +#pragma once #include namespace cruft { /// Returns a path to the current executable. std::filesystem::path image_path (void); -} - -#endif +} \ No newline at end of file diff --git a/float.hpp b/float.hpp index b1be5af1..75ae5170 100644 --- a/float.hpp +++ b/float.hpp @@ -6,8 +6,7 @@ * Copyright 2011-2016 Danny Robson */ -#ifndef __FLOAT_HPP -#define __FLOAT_HPP +#pragma once #include "types/sized.hpp" @@ -77,4 +76,3 @@ namespace cruft { static_assert (sizeof(ieee_single ) == 4, "ieee_single must be 4 bytes"); static_assert (sizeof(ieee_double ) == 8, "ieee_double must be 8 bytes"); } -#endif // __FLOAT_HPP diff --git a/fourcc.hpp b/fourcc.hpp index c1cbf696..ec32cb56 100644 --- a/fourcc.hpp +++ b/fourcc.hpp @@ -6,8 +6,7 @@ * Copyright 2011 Danny Robson */ -#ifndef __UTIL_FOURCC_HPP -#define __UTIL_FOURCC_HPP +#pragma once #include #include @@ -24,7 +23,4 @@ namespace cruft { }; std::ostream& operator<< (std::ostream&, cruft::fourcc); -} - - -#endif +} \ No newline at end of file diff --git a/gcc.hpp b/gcc.hpp index 873600a4..3d7ac7d7 100644 --- a/gcc.hpp +++ b/gcc.hpp @@ -6,11 +6,8 @@ * Copyright 2010 Danny Robson */ -#ifndef __UTIL_GCC_HPP -#define __UTIL_GCC_HPP +#pragma once #define GCC_VERSION (__GNUC__ * 10000 + \ __GNUC_MINOR__ * 100 + \ __GNUC_PATCHLEVEL__) - -#endif diff --git a/geom/cylinder.hpp b/geom/cylinder.hpp index deee615c..4ab94b4b 100644 --- a/geom/cylinder.hpp +++ b/geom/cylinder.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_GEOM_CYLINDER_HPP -#define __UTIL_GEOM_CYLINDER_HPP +#pragma once #include "../point.hpp" @@ -24,5 +23,3 @@ namespace cruft::geom { using cylinder3f = cylinder<3,float>; } - -#endif diff --git a/geom/sphere.hpp b/geom/sphere.hpp index 796d99d3..82b4912e 100644 --- a/geom/sphere.hpp +++ b/geom/sphere.hpp @@ -6,8 +6,7 @@ * Copyright 2015-2018 Danny Robson */ -#ifndef __UTIL_GEOM_SPHERE_HPP -#define __UTIL_GEOM_SPHERE_HPP +#pragma once #include "../point.hpp" @@ -53,5 +52,3 @@ namespace cruft::geom { INFINITY; } } - -#endif diff --git a/hash/adler.hpp b/hash/adler.hpp index dbfffc5d..33b64550 100644 --- a/hash/adler.hpp +++ b/hash/adler.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2014 Danny Robson */ -#ifndef __UTIL_HASH_ADLER_HPP -#define __UTIL_HASH_ADLER_HPP +#pragma once #include "fletcher.hpp" @@ -20,6 +19,4 @@ namespace cruft::hash { public: adler32 (); }; -} - -#endif +} \ No newline at end of file diff --git a/hash/fasthash.hpp b/hash/fasthash.hpp index a00b15a8..98a5a814 100644 --- a/hash/fasthash.hpp +++ b/hash/fasthash.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_HASH_FASTHASH_HPP -#define __UTIL_HASH_FASTHASH_HPP +#pragma once #include "../view.hpp" @@ -34,6 +33,4 @@ namespace cruft::hash { digest_t operator() (uint64_t seed, cruft::view) const; }; -} - -#endif +} \ No newline at end of file diff --git a/hash/fnv1a.hpp b/hash/fnv1a.hpp index 2713765c..c70c059b 100644 --- a/hash/fnv1a.hpp +++ b/hash/fnv1a.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2015 Danny Robson */ -#ifndef __UTIL_HASH_FNV1A_HPP -#define __UTIL_HASH_FNV1A_HPP +#pragma once #include "view.hpp" @@ -22,6 +21,4 @@ namespace cruft::hash { digest_t operator() (cruft::view) const noexcept; }; -} - -#endif +} \ No newline at end of file diff --git a/hash/fwd.hpp b/hash/fwd.hpp index 3064711f..46c759e6 100644 --- a/hash/fwd.hpp +++ b/hash/fwd.hpp @@ -6,8 +6,7 @@ * Copyright 2016, Danny Robson */ -#ifndef __UTIL_HASH_FWD_HPP -#define __UTIL_HASH_FWD_HPP +#pragma once // The single function call hashes are light weight enough to include // directly, and are unlikely to change given their inherent @@ -29,6 +28,4 @@ namespace cruft::hash { class crc; class xxhash; -} - -#endif +} \ No newline at end of file diff --git a/hash/murmur.hpp b/hash/murmur.hpp index 57aa6eb6..4f56b34e 100644 --- a/hash/murmur.hpp +++ b/hash/murmur.hpp @@ -6,11 +6,8 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_HASH_MURMUR_HPP -#define __UTIL_HASH_MURMUR_HPP +#pragma once #include "murmur/murmur1.hpp" #include "murmur/murmur2.hpp" -#include "murmur/murmur3.hpp" - -#endif +#include "murmur/murmur3.hpp" \ No newline at end of file diff --git a/hash/murmur/murmur1.hpp b/hash/murmur/murmur1.hpp index c6bf5ec0..8a39c3a3 100644 --- a/hash/murmur/murmur1.hpp +++ b/hash/murmur/murmur1.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_HASH_MURMUR_MURMUR1_HPP -#define __UTIL_HASH_MURMUR_MURMUR1_HPP +#pragma once #include "../../view.hpp" @@ -41,6 +40,4 @@ namespace cruft::hash { private: seed_t m_seed; }; -} - -#endif +} \ No newline at end of file diff --git a/hash/murmur/murmur2.hpp b/hash/murmur/murmur2.hpp index 0d50eee7..bada5d48 100644 --- a/hash/murmur/murmur2.hpp +++ b/hash/murmur/murmur2.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_HASH_MURMUR_MURMUR2_HPP -#define __UTIL_HASH_MURMUR_MURMUR2_HPP +#pragma once #include "../../view.hpp" @@ -79,7 +78,4 @@ namespace cruft::hash { private: seed_t m_seed; }; -} - -#endif - +} \ No newline at end of file diff --git a/hash/murmur/murmur3.hpp b/hash/murmur/murmur3.hpp index 7d978382..dcedd276 100644 --- a/hash/murmur/murmur3.hpp +++ b/hash/murmur/murmur3.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_HASH_MURMUR_MURMUR3_HPP -#define __UTIL_HASH_MURMUR_MURMUR3_HPP +#pragma once #include "../../view.hpp" @@ -50,7 +49,4 @@ namespace cruft::hash { using murmur3_32 = murmur3< 32,32>; using murmur3_128_x86 = murmur3<128,32>; using murmur3_128_x64 = murmur3<128,64>; -} - -#endif - +} \ No newline at end of file diff --git a/hash/wang.hpp b/hash/wang.hpp index 70fbe109..a1e5c94c 100644 --- a/hash/wang.hpp +++ b/hash/wang.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2015 Danny Robson */ -#ifndef __UTIL_HASH_WANG_HPP -#define __UTIL_HASH_WANG_HPP +#pragma once #include @@ -44,6 +43,4 @@ namespace cruft::hash { return key; } -} - -#endif +} \ No newline at end of file diff --git a/io.hpp b/io.hpp index 00007e1e..ee727c91 100644 --- a/io.hpp +++ b/io.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2014 Danny Robson */ -#ifndef __UTIL_IO_HPP -#define __UTIL_IO_HPP +#pragma once #include "std.hpp" #include "platform.hpp" @@ -230,6 +229,4 @@ namespace cruft { #include "io_win32.hpp" #else #include "io_posix.hpp" -#endif - -#endif +#endif \ No newline at end of file diff --git a/io_posix.hpp b/io_posix.hpp index 9d165097..efac6cf1 100644 --- a/io_posix.hpp +++ b/io_posix.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2016 Danny Robson */ -#ifndef __UTIL_IO_POSIX_HPP -#define __UTIL_IO_POSIX_HPP +#pragma once #include "posix/fd.hpp" @@ -81,6 +80,4 @@ namespace cruft { } typedef detail::posix::mapped_file mapped_file; -} - -#endif +} \ No newline at end of file diff --git a/library.hpp b/library.hpp index e58159fc..456447d0 100644 --- a/library.hpp +++ b/library.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_LIBRARY_HPP -#define __UTIL_LIBRARY_HPP +#pragma once #include "platform.hpp" @@ -16,5 +15,3 @@ #elif defined(PLATFORM_WIN32) #include "library_win32.hpp" #endif - -#endif diff --git a/library_posix.hpp b/library_posix.hpp index c75a540e..762be04e 100644 --- a/library_posix.hpp +++ b/library_posix.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_LIBRARY_POSIX_HPP -#define __UTIL_LIBRARY_POSIX_HPP +#pragma once #include @@ -40,6 +39,4 @@ namespace cruft { } typedef detail::library_posix library; -} - -#endif +} \ No newline at end of file diff --git a/library_win32.hpp b/library_win32.hpp index 0562dc2e..f5a07e5d 100644 --- a/library_win32.hpp +++ b/library_win32.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_LIBRARY_WIN32_HPP -#define __UTIL_LIBRARY_WIN32_HPP +#pragma once #include "win32/windows.hpp" @@ -46,5 +45,3 @@ namespace cruft { typedef detail::win32::library library; } - -#endif diff --git a/memory/system.hpp b/memory/system.hpp index 65789a8e..c86cc8c5 100644 --- a/memory/system.hpp +++ b/memory/system.hpp @@ -6,13 +6,10 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_MEMORY_SYSTEM_HPP -#define __UTIL_MEMORY_SYSTEM_HPP +#pragma once #include namespace cruft::memory { size_t pagesize (void); -} - -#endif +} \ No newline at end of file diff --git a/posix/fwd.hpp b/posix/fwd.hpp index 75e00916..115d00ba 100644 --- a/posix/fwd.hpp +++ b/posix/fwd.hpp @@ -6,13 +6,10 @@ * Copyright 2016 Danny Robson */ -#ifndef __CRUFT_UTIL_POSIX_FWD_HPP -#define __CRUFT_UTIL_POSIX_FWD_HPP +#pragma once namespace cruft::posix { class fd; class dir; class map; } - -#endif diff --git a/posix/map.hpp b/posix/map.hpp index c5d0a486..0dbb13fc 100644 --- a/posix/map.hpp +++ b/posix/map.hpp @@ -6,8 +6,7 @@ * Copyright 2016 Danny Robson */ -#ifndef __CRUFT_UTIL_POSIX_HPP -#define __CRUFT_UTIL_POSIX_HPP +#pragma once #include "fd.hpp" @@ -51,5 +50,3 @@ namespace cruft::posix { size_t m_size; }; } - -#endif diff --git a/quaternion.hpp b/quaternion.hpp index b1da7731..eddbe933 100644 --- a/quaternion.hpp +++ b/quaternion.hpp @@ -6,8 +6,7 @@ * Copyright 2011-2018 Danny Robson */ -#ifndef __UTIL_QUATERNION_HPP -#define __UTIL_QUATERNION_HPP +#pragma once #include "coord/traits.hpp" @@ -255,6 +254,4 @@ namespace cruft { template std::ostream& operator<< (std::ostream&, quaternion); -} - -#endif +} \ No newline at end of file diff --git a/rational.hpp b/rational.hpp index 07f6897b..20df3f39 100644 --- a/rational.hpp +++ b/rational.hpp @@ -6,8 +6,7 @@ * Copyright 2014-2015 Danny Robson */ -#ifndef __UTIL_RATIONAL_HPP -#define __UTIL_RATIONAL_HPP +#pragma once #include #include @@ -66,7 +65,4 @@ namespace cruft { /////////////////////////////////////////////////////////////////////////// template std::ostream& operator<< (std::ostream&, rational); -}; - - -#endif +}; \ No newline at end of file diff --git a/roots/bisection.hpp b/roots/bisection.hpp index 654a9012..76c294a5 100644 --- a/roots/bisection.hpp +++ b/roots/bisection.hpp @@ -6,8 +6,7 @@ * Copyright 2016 Danny Robson */ -#ifndef __UTIL_ROOTS_BISECTION_HPP -#define __UTIL_ROOTS_BISECTION_HPP +#pragma once #include "../maths.hpp" @@ -57,5 +56,3 @@ namespace cruft::roots { return (a + b) / T{2}; } } - -#endif diff --git a/stats.hpp b/stats.hpp index 3b862463..3392a5c2 100644 --- a/stats.hpp +++ b/stats.hpp @@ -6,8 +6,7 @@ * Copyright 2010 Danny Robson */ -#ifndef __UTIL_STATS_HPP -#define __UTIL_STATS_HPP +#pragma once #include @@ -38,6 +37,4 @@ namespace cruft { template std::ostream& operator<< (std::ostream&, const accumulator&); } -} - -#endif +} \ No newline at end of file diff --git a/stream.hpp b/stream.hpp index e07d9450..ae34216e 100644 --- a/stream.hpp +++ b/stream.hpp @@ -6,8 +6,7 @@ * Copyright 2011-2016 Danny Robson */ -#ifndef __UTIL_STREAM_HPP -#define __UTIL_STREAM_HPP +#pragma once #include #include @@ -76,6 +75,3 @@ namespace cruft::stream { //--------------------------------------------------------------------- std::ostream& operator<< (std::ostream&, bits); } - - -#endif diff --git a/term.hpp b/term.hpp index 19b9b1c7..93b79d77 100644 --- a/term.hpp +++ b/term.hpp @@ -6,8 +6,7 @@ * Copyright 2016 Danny Robson */ -#ifndef __UTIL_TERM_HPP -#define __UTIL_TERM_HPP +#pragma once #include @@ -55,6 +54,4 @@ namespace cruft::term { std::ostream& operator<< (std::ostream&, code); std::ostream& operator<< (std::ostream&, graphics); } -} - -#endif +} \ No newline at end of file diff --git a/time.hpp b/time.hpp index f263f2ab..fbe861b6 100644 --- a/time.hpp +++ b/time.hpp @@ -6,8 +6,7 @@ * Copyright 2010-2016 Danny Robson */ -#ifndef __UTIL_TIME_HPP -#define __UTIL_TIME_HPP +#pragma once #include "stats.hpp" @@ -93,5 +92,3 @@ namespace cruft { stats::accumulator m_series; }; } - -#endif diff --git a/types/string.hpp b/types/string.hpp index 1875543b..42a174f4 100644 --- a/types/string.hpp +++ b/types/string.hpp @@ -6,13 +6,10 @@ * Copyright 2011 Danny Robson */ -#ifndef __UTIL_TYPES_STRING_HPP -#define __UTIL_TYPES_STRING_HPP +#pragma once #include template std::string type_to_string (void); - -#endif diff --git a/version.hpp b/version.hpp index 4d961d16..f2feae13 100644 --- a/version.hpp +++ b/version.hpp @@ -6,8 +6,7 @@ * Copyright 2010 Danny Robson */ -#ifndef __UTIL_VERSION_HPP -#define __UTIL_VERSION_HPP +#pragma once #include #include @@ -89,7 +88,4 @@ namespace cruft { }; std::ostream& operator<< (std::ostream& os, const cruft::version& rhs); -} - - -#endif // __VERSION_HPP +} \ No newline at end of file diff --git a/win32/registry.hpp b/win32/registry.hpp index 909ab8f0..56320f2c 100644 --- a/win32/registry.hpp +++ b/win32/registry.hpp @@ -6,8 +6,7 @@ * Copyright 2015 Danny Robson */ -#ifndef __UTIL_WIN32_REGISTRY_HPP -#define __UTIL_WIN32_REGISTRY_HPP +#pragma once #include "windows.hpp" @@ -60,5 +59,3 @@ namespace cruft::win32 { HKEY m_handle; }; } - -#endif diff --git a/zlib.hpp b/zlib.hpp index 21d08dd1..70ddc3c5 100644 --- a/zlib.hpp +++ b/zlib.hpp @@ -6,8 +6,7 @@ * Copyright 2013 Danny Robson */ -#ifndef __UTIL_ZLIB_HPP -#define __UTIL_ZLIB_HPP +#pragma once #include #include @@ -59,6 +58,4 @@ namespace cruft { { ; } }; } -} - -#endif +} \ No newline at end of file