Switch atmosphere's build target to C++20. (#952)

* ams: update to build with gcc10/c++20

* remove mno-outline-atomics

* ams: take care of most TODO C++20s

* fusee/sept: update for gcc10

* whoosh, your code now uses pre-compiled headers

* make: dependency fixes
This commit is contained in:
SciresM
2020-05-11 15:02:10 -07:00
committed by GitHub
parent 17b6bcfd37
commit 3a1ccdd919
258 changed files with 723 additions and 804 deletions

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::emummc {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
#include "ams_bpc.h"
@@ -182,6 +181,9 @@ extern "C" {
/* Custom abort handler, so that std::abort will trigger these. */
void abort() {
static ams::os::Mutex abort_lock(true);
std::scoped_lock lk(abort_lock);
ams::AbortImpl();
__builtin_unreachable();
}

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
#include <stratosphere/spl.hpp>
#include <stratosphere/spl/smc/spl_smc.hpp>

View File

@@ -23,6 +23,6 @@ namespace ams::capsrv::server {
};
static_assert(sizeof(DecoderWorkMemory) == SoftwareJpegDecoderWorkMemorySize);
static_assert(alignof(DecoderWorkMemory) == os::MemoryPageSize);
static_assert(std::is_pod<DecoderWorkMemory>::value);
static_assert(util::is_pod<DecoderWorkMemory>::value);
}

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::cfg {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::cfg {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::cfg {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::cfg {

View File

@@ -23,7 +23,7 @@ namespace ams::fs::impl {
struct FilePathHash : public Newable {
u8 data[FilePathHashSize];
};
static_assert(std::is_pod<FilePathHash>::value);
static_assert(util::is_pod<FilePathHash>::value);
inline bool operator==(const FilePathHash &lhs, const FilePathHash &rhs) {
return std::memcmp(lhs.data, rhs.data, FilePathHashSize) == 0;

View File

@@ -21,6 +21,6 @@ namespace ams::fs {
struct MountName {
char str[MountNameLengthMax + 1];
};
static_assert(std::is_pod<MountName>::value);
static_assert(util::is_pod<MountName>::value);
}

View File

@@ -24,7 +24,7 @@ namespace ams::fssystem {
u32 name_table_size;
u32 reserved;
};
static_assert(std::is_pod<PartitionFileSystemMeta::PartitionFileSystemHeader>::value);
static_assert(util::is_pod<PartitionFileSystemMeta::PartitionFileSystemHeader>::value);
static_assert(sizeof(PartitionFileSystemMeta::PartitionFileSystemHeader) == 0x10);
template <typename Format>

View File

@@ -37,7 +37,7 @@ namespace ams::fssystem {
virtual ~RomFsFile() { /* ... */ }
public:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
size_t read_size = 0;
R_TRY(this->DryRead(std::addressof(read_size), offset, size, option, fs::OpenMode_Read));
@@ -84,7 +84,7 @@ namespace ams::fssystem {
operate_size = this->GetSize() - offset;
}
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
R_TRY(this->parent->GetBaseStorage()->OperateRange(dst, dst_size, op_id, this->start + offset, operate_size, src, src_size));
return ResultSuccess();
}, AMS_CURRENT_FUNCTION_NAME));
@@ -113,7 +113,7 @@ namespace ams::fssystem {
virtual ~RomFsDirectory() override { /* ... */ }
public:
virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
return this->ReadImpl(out_count, std::addressof(this->current_find), out_entries, max_entries);
}, AMS_CURRENT_FUNCTION_NAME));
return ResultSuccess();
@@ -278,7 +278,7 @@ namespace ams::fssystem {
}
Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
R_TRY_CATCH(this->rom_file_table.OpenFile(out, path)) {
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound());
} R_END_TRY_CATCH;
@@ -325,7 +325,7 @@ namespace ams::fssystem {
}
Result RomFsFileSystem::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
RomDirectoryInfo dir_info;
R_TRY_CATCH(this->rom_file_table.GetDirectoryInformation(std::addressof(dir_info), path)) {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::kvdb {
@@ -42,7 +41,7 @@ namespace ams::kvdb {
return header;
}
};
static_assert(sizeof(ArchiveHeader) == 0xC && std::is_pod<ArchiveHeader>::value, "ArchiveHeader definition!");
static_assert(sizeof(ArchiveHeader) == 0xC && util::is_pod<ArchiveHeader>::value, "ArchiveHeader definition!");
struct ArchiveEntryHeader {
u8 magic[sizeof(ArchiveEntryMagic)];
@@ -62,7 +61,7 @@ namespace ams::kvdb {
return header;
}
};
static_assert(sizeof(ArchiveEntryHeader) == 0xC && std::is_pod<ArchiveEntryHeader>::value, "ArchiveEntryHeader definition!");
static_assert(sizeof(ArchiveEntryHeader) == 0xC && util::is_pod<ArchiveEntryHeader>::value, "ArchiveEntryHeader definition!");
}

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::kvdb {

View File

@@ -13,7 +13,6 @@
* 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 <stratosphere.hpp>
namespace ams::map {

View File

@@ -160,7 +160,7 @@ namespace ams::mem::impl::heap {
template<typename T>
static ALWAYS_INLINE T *AlignUpPage(T *ptr) {
static_assert(std::is_pod<T>::value);
static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PageSize, alignof(T)));
return reinterpret_cast<T *>(AlignUpPage(reinterpret_cast<uintptr_t>(ptr)));
}
@@ -171,7 +171,7 @@ namespace ams::mem::impl::heap {
template<typename T>
static ALWAYS_INLINE T *AlignDownPage(T *ptr) {
static_assert(std::is_pod<T>::value);
static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PageSize, alignof(T)));
return reinterpret_cast<T *>(AlignDownPage(reinterpret_cast<uintptr_t>(ptr)));
}
@@ -182,7 +182,7 @@ namespace ams::mem::impl::heap {
template<typename T>
static ALWAYS_INLINE T *AlignUpPhysicalPage(T *ptr) {
static_assert(std::is_pod<T>::value);
static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PhysicalPageSize, alignof(T)));
return reinterpret_cast<T *>(AlignUpPhysicalPage(reinterpret_cast<uintptr_t>(ptr)));
}
@@ -193,7 +193,7 @@ namespace ams::mem::impl::heap {
template<typename T>
static ALWAYS_INLINE T *AlignDownPhysicalPage(T *ptr) {
static_assert(std::is_pod<T>::value);
static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PhysicalPageSize, alignof(T)));
return reinterpret_cast<T *>(AlignDownPhysicalPage(reinterpret_cast<uintptr_t>(ptr)));
}

