ソースを参照

Add a pair of headers to guard against intrusive Windows macros.

wip/core-clipp
Sam Hocevar 4年前
コミット
c1645f5e8b
20個のファイルの変更70行の追加81行の削除
  1. +2
    -0
      include/lol/bigint
  2. +2
    -0
      include/lol/color
  3. +2
    -0
      include/lol/getopt
  4. +2
    -0
      include/lol/half
  5. +2
    -0
      include/lol/math
  6. +2
    -0
      include/lol/noise
  7. +0
    -12
      include/lol/private/math/functions.h
  8. +0
    -13
      include/lol/private/math/matrix.h
  9. +1
    -20
      include/lol/private/math/matrix.ipp
  10. +0
    -12
      include/lol/private/math/vector.h
  11. +20
    -0
      include/lol/private/pop_macros.h
  12. +25
    -0
      include/lol/private/push_macros.h
  13. +0
    -12
      include/lol/private/types/half.h
  14. +0
    -12
      include/lol/private/types/real.h
  15. +2
    -0
      include/lol/real
  16. +2
    -0
      include/lol/thread
  17. +2
    -0
      include/lol/transform
  18. +2
    -0
      include/lol/unit_test
  19. +2
    -0
      include/lol/utils
  20. +2
    -0
      include/lol/vector

+ 2
- 0
include/lol/bigint ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/types/bigint.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/color ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/image/color.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/getopt ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/sys/getopt.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/half ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/types/half.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/math ファイルの表示

@@ -12,8 +12,10 @@

#pragma once

#include "private/push_macros.h"
#include "private/math/constants.h"
#include "private/math/functions.h"
#include "private/math/rand.h"
#include "private/math/polynomial.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/noise ファイルの表示

@@ -17,7 +17,9 @@
// ———————————————
//

#include "private/push_macros.h"
#include "private/math/gradient.h"
#include "private/math/perlin.h"
#include "private/math/simplex.h"
#include "private/pop_macros.h"


+ 0
- 12
include/lol/private/math/functions.h ファイルの表示

@@ -24,13 +24,6 @@

#include <stdint.h>

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# undef min
# undef max
#endif

namespace lol
{

@@ -167,8 +160,3 @@ template<typename T, typename T2 = T, typename DUMMY = LOL_T_UNSIGNED>
[[nodiscard]] static inline T2 sign(T x) { return (T)((T)0 < x); }

} // namespace lol

#if _MSC_VER
# pragma pop_macro("min")
# pragma pop_macro("max")
#endif

+ 0
- 13
include/lol/private/math/matrix.h ファイルの表示

@@ -22,13 +22,6 @@
#include <ostream> // std::ostream
#include <cmath> // std::fabs

#if _WIN32
# pragma push_macro("near")
# pragma push_macro("far")
# undef near
# undef far
#endif

namespace lol
{

@@ -610,9 +603,3 @@ template<typename T>
mat_t<T,4,4> const mat_t<T,4,4>::identity = mat_t<T,4,4>((T)1);

} /* namespace lol */

#if _WIN32
# pragma pop_macro("near")
# pragma pop_macro("far")
#endif


+ 1
- 20
include/lol/private/math/matrix.ipp ファイルの表示

@@ -16,17 +16,6 @@
#include <cmath> // std::tan
#include <algorithm> // std::max

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# pragma push_macro("near")
# pragma push_macro("far")
# undef min
# undef max
# undef near
# undef far
#endif

namespace lol
{

@@ -291,12 +280,4 @@ inline mat4 mat4::shifted_perspective(float fov_y, float screen_size,
mat4::translate(.0f, .0f, -dist_scr);
}

} /* namespace lol */

#if _WIN32
# pragma pop_macro("min")
# pragma pop_macro("max")
# pragma pop_macro("near")
# pragma pop_macro("far")
#endif

} // namespace lol

+ 0
- 12
include/lol/private/math/vector.h ファイルの表示

@@ -28,13 +28,6 @@

#include "ops.h"

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# undef min
# undef max
#endif

namespace lol
{

@@ -1438,8 +1431,3 @@ typedef ivec12 int12;
} // namespace lol

#include "vector.ipp"

#if _MSC_VER
# pragma pop_macro("min")
# pragma pop_macro("max")
#endif

+ 20
- 0
include/lol/private/pop_macros.h ファイルの表示

@@ -0,0 +1,20 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

// Restore macros that push_macros.h disabled.

#if _MSC_VER
# pragma pop_macro("min")
# pragma pop_macro("max")
# pragma pop_macro("near")
# pragma pop_macro("far")
#endif

+ 25
- 0
include/lol/private/push_macros.h ファイルの表示

@@ -0,0 +1,25 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

// Undefine some intrusive macros from the Windows headers but allow
// to restore them afterwards if that’s what the user really wants.

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# pragma push_macro("near")
# pragma push_macro("far")
# undef min
# undef max
# undef near
# undef far
#endif

+ 0
- 12
include/lol/private/types/half.h ファイルの表示

@@ -28,13 +28,6 @@
namespace lol
{

#if _WIN32
# pragma push_macro("near")
# pragma push_macro("far")
# undef near
# undef far
#endif

namespace half_ops { struct base {}; }

class [[nodiscard]] half
@@ -335,8 +328,3 @@ DECLARE_HALF_BOOL_OPS(<=)
} // namespace half_ops

} // namespace lol

#if _WIN32
# pragma pop_macro("near")
# pragma pop_macro("far")
#endif

+ 0
- 12
include/lol/private/types/real.h ファイルの表示

@@ -24,13 +24,6 @@
#include <string> // std::string
#include <stdint.h> // int64_t etc.

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# undef min
# undef max
#endif

namespace lol
{

@@ -266,8 +259,3 @@ typedef real_t<uint32_t> real;
} // namespace lol

#include "real.ipp"

#if _MSC_VER
# pragma pop_macro("min")
# pragma pop_macro("max")
#endif

+ 2
- 0
include/lol/real ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/types/real.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/thread ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/sys/threading.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/transform ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/math/transform.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/unit_test ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/lolunit.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/utils ファイルの表示

@@ -12,9 +12,11 @@

#pragma once

#include "private/push_macros.h"
#include "private/features.h"
#include "private/base/env.h"
#include "private/base/string.h"
#include "private/base/containers.h"
#include "private/base/misc.h"
#include "private/pop_macros.h"


+ 2
- 0
include/lol/vector ファイルの表示

@@ -12,5 +12,7 @@

#pragma once

#include "private/push_macros.h"
#include "private/math/vector.h"
#include "private/pop_macros.h"


読み込み中…
キャンセル
保存