-
Notifications
You must be signed in to change notification settings - Fork 536
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
More C++ warnings cleanup + C++17 changes #3574
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azt run |
jonpryor
reviewed
Sep 3, 2019
src/monodroid/jni/android-system.cc
Outdated
@@ -600,8 +607,8 @@ AndroidSystem::setup_environment_from_override_file (const char *path) | |||
size_t nread = 0; | |||
ssize_t r; | |||
do { | |||
size_t i = nread; | |||
r = read (fd, buf + i, file_size - i); | |||
read_count_type read_count = static_cast<read_count_type>(file_size - nread); |
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.
should we start using auto
for instances like this?
A small cleanup which deals with a handful of remaining warnings after enable more extensive diagnostics in our compilers. Deal with `read(2)` definition differences between Android+Unix compilers and MinGW (on *nix the third argument, `count`, is defined to be of type `size_t` while on MinGW it's `unsigned int` which caused an integer conversion warning when building for Windows) Take advantage of the C++17 `if constexpr ()` construct (works similar to the preprocessor `#if{n}def` but is part of the language standard and is type-safe) as well as the more compact (and less of an eyesore) namespace declaration, instead of: namespace xamarin { namespace android { namespace internal we can now use namespace xamarin::android::internal C++17 allows one to declare and define certain static `constexpr` members directly in the header file, without the need to add the definition of such member in a source file somewhere. Take advantage of that.
jonpryor
reviewed
Sep 4, 2019
jonpryor
pushed a commit
that referenced
this pull request
Sep 24, 2019
A small cleanup which deals with a handful of remaining warnings after enabling more extensive diagnostics in our compilers. Deal with **read**(2) definition differences between Android+Unix compilers and MinGW: on *nix the third argument, `count`, is defined to be of type `size_t` while on MinGW it's an `unsigned int`, which caused an integer conversion warning when building for Windows. Take advantage of the C++17 `if constexpr ()` construct (works similar to the preprocessor `#if{n}def` but is part of the language standard and is type-safe) as well as the more compact (and less of an eyesore) namespace declaration; instead of: namespace xamarin { namespace android { namespace internal we can now use namespace xamarin::android::internal C++17 allows one to declare and define certain static `constexpr` members directly in the header file, without the need to add the definition of such member in a source file somewhere. Take advantage of that.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A small cleanup which deals with a handful of remaining warnings after enable
more extensive diagnostics in our compilers.
Deal with
read(2)
definition differences between Android+Unix compilers andMinGW (on *nix the third argument,
count
, is defined to be of typesize_t
while on MinGW it's
unsigned int
which caused an integer conversion warningwhen building for Windows)
Take advantage of the C++17
if constexpr ()
construct (works similar to thepreprocessor
#if{n}def
but is part of the language standard and is type-safe)as well as the more compact (and less of an eyesore) namespace declaration,
instead of:
we can now use
C++17 allows one to declare and define certain static
constexpr
membersdirectly in the header file, without the need to add the definition of such
member in a source file somewhere. Take advantage of that.