View File

@@ -451,7 +451,7 @@ namespace ams::ncm {
/* Ensure this type of key has an owner. */
R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch || key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey());
/* Applications are their own owner. */
if (key.type == ContentMetaType::Application) {
out_id.SetValue({key.id});

View File

@@ -18,7 +18,6 @@
namespace ams::os::impl {
/* TODO: C++20 constinit */
TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {};
constinit TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {};
}

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "os_waitable_manager_impl.hpp"
#include "os_waitable_object_list.hpp"
#include "os_tick_manager.hpp"

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "impl/os_timeout_helper.hpp"
#include "impl/os_waitable_object_list.hpp"
#include "impl/os_waitable_holder_impl.hpp"

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "impl/os_interrupt_event_impl.hpp"
#include "impl/os_waitable_object_list.hpp"

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "impl/os_waitable_object_list.hpp"
#include "impl/os_timeout_helper.hpp"

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "impl/os_waitable_object_list.hpp"
#include "impl/os_timeout_helper.hpp"

View File

@@ -27,7 +27,7 @@ namespace ams::pgl::srv {
os::ProcessId process_id;
u32 flags;
};
static_assert(std::is_pod<ProcessData>::value);
static_assert(util::is_pod<ProcessData>::value);
enum ProcessDataFlag : u32 {
ProcessDataFlag_None = 0,

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "sm_utils.hpp"
namespace ams::sm {

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "sm_utils.hpp"
#include "smm_ams.h"

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "sm_utils.hpp"
namespace ams::sm::mitm {

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "sm_utils.hpp"
namespace ams::sm::impl {

View File

@@ -13,8 +13,6 @@
* 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 <switch.h>
#include <stratosphere.hpp>
#include <stratosphere/updater.hpp>

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "updater_bis_management.hpp"
namespace ams::updater {

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "updater_bis_save.hpp"
namespace ams::updater {

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "updater_files.hpp"
namespace ams::updater {

View File

@@ -13,6 +13,7 @@
* 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 <stratosphere.hpp>
#include "updater_paths.hpp"
namespace ams::updater {

View File

@@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1);
#pragma GCC diagnostic pop
dest[size - 1] = '\0';
return dest;
}