Skip to content

Commit 8052dc3

Browse files
author
Andrew Hsieh
committed
Make libportable.a compile on host
where cutils/log.h doesn't exit Change-Id: I0ed6389a28f419f90ccbc6719b72895b366bb611
1 parent 7b9e308 commit 8052dc3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ndk/sources/android/libportable/common/include/log_portable.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,18 @@ static inline char *portable_tag() {
8181
_rv; /* Returned to caller */ \
8282
})
8383

84-
# include <cutils/log.h>
84+
#if !defined(HAS_NO_LOG_H)
85+
#include <cutils/log.h>
8586

8687
# define PERROR(str) { \
8788
ALOGE("%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno)); \
8889
}
8990

9091
# define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \
9192
#cond, __FILE__, __LINE__, __func__);
93+
#else
9294

95+
# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno))
96+
# define ASSERT(cond) assert(cond)
97+
98+
#endif

0 commit comments

Comments
 (0)