summaryrefslogtreecommitdiffstats
path: root/src/core/hle/result.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-11-02general: Remove MakeResult helpersMorph1-19/+1
This is made obsolete by the presence of implicit constructors.
2021-11-02hle/result: Amend ResultVal documentationMorph1-12/+10
This amends the documentation slightly to reflect the updated interface.
2021-11-02hle/result: Reimplement ResultVal using Common::ExpectedMorph1-117/+63
Common::Expected effectively provides the same functions as ResultVal, so we can implement it with this. This can be replaced with std::expected with minimal effort should it be standardized in the C++ Standard Template Library.
2021-10-28hle/result: Declare copy/move constructor/assignment as noexceptMorph1-3/+3
While we're at it, we can also declare these copy/move constructor/assignment as noexcept.
2021-10-28hle/result: Add move assignment operator in ResultValMorph1-0/+20
ResultVal was missing a move assignment operator, add it.
2021-10-28hle/result: Remove cv-qualifiers from Arg in MakeResultMorph1-2/+2
This removes the const qualification for types when MakeResult(arg) is used in a const member function, allowing for automatic deduction and removing the need to manually specify the non-const type as the template argument.
2021-06-05result: Add [[nodiscard]] specifiers where applicableLioncash1-20/+20
The result code classes are used quite extensively throughout both the kernel and service HLE code. We can mark these member functions as [[nodiscard]] to prevent a few logic bugs from slipping through.
2021-06-02general: Replace RESULT_UNKNOWN with ResultUnknownMorph1-2/+2
Transition to PascalCase for result names.
2021-06-02general: Replace RESULT_SUCCESS with ResultSuccessMorph1-5/+4
Transition to PascalCase for result names.
2021-05-31common_funcs: Move R_ macros to result.hLioncash1-0/+25
These macros all interact with the result code type, so they should ideally be within this file as well, so all the common_funcs machinery doesn't need to be pulled in just to use them.
2021-05-16core: Make variable shadowing a compile-time errorLioncash1-1/+1
Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely.
2020-12-03audio_core: Make shadowing and unused parameters errorsLioncash1-1/+1
Moves the audio code closer to enabling warnings as errors in general.
2020-08-14core: Resolve several -Wextra-semi warningsLioncash1-4/+8
We can amend one of the cascade macros to require semicolons in order to compile. In other cases, we can just remove the superfluous semicolons.
2019-11-12result: Add default error code for the ResultCode(-1) caseLioncash1-1/+9
Will be used to reduce the overall duplication of the same magic value all over the codebase in following changes.
2019-11-12result: Resolve sign-coversion warningsLioncash1-1/+1
The constructor was implicitly using signed->unsigned conversions to produce 0xFFFFFFFF. We can just specify this explicitly with UINT32_MAX.
2019-04-05hle/result: Remove unnecessary bitfield entry for ResultCodeLioncash1-4/+0
This is a hold over from the 3DS error codes in Citra.
2019-03-10core/hle/result: Remove now-unnecessary manually defined copy assignment operatorLioncash1-5/+0
Previously this was required, as BitField wasn't trivially copyable. BitField has since been made trivially copyable, so now this isn't required anymore.
2019-03-10core/hle/result: Amend error in comment description for ResultCodeLioncash1-1/+1
Gets rid of another holdover from Citra, and describes the OS on the Switch instead.
2019-03-10core/hle/result: Remove now-unused constructor for ResultCodeLioncash1-10/+0
Now that the final stray ErrorDescription member was relocated, we can finally remove it and its relevant constructor in the ResultCode union.
2019-03-10core/hle/result: Relocate IPC error code to ipc_helpersLioncash1-1/+0
Relocates the error code to where it's most related, similar to how all the other error codes are. Previously we were including a non-generic error in the main result code header.
2019-03-05core/hle/ipc: Remove unnecessary includesLioncash1-1/+0
Removes a few inclusion dependencies from the headers or replaces existing ones with ones that don't indirectly include the required headers. This allows removing an inclusion of core/memory.h, meaning that if the memory header is ever changed in the future, it won't result in rebuilding the entirety of the HLE services (as the IPC headers are used quite ubiquitously throughout the HLE service implementations).
2018-11-16file_sys/errors: Extract FS-related error codes to file_sys/errors.hLioncash1-2/+0
Keeps filesystem-related error codes in one spot.
2018-08-28hle/result: Make ResultVal's move constructor as noexceptLioncash1-1/+1
Many containers within the standard library provide different behaviors based on whether or not a move constructor/assignment operator can be guaranteed not to throw or not. Notably, implementations will generally use std::move_if_noexcept (or an internal implementation of it) to provide strong exception guarantees. If a move constructor potentially throws (in other words, is not noexcept), then certain behaviors will create copies, rather than moving the values. For example, consider std::vector. When a std::vector calls resize(), there are two ways the elements can be relocated to the new block of memory (if a reallocation happens), by copy, or by moving the existing elements into the new block of memory. If a type does not have a guarantee that it will not throw in the move constructor, a copy will happen. However, if it can be guaranteed that the move constructor won't throw, then the elements will be moved. This just allows ResultVal to be moved instead of copied all the time if ever used in conjunction with containers for whatever reason.
2018-05-23Add & correct some error modulesgreggameplayer1-2/+8
2018-05-20Add and correct some Error Modules (#444)greggameplayer1-6/+40
* Add and correct some Error Modules
2018-03-29result: Check against self-assignment in ResultVal's copy assignment operatorLioncash1-0/+3
Avoids doing work that doesn't need to be done.
2018-02-27ResultCode: Mark any error code that isn't 0 as an error.Subv1-2/+2
2018-01-21fsp_srv: Various improvements to IStorage:Read implementation.bunnei1-0/+2
2017-11-01hle: Use Switch formatted result codes.bunnei1-181/+59
2017-06-19ResultVal: Remove MoveFrom()Yuri Kunde Schlesner1-4/+0
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in case you already have an rvalue.
2017-06-19ResultVal: Add an rvalue overload of Unwrap()Yuri Kunde Schlesner1-1/+6
2017-06-06ResultVal: Add more convenience utils for creating and cascading resultsYuri Kunde Schlesner1-0/+19
2017-05-25Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner1-6/+0
2017-05-25GSP_GPU: Move error codes from result.h to local fileYuri Kunde Schlesner1-3/+0
2017-05-25FileSys: Move all result description to errors.hYuri Kunde Schlesner1-21/+0
2017-05-25result: Make error description a generic integerYuri Kunde Schlesner1-3/+14
It is now known that result code description vary depending on the module, and so they're best defined on a per-module basis. To support this, allow passing in an arbitrary integer instead of limiting to the ones in the ErrorDescription enum. These will be gradually migrated to their individual users, but a few will be kept as "common" codes shared by all modules.
2017-05-25Make BitField and ResultCode constexpr-initializableYuri Kunde Schlesner1-18/+15
2017-05-15Kernel: Use a Session object to keep track of the status of a Client/Server session pair.Subv1-0/+1
Reduce the associated port's connection count when a ServerSession is destroyed.
2017-02-13file_sys: add Self NCCH archivewwylele1-0/+4
2016-12-05Return an error code when connecting to a saturated port.Subv1-0/+1
The error code was taken from the 3DS kernel.
2016-11-29FileSys: Implement OtherSaveDatawwylele1-0/+1
2016-11-19FileSys: add SDMCWriteOnlyArchivewwylele1-0/+1
2016-11-19FileSys: add ExtSaveDataArchivewwylele1-0/+1
ExtSaveData is more similar to SaveData, so let it be a subclass of SaveData
2016-11-19FileSys: add SaveDataArchivewwylele1-0/+7
The error checking of SaveDataArchive is completely different from DiskArchive, so it has to be a new class instead of a subclass of DiskArchive.
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-1/+0
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-19Manually tweak source formatting and then re-run clang-formatYuri Kunde Schlesner1-2/+1
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot1-40/+60
2016-07-04Fix the errorcode of archive handleJamePeng1-0/+1
2016-06-30Result: fix and update ErrorModulewwylele1-6/+19
2016-06-01gsp::gpu: Reset g_thread_id in UnregisterInterruptRelayQueuemailwl1-0/+1
2016-05-13Kernel: Implemented shared memory permissions.Subv1-0/+1
2016-04-30VideoCore: Run include-what-you-use and fix most includes.Emmanuel Gil Peyrot1-1/+0
2016-04-27DSP_DSP: Add return IPC headersMerryMage1-0/+1
2016-03-31GSP: Return proper error codes for register writespurpasmart961-0/+1
2016-03-20HLE/FS: Implemented GetFormatInfoSubv1-0/+1
Format information is currently only implemented for the ExtSaveData, SharedExtSaveData and SaveData archives, the information is stored in a file alongside the root folder of the archive.
2016-03-20HLE/FS: Return the proper error codes on file Read/Write operations.Subv1-0/+1
These operations are limited by the open flags specified while opening the file.
2016-03-20HLE/FS: Corrected the error codes for CreateFileSubv1-1/+3
2016-03-05core: Use unrestricted union to hold storage of ResultVal valueYuri Kunde Schlesner1-42/+16
2016-02-12BitField: Make trivially copyable and remove assignment operatorMerryMage1-4/+4
2016-01-14HLE/SVC: Implement UnmapMemoryBlock.Subv1-0/+1
This implementation will need to be (almost completely) changed when we implement multiprocess support.
2015-06-28Common: Cleanup key_map includes.Emmanuel Gil Peyrot1-1/+1
2015-05-07Common: Remove common.hYuri Kunde Schlesner1-0/+1
2015-02-28result: Make comparison operators take referencesLioncash1-2/+2
It's unnecessary to make copies for simple comparisons like this.
2015-02-19Convert a few C stdlib asserts to Citra's own assertsarchshift1-6/+4
2015-02-11Asserts: break/crash program, fit to style guide; log.h->assert.harchshift1-1/+1
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft.
2015-02-10ResultVal: Fixed compilation when reassigning a ResultVal.Subv1-3/+3
2015-01-30Remove result.h InvalidHandleYuri Kunde Schlesner1-5/+0
It was only being used in two places, where it was replaced by a local constant.
2015-01-30Additions to ResultVal to make it more convenient to use.Yuri Kunde Schlesner1-1/+25
2015-01-10Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance.archshift1-2/+2
2014-12-21License changepurpasmart961-1/+1
2014-12-18Filesystem/Archives: Implemented the SaveData archiveSubv1-0/+2
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information Got rid of the code duplication in File and Directory Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive. FS_U: Use the correct error code when a file wasn't found
2014-11-24HLE: Revamp error handling throrough the HLE codeYuri Kunde Schlesner1-0/+400
All service calls in the CTR OS return result codes indicating the success or failure of the call. Previous to this commit, Citra's HLE emulation of services and the kernel universally either ignored errors or returned dummy -1 error codes. This commit makes an initial effort to provide an infrastructure for error reporting and propagation which can be use going forward to make HLE calls accurately return errors as the original system. A few parts of the code have been updated to use the new system where applicable. One part of this effort is the definition of the `ResultCode` type, which provides facilities for constructing and parsing error codes in the structured format used by the CTR. The `ResultVal` type builds on `ResultCode` by providing a container for values returned by function that can report errors. It enforces that correct error checking will be done on function returns by preventing the use of the return value if the function returned an error code. Currently this change is mostly internal since errors are still suppressed on the ARM<->HLE border, as a temporary compatibility hack. As functionality is implemented and tested this hack can be eventually removed.