Merge "Switch to a working UTF-8 mb/wc implementation."
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk
index 25e2ed9..cf3d692 100644
--- a/benchmarks/Android.mk
+++ b/benchmarks/Android.mk
@@ -54,4 +54,27 @@
LOCAL_SRC_FILES := $(benchmark_src_files)
include $(BUILD_EXECUTABLE)
+ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
+ifeq ($(TARGET_ARCH),x86)
+LINKER = linker
+NATIVE_SUFFIX=32
+else
+LINKER = linker64
+NATIVE_SUFFIX=64
+endif
+
+bionic-benchmarks-run-on-host: bionic-benchmarks $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
+ if [ ! -d /system -o ! -d /system/bin ]; then \
+ echo "Attempting to create /system/bin"; \
+ sudo mkdir -p -m 0777 /system/bin; \
+ fi
+ mkdir -p $(TARGET_OUT_DATA)/local/tmp
+ cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
+ cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
+ ANDROID_DATA=$(TARGET_OUT_DATA) \
+ ANDROID_ROOT=$(TARGET_OUT) \
+ LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
+ $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks$(NATIVE_SUFFIX) $(BIONIC_BENCHMARKS_FLAGS)
+endif # linux-x86
+
endif # !BUILD_TINY_ANDROID
diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp
index 4311a1d..6d17ec7 100644
--- a/benchmarks/property_benchmark.cpp
+++ b/benchmarks/property_benchmark.cpp
@@ -15,6 +15,9 @@
*/
#include "benchmark.h"
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
@@ -32,10 +35,17 @@
LocalPropertyTestState(int nprops) : nprops(nprops), valid(false) {
static const char prop_name_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_";
- char dir_template[] = "/data/local/tmp/prop-XXXXXX";
+ const char* android_data = getenv("ANDROID_DATA");
+ if (android_data == NULL) {
+ printf("ANDROID_DATA environment variable not set\n");
+ return;
+ }
+ char dir_template[PATH_MAX];
+ snprintf(dir_template, sizeof(dir_template), "%s/local/tmp/prop-XXXXXX", android_data);
char *dirname = mkdtemp(dir_template);
if (!dirname) {
- perror("making temp file for test state failed (is /data/local/tmp writable?)");
+ printf("making temp file for test state failed (is %s/local/tmp writable?): %s\n",
+ android_data, strerror(errno));
return;
}
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index e825ae0..238087b 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -7,7 +7,7 @@
noUpdate = 1
-def cleanupFile( path, original_path):
+def cleanupFile(path, original_path):
"""reads an original header and perform the cleanup operation on it
this functions returns the destination path and the clean header
as a single string"""
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 2c40d7c..2be9532 100644
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -685,9 +685,9 @@
# we have the defined keyword, check the rest
self.i += 1
self.skip_spaces()
- use_parens = 0
+ used_parens = 0
if self.i < self.n and self.tok[self.i].id == tokLPAREN:
- use_parens = 1
+ used_parens = 1
self.i += 1
self.skip_spaces()
@@ -699,7 +699,7 @@
self.throw(CppConstantExpected,i,"### 'defined' must be followed by macro name")
self.i += 1
- if use_parens:
+ if used_parens:
self.expectId(tokRPAREN)
return ("defined", t.value)
@@ -1162,7 +1162,7 @@
return self.directive in ["if","ifdef","ifndef","elif"]
def isInclude(self):
- """checks wether this is a #include directive. if true, then returns the
+ """checks whether this is a #include directive. if true, then returns the
corresponding file name (with brackets or double-qoutes). None otherwise"""
if self.directive != "include":
return None
@@ -1517,15 +1517,20 @@
tokens = tokens[:-1] # remove trailing tokLN
self.blocks = [ Block(tokens) ] + self.blocks
- def replaceTokens(self,replacements=dict()):
- """replace tokens according to the given dict
- """
+ def replaceTokens(self,replacements):
+ """replace tokens according to the given dict"""
for b in self.blocks:
- if (not b.isDirective()) or b.isDefine():
+ made_change = False
+ if b.isInclude() == None:
for tok in b.tokens:
if tok.id == tokIDENT:
if tok.value in replacements:
tok.value = replacements[tok.value]
+ made_change = True
+
+ if made_change and b.isIf():
+ # Keep 'expr' in sync with 'tokens'.
+ b.expr = CppExpr(b.tokens)
class BlockParser:
"""a class used to convert an input source file into a BlockList object"""
@@ -1798,6 +1803,10 @@
#define X
#endif
+#ifndef SIGRTMAX
+#define SIGRTMAX 123
+#endif /* SIGRTMAX */
+
#if 0
#if 1
#define BAD_6
@@ -1817,12 +1826,17 @@
#define X
#endif
+#ifndef __SIGRTMAX
+#define __SIGRTMAX 123
+#endif
+
"""
out = StringOutput()
lines = string.split(text, '\n')
list = BlockParser().parse( CppLinesTokenizer(lines) )
#D_setlevel(2)
+ list.replaceTokens( kernel_token_replacements )
list.optimizeAll( {"__KERNEL__":kCppUndefinedMacro} )
list.write(out)
if out.get() != expected:
diff --git a/libc/kernel/uapi/asm-generic/signal.h b/libc/kernel/uapi/asm-generic/signal.h
index a16622a..e103240 100644
--- a/libc/kernel/uapi/asm-generic/signal.h
+++ b/libc/kernel/uapi/asm-generic/signal.h
@@ -67,7 +67,7 @@
#define SIGUNUSED 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __SIGRTMIN 32
-#ifndef SIGRTMAX
+#ifndef __SIGRTMAX
#define __SIGRTMAX _KERNEL__NSIG
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */