-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: C++20 migration (again^3) #5514
Conversation
0d09b35
to
5be4ecc
Compare
a58f4e0
to
02ac5dc
Compare
also 1) fix incomplete achievement_requirement 2) remove user defined copy constructor: error: definition of implicit copy assignment operator for 'point_with_value' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] Co-authored-by: AngelicosPhosphoros <angelicos.phosphoros@protonmail.com>
cannot use spaceship operator until llvm/llvm-project#43670
1. add `concepts_utility.h` for storing useful concepts related headers. 2. uses `Arithmatic` concepts to ensure they're numbers. 3. uses spaceship operator for comparison. 4. uses auto and arrow returns to make templates readable. 5. make fabs and fmod constexpr. Co-authored-by: Coolthulhu <Coolthulhu@gmail.com>
it works as a false positive on spaceship operators `<=>`
02ac5dc
to
f4b8b82
Compare
f4b8b82
to
52f6230
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, just have some questions. The effect the Arithmetic concept has on the templates in units_def.h
is crazy!
info += colorize( vgettext( "Maintainer", "Maintainers", mod->maintainers.size() ), | ||
c_light_blue ) + u8":\u00a0"/*non-breaking space*/ + enumerate_as_string( mod->maintainers ) + "\n"; | ||
c_light_blue ) + | ||
// HACK: Cannot fix that without switching whole project to std::u8string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How painful would it be to change everything to u8string
s?
Might not need to update everything to u8strings, but user-facing stuff might need to be. It's a shame that it "just worked"(tm) in pre-20 but is specialized to u8strings now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like there's no easy solution:
- https://stackoverflow.com/questions/56833000/c20-with-u8-char8-t-and-stdstring/65468019#65468019
- https://old.reddit.com/r/cpp/comments/1csf6n4/c20_why_stdu8string_lacks_support_in_other_c/
- https://stackoverflow.com/questions/55556200/convert-between-stdu8string-and-stdstring
- https://stackoverflow.com/questions/13444930/is-the-u8-string-literal-necessary-in-c11
@@ -137,7 +137,7 @@ void vehicle::add_toggle_to_opts( std::vector<uilist_entry> &options, | |||
name ); | |||
options.emplace_back( -1, allow, key, msg ); | |||
|
|||
actions.emplace_back( [ = ] { | |||
actions.emplace_back( [ =, this ] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does adding this
to the captures change anything about how the lambda functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since c++20 implicit this caputure has been made error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay coolie 👍
passing string directly borks filesystem test on windows
d10a685
to
d2c81eb
Compare
like what's the problem
d2c81eb
to
296467d
Compare
rationale: - spent past 6 hours trying to fix this and failed - currently not worth the effort considering it's not used anywhere in-game
d716a5a
to
10d6c53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than clang-tidy whining about a static assertion error that doesn't come up while actually building, and claims of not being able to find <lua.h>
, both involving sol
I don't see anything else preventing merging. The clang-tidy errors are nonsense.
Will need to look at the filesystem_test issues revolving around remove_tree
and dir_exists
since they only show up as an issue on the windows build. Thankfully remove_tree
is only used as part of this one test and not the game proper.
@@ -9,7 +9,6 @@ | |||
#include "character.h" | |||
#include "color.h" | |||
#include "debug.h" | |||
#include "enums.h" | |||
#include "event.h" | |||
#include "event_statistics.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "event_statistics.h"
and #include "json.h"
are no longer needed in this file since they've been added to achievement.h
struct object_names_collection; | ||
|
||
struct extended_photo_def : public JsonDeserializer, public JsonSerializer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the definition of extended_photo_def
up to here isn't really relevant to the PR scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc it was somewhat related to build error but i forgot
info += colorize( vgettext( "Maintainer", "Maintainers", mod->maintainers.size() ), | ||
c_light_blue ) + u8":\u00a0"/*non-breaking space*/ + enumerate_as_string( mod->maintainers ) + "\n"; | ||
c_light_blue ) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraneous +
at the end of this line
c_light_blue ) + | |
c_light_blue ) |
@@ -34,7 +34,7 @@ | |||
|
|||
// beginning of sol/version.hpp | |||
|
|||
#include <sol/config.hpp> | |||
#include "./config.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than this line that clang-tidy was complaining about the only changes to this file are whitespace. Might be able to discard all changes to this file so clang-tidy skips it and doesn't get mad about something stupid.
Could probably keep it as <sol/config.hpp>
in that case since it has no effect on compilation. Not entirely sure, though :/
@@ -38,7 +38,7 @@ static_assert(false, "sol.hpp must be included via catalua_sol.h"); | |||
|
|||
// beginning of sol/version.hpp | |||
|
|||
#include <sol/config.hpp> | |||
#include "./config.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to forward.hpp
the changes in this file are mostly cosmetic whitespace removals that don't change functionality. Could change back to #include <sol/config.hpp>
while getting rid of all changes to this file and clang-tidy will probably shut up about it.
throw se; | ||
} | ||
} | ||
System.loadLibrary(libraryName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is removing the try-catch block here safe to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, because the original try-catch re-throws exceptions which means it essentially does nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Compiled and loaded a save.
- Saved game and deleted world without issue.
- Created a game without issue.
- Started new game in new world, chargen and entering game world also works fine.
- Saved this new game for good measure too.
Checklist
Required
main
so it won't cause conflict when updatingmain
branch later.Optional
doc/
folder.Purpose of change
continuation of #1624 and #2003 and #2341
<=>
operator and concepts to showcase new C++20 featuresDescribe the solution
10d6c53
(#5514))Describe alternatives you've considered
completely overhaul codebase to use
std::filesystem
? MSVC tests results are really weird, fails even on ascii filesystem tests and not sure whyTesting
intentionally ignoring clang-tidy failures because
Additional context