Commit graph

63 commits

Author SHA1 Message Date
Lioncash
eeae5217ba core: Make variable shadowing a compile-time error
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.
2021-05-16 03:43:16 -04:00
Lioncash
29db886722 audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
2020-12-03 00:54:31 -05:00
Lioncash
0c78ed16df core: Resolve several -Wextra-semi warnings
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.
2020-08-14 09:09:20 -04:00
Lioncash
34bb09d7be result: Add default error code for the ResultCode(-1) case
Will be used to reduce the overall duplication of the same magic value
all over the codebase in following changes.
2019-11-12 07:55:38 -05:00
Lioncash
53b3dea718 result: Resolve sign-coversion warnings
The constructor was implicitly using signed->unsigned conversions to
produce 0xFFFFFFFF. We can just specify this explicitly with UINT32_MAX.
2019-11-12 07:06:48 -05:00
Lioncash
3910871dd8 hle/result: Remove unnecessary bitfield entry for ResultCode
This is a hold over from the 3DS error codes in Citra.
2019-04-05 16:34:34 -04:00
Lioncash
6bb508f357 core/hle/result: Remove now-unnecessary manually defined copy assignment operator
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-10 18:34:20 -04:00
Lioncash
28bb00dcb2 core/hle/result: Amend error in comment description for ResultCode
Gets rid of another holdover from Citra, and describes the OS on the
Switch instead.
2019-03-10 18:29:31 -04:00
Lioncash
fc330266fc core/hle/result: Remove now-unused constructor for ResultCode
Now that the final stray ErrorDescription member was relocated, we can
finally remove it and its relevant constructor in the ResultCode union.
2019-03-10 18:26:12 -04:00
Lioncash
fc7bc644cc core/hle/result: Relocate IPC error code to ipc_helpers
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-10 18:23:42 -04:00
Lioncash
7d25f9a4a2 core/hle/ipc: Remove unnecessary includes
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).
2019-03-05 09:53:38 -05:00
Lioncash
55f9f05772 file_sys/errors: Extract FS-related error codes to file_sys/errors.h
Keeps filesystem-related error codes in one spot.
2018-11-16 00:13:50 -05:00
Lioncash
be902fe06e hle/result: Make ResultVal's move constructor as noexcept
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-08-28 09:39:50 -04:00
greggameplayer
90fa34e30c Add & correct some error modules 2018-05-23 14:22:42 +02:00
greggameplayer
c97505ad44 Add and correct some Error Modules (#444)
* Add and correct some Error Modules
2018-05-19 17:02:24 -05:00
Lioncash
e6375771e2 result: Check against self-assignment in ResultVal's copy assignment operator
Avoids doing work that doesn't need to be done.
2018-03-28 18:02:44 -04:00
Subv
585a145f31 ResultCode: Mark any error code that isn't 0 as an error. 2018-02-27 09:44:35 -05:00
bunnei
a94d5d1938 fsp_srv: Various improvements to IStorage:Read implementation. 2018-01-21 15:51:43 -05:00
bunnei
714dd3da6d hle: Use Switch formatted result codes. 2017-10-31 19:26:11 -04:00
Yuri Kunde Schlesner
c27dad4cd1 ResultVal: Remove MoveFrom()
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in
case you already have an rvalue.
2017-06-18 19:03:15 -07:00
Yuri Kunde Schlesner
ec6a30b8bb ResultVal: Add an rvalue overload of Unwrap() 2017-06-18 18:49:46 -07:00
Yuri Kunde Schlesner
9dd1fd5b9e ResultVal: Add more convenience utils for creating and cascading results 2017-06-06 00:51:57 -07:00
Yuri Kunde Schlesner
467545ed48 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
6210a1aaf3 GSP_GPU: Move error codes from result.h to local file 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
2d147a1c0d FileSys: Move all result description to errors.h 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
f2e65b5cbc result: Make error description a generic integer
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-24 21:05:59 -07:00
Yuri Kunde Schlesner
a786199c4b Make BitField and ResultCode constexpr-initializable 2017-05-24 21:05:59 -07:00
Subv
9c496013b3 Kernel: Use a Session object to keep track of the status of a Client/Server session pair.
Reduce the associated port's connection count when a ServerSession is destroyed.
2017-05-15 11:22:15 -05:00
wwylele
2fff7f897b file_sys: add Self NCCH archive 2017-02-13 13:57:38 +02:00
Yuri Kunde Schlesner
c99b5e3122 Merge pull request #2249 from Subv/sessions_v3
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
2016-12-14 20:35:33 -08:00
Subv
06b2b80d31 Return an error code when connecting to a saturated port.
The error code was taken from the 3DS kernel.
2016-12-05 13:59:57 -05:00
wwylele
1e4a1598fd FileSys: Implement OtherSaveData 2016-11-29 23:50:00 +02:00
wwylele
a14bab3b8b FileSys: add SDMCWriteOnlyArchive 2016-11-19 18:55:34 +02:00
wwylele
4a80f45637 FileSys: add ExtSaveDataArchive
ExtSaveData is more similar to SaveData, so let it be a subclass of SaveData
2016-11-19 18:24:37 +02:00
wwylele
420091d0e5 FileSys: add SaveDataArchive
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-11-19 17:17:19 +02:00
Emmanuel Gil Peyrot
1138ec0d49 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner
1e4a5da9f4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
628ed4376a Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
JamePeng
c7d5fee7fb Fix the errorcode of archive handle 2016-07-05 00:39:09 +08:00
wwylele
ce3e33ef50 Result: fix and update ErrorModule 2016-06-30 11:26:53 +03:00
mailwl
ee188dbdc6 gsp::gpu: Reset g_thread_id in UnregisterInterruptRelayQueue 2016-06-01 09:40:15 +03:00
Subv
54871800a9 Kernel: Implemented shared memory permissions. 2016-05-12 20:01:26 -05:00
Emmanuel Gil Peyrot
c39a267974 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
MerryMage
70d1edf9c9 DSP_DSP: Add return IPC headers 2016-04-27 06:35:08 +01:00
purpasmart96
b1a0f498f2 GSP: Return proper error codes for register writes 2016-03-30 18:31:49 -07:00
Subv
9773d90363 HLE/FS: Implemented GetFormatInfo
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-20 14:30:01 -05:00
Subv
bbbdb660af HLE/FS: Return the proper error codes on file Read/Write operations.
These operations are limited by the open flags specified while opening the file.
2016-03-20 14:28:17 -05:00
Subv
33fe4fe894 HLE/FS: Corrected the error codes for CreateFile 2016-03-20 14:28:10 -05:00
Yuri Kunde Schlesner
16cb116917 core: Use unrestricted union to hold storage of ResultVal value 2016-03-05 00:13:20 -08:00
MerryMage
867c111e99 BitField: Make trivially copyable and remove assignment operator 2016-02-12 19:51:16 +00:00