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:
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user