Remove usage of deprecated CMake module

Also removed all checks for C++11 support since we only support
compilers that have this already.
This commit is contained in:
asarium committed 2021-06-20 12:56:20 +02:00
1 parent c1d2920526
commit b6fe676072
20 files changed
+34 -70

No files matched your search

-12
View File
@@ -1,15 +1,3 @@
include(WriteCompilerDetectionHeader)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
set(CMAKE_CXX_STANDARD 11)
get_property(CMAKE_CXX_KNOWN_FEATURES GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
write_compiler_detection_header(
FILE "${GENERATED_SOURCE_DIR}/scp_compiler_detection.h"
PREFIX SCP
COMPILERS AppleClang Clang GNU MSVC
FEATURES ${CMAKE_CXX_KNOWN_FEATURES}
VERSION 3.2
)
-2
View File
@@ -21,8 +21,6 @@ endif()
set(CMAKE_EXTRA_INCLUDE_FILES "cstddef")
CHECK_TYPE_SIZE("std::max_align_t" STD_MAX_ALIGN_T LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES "type_traits")
CHECK_TYPE_SIZE("std::is_trivially_copyable<int>" STD_IS_TRIVIALLY_COPYABLE LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_TYPE_SIZE("char32_t" CHAR32_T LANGUAGE CXX)
-2
View File
@@ -8,8 +8,6 @@
#cmakedefine SCP_HAVE_MAX_ALIGN_T
#cmakedefine SCP_HAVE_STD_MAX_ALIGN_T
#cmakedefine01 HAVE_STD_IS_TRIVIALLY_COPYABLE
#cmakedefine01 IS_64BIT
#cmakedefine01 SCP_HAVE_STRCASECMP
+2 -3
View File
@@ -93,13 +93,12 @@ class Decoder {
bool m_decoding;
size_t m_queueSize = 0;
Decoder(const Decoder&) SCP_DELETED_FUNCTION;
Decoder& operator=(const Decoder&) SCP_DELETED_FUNCTION;
protected:
Decoder();
public:
Decoder(const Decoder&) = delete;
Decoder& operator=(const Decoder&) = delete;
virtual ~Decoder();
+4 -6
View File
@@ -45,10 +45,8 @@ struct DecoderStatus {
~DecoderStatus();
private:
DecoderStatus(const DecoderStatus&) SCP_DELETED_FUNCTION;
DecoderStatus& operator=(const DecoderStatus&) SCP_DELETED_FUNCTION;
DecoderStatus(const DecoderStatus&) = delete;
DecoderStatus& operator=(const DecoderStatus&) = delete;
};
template<typename Frame>
@@ -67,8 +65,8 @@ class FFMPEGStreamDecoder {
explicit FFMPEGStreamDecoder(DecoderStatus* status);
virtual ~FFMPEGStreamDecoder();
FFMPEGStreamDecoder(const FFMPEGStreamDecoder&) SCP_DELETED_FUNCTION;
FFMPEGStreamDecoder& operator=(const FFMPEGStreamDecoder&) SCP_DELETED_FUNCTION;
FFMPEGStreamDecoder(const FFMPEGStreamDecoder&) = delete;
FFMPEGStreamDecoder& operator=(const FFMPEGStreamDecoder&) = delete;
virtual void decodePacket(AVPacket* packet) = 0;
+1 -3
View File
@@ -453,7 +453,6 @@ SCP_string dump_stacktrace();
// DEBUG compile time catch for dangerous uses of memset/memcpy/memmove
// This is disabled for VS2013 and lower since that doesn't support the necessary features
#if !defined(NDEBUG) && !defined(USING_THIRD_PARTY_LIBS) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
#if SCP_COMPILER_CXX_AUTO_TYPE && SCP_COMPILER_CXX_STATIC_ASSERT && HAVE_STD_IS_TRIVIALLY_COPYABLE
// feature support seems to be: gcc clang msvc
// auto 4.4 2.9 2010
// std::is_trivial 4.5 ? 2012 (2010 only duplicates std::is_pod)
@@ -553,7 +552,6 @@ using std::memcpy_if_trivial_else_error;
using std::memmove_if_trivial_else_error;
using std::memset_if_trivial_else_error;
#endif // HAVE_CXX11
#endif // NDEBUG
#endif // PS_TYPES_H
#endif // _PSTYPES_H
-2
View File
@@ -3,8 +3,6 @@
#define SCP_DEFINES_H
#pragma once
#include "scp_compiler_detection.h"
#define SCP_TOKEN_CONCAT1(x, y) x ## y
#define SCP_TOKEN_CONCAT(x, y) SCP_TOKEN_CONCAT1(x, y)
+1 -1
View File
@@ -67,7 +67,7 @@
#define USED_VARIABLE __attribute__((used))
#if SCP_COMPILER_VERSION_MAJOR >= 7
#if __GNUC__ >= 7
#define FALLTHROUGH [[fallthrough]]
#else
#define FALLTHROUGH
+1 -1
View File
@@ -64,7 +64,7 @@
#define USED_VARIABLE __attribute__((used))
#if SCP_COMPILER_VERSION_MAJOR >= 7
#if __GNUC__ >= 7
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH
+2 -2
View File
@@ -55,8 +55,8 @@ class ShaderProgram {
ShaderUniforms Uniforms;
ShaderProgram(const ShaderProgram&) SCP_DELETED_FUNCTION;
ShaderProgram& operator=(const ShaderProgram&) SCP_DELETED_FUNCTION;
ShaderProgram(const ShaderProgram&) = delete;
ShaderProgram& operator=(const ShaderProgram&) = delete;
ShaderProgram(ShaderProgram&& other) noexcept;
ShaderProgram& operator=(ShaderProgram&& other) noexcept;
+2 -4
View File
@@ -33,10 +33,8 @@ namespace font {
return *this;
}
private:
TrueTypeFontData(const TrueTypeFontData &) SCP_DELETED_FUNCTION;
TrueTypeFontData &operator=(const TrueTypeFontData &) SCP_DELETED_FUNCTION;
TrueTypeFontData(const TrueTypeFontData &) = delete;
TrueTypeFontData &operator=(const TrueTypeFontData &) = delete;
};
// Forward declarations
-8
View File
@@ -40,9 +40,7 @@ class UniformAligner {
{
Assertion(sizeof(T) == _dataSize,
"Sizes of template parameter and runtime size do not match! This probably uses the wrong type.");
#if HAVE_STD_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<T>::value, "Element type must be trivially copyable!");
#endif
return reinterpret_cast<T*>(addElement());
}
@@ -50,9 +48,7 @@ class UniformAligner {
template<typename THeader>
THeader* getHeader() {
Assertion(sizeof(THeader) == _headerSize, "Header size does not match requested header type!");
#if HAVE_STD_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<THeader>::value, "Header type must be trivially copyable!");
#endif
return reinterpret_cast<THeader*>(_buffer);
}
@@ -63,9 +59,7 @@ class UniformAligner {
T* getTypedElement(size_t index) {
Assertion(sizeof(T) == _dataSize,
"Sizes of template parameter and runtime size do not match! This probably uses the wrong type.");
#if HAVE_STD_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<T>::value, "Element type must be trivially copyable!");
#endif
return reinterpret_cast<T*>(getElement(index));
}
@@ -82,9 +76,7 @@ class UniformAligner {
T* nextTypedElement(T* currentEl) {
Assertion(sizeof(T) == _dataSize,
"Sizes of template parameter and runtime size do not match! This probably uses the wrong type.");
#if HAVE_STD_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<T>::value, "Element type must be trivially copyable!");
#endif
return reinterpret_cast<T*>(nextElement(reinterpret_cast<void*>(currentEl)));
}
+4 -11
View File
@@ -12,6 +12,8 @@
#ifndef _FIX_H
#define _FIX_H
#include "globalincs/pstypes.h"
#define F1_0 65536
#define f1_0 65536
@@ -19,21 +21,12 @@ fix fixmul(fix a, fix b);
fix fixdiv(fix a, fix b);
fix fixmuldiv(fix a, fix b, fix c);
// Needed for compatibility with MSVC 2013
#if SCP_COMPILER_CXX_CONSTEXPR
#define CONST_EXPR constexpr
#else
#define CONST_EXPR inline
#endif
CONST_EXPR int f2i(fix a) {
constexpr int f2i(fix a) {
return static_cast<int>(a >> 16);
}
CONST_EXPR fix i2f(int a) {
constexpr fix i2f(int a) {
return static_cast<fix>(a << 16);
}
#undef CONST_EXPR
#endif
+2 -2
View File
@@ -13,7 +13,7 @@
void sexp_packet_received(ubyte *received_packet, int num_ubytes);
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// This suppresses a GCC bug where it thinks that some of the enum fields below shadow global declarations even though
// the enum class names are not visible in the global namespace
@@ -37,7 +37,7 @@ enum class packet_data_type {
WING = 12,
};
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
+2 -3
View File
@@ -30,9 +30,8 @@ namespace particle
bool m_finished = false;
public:
ParticleSourceWrapper(const ParticleSourceWrapper&) SCP_DELETED_FUNCTION;
ParticleSourceWrapper& operator=(const ParticleSourceWrapper&) SCP_DELETED_FUNCTION;
ParticleSourceWrapper(const ParticleSourceWrapper&) = delete;
ParticleSourceWrapper& operator=(const ParticleSourceWrapper&) = delete;
ParticleSourceWrapper() = default;
explicit ParticleSourceWrapper(SCP_vector<ParticleSource*>&& sources);
+4 -1
View File
@@ -3,6 +3,9 @@
#pragma once
#include "globalincs/pstypes.h"
#include "particle/ParticleEffect.h"
#include "particle/ParticleManager.h"
#include "utils/RandomRange.h"
namespace particle {
@@ -52,7 +55,7 @@ class ConeShape {
* @brief Specifies if the velocities of the particles should be scaled with the deviation from the direction
* @return @c true
*/
static SCP_CONSTEXPR bool scale_velocity_deviation() {
static constexpr bool scale_velocity_deviation() {
return true;
}
};
+4 -2
View File
@@ -5,8 +5,10 @@
#define _SPHERE_SHAPE_H
#pragma once
#include <math/bitarray.h>
#include "globalincs/pstypes.h"
#include "math/bitarray.h"
#include "particle/ParticleEffect.h"
#include "utils/RandomRange.h"
namespace particle {
@@ -47,7 +49,7 @@ class SphereShape {
* @brief Specifies if the velocities of the particles should be scaled with the deviation from the direction
* @return @c true
*/
static SCP_CONSTEXPR bool scale_velocity_deviation() {
static constexpr bool scale_velocity_deviation() {
return false;
}
};
+3 -2
View File
@@ -8,11 +8,12 @@
#include "globalincs/pstypes.h"
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// This suppresses a GCC bug where it thinks that the Cutscenes from the enum class below shadows a global variable
#pragma GCC diagnostic ignored "-Wshadow"
#endif
// sections of a pilot file. includes both plr and csg sections
enum class Section {
Invalid = -1,
@@ -33,7 +34,7 @@ enum class Section {
Cutscenes = 0x0014,
LastMissions = 0x0015
};
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
-1
View File
@@ -361,7 +361,6 @@ add_file_folder("GameSnd"
add_file_folder("Generated Files"
${GENERATED_SOURCE_DIR}/project.h
${GENERATED_SOURCE_DIR}/scp_compiler_detection.h
${PLATFORM_CHECK_HEADER}
)
+2 -2
View File
@@ -8,13 +8,13 @@ namespace unicode {
text_iterator::text_iterator(const char* in_current_byte, const char* in_range_start_byte, const char* in_range_end_byte) :
current_byte(in_current_byte), range_end_byte(in_range_end_byte), range_start_byte(in_range_start_byte) {
if (range_end_byte == nullptr) {
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// This suppresses a GCC bug where it thinks that in_current_byte is null in release builds
#pragma GCC diagnostic ignored "-Wnonnull"
#endif
range_end_byte = in_current_byte + strlen(in_current_byte);
#if SCP_COMPILER_IS_GNU
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}