Skip to content
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

Android target issues #755

Merged
merged 5 commits into from
Dec 22, 2016

Conversation

gonzalolarralde
Copy link
Contributor

This PR fixes a few issues when trying to compile for Android target.

Adding comments inline.

#define __checkint_int64_mul(x, y, err) __check_int64_mul(x, y, err)
#define __checkint_int32_mul(x, y, err) __check_int32_mul(x, y, err)
#define __checkint_uint64_add(x, y, err) __check_uint64_add(x, y, err)
#define __checkint_uint32_add(x, y, err) __check_uint32_add(x, y, err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason when the __checkint_ shim macros are defined in CFSortFunctions.c, the prefix used is __check_ instead of __checkint_, and then only the used references are redefined as __checkint_. I added the 32 bits version of those references used.

I can rewrite this shim macros with the prefix __checkint_, as for what I see here they're not used anywhere else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a stub until it can actually be done correctly to actually check... so looks fine to me

@@ -894,7 +894,6 @@ void CFLog1(CFLogLevel lev, CFStringRef message) {
if (maxLength > sizeof(stack_buffer) / sizeof(stack_buffer[0])) {
buffer = calloc(sizeof(char), maxLength);
if (!buffer) {
- __android_log_print(ANDROID_LOG_ERROR, tag, "Unable to allocate %d bytes for log message - truncating.", (int)axLength);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnno1962 @phausler for what I understand the intention in this commit was to remove this line. Is this correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh if the calloc fails bigger problems are going to happen down the road anyhow.

My opinion is just let it fail. It is not like this is a recoverable path or a container like Data

@@ -894,7 +894,6 @@ void CFLog1(CFLogLevel lev, CFStringRef message) {
if (maxLength > sizeof(stack_buffer) / sizeof(stack_buffer[0])) {
buffer = calloc(sizeof(char), maxLength);
if (!buffer) {
- __android_log_print(ANDROID_LOG_ERROR, tag, "Unable to allocate %d bytes for log message - truncating.", (int)axLength);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh if the calloc fails bigger problems are going to happen down the road anyhow.

My opinion is just let it fail. It is not like this is a recoverable path or a container like Data

@@ -27,8 +27,10 @@
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
#include <dirent.h>
#include <unistd.h>
#if !TARGET_OS_ANDROID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't Android have it as #include <fcntl.h>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. It was already in the same file, 10 lines before this.

#define __checkint_int64_mul(x, y, err) __check_int64_mul(x, y, err)
#define __checkint_int32_mul(x, y, err) __check_int32_mul(x, y, err)
#define __checkint_uint64_add(x, y, err) __check_uint64_add(x, y, err)
#define __checkint_uint32_add(x, y, err) __check_uint32_add(x, y, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a stub until it can actually be done correctly to actually check... so looks fine to me

@phausler
Copy link
Contributor

@swift-ci please test

@phausler phausler merged commit 2611dcd into swiftlang:master Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants