summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2018-04-11 00:25:43 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2018-04-11 00:25:43 +0800
commit018fdeaf3d18086c517390e678dcfac05639cd18 (patch)
tree30468e3e0000f737dd5f6c25c3c72b312f33609f
parent23ae1e3992caf254128e03d640119e4ed1697eca (diff)
downloadstringbench-018fdeaf3d18086c517390e678dcfac05639cd18.tar.gz
Fix compiling problem reported with P Preview
Change-Id: I628c060557362920a45256f554d9814e8bfdc222 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--Android.mk2
-rw-r--r--dhry_1.c10
-rw-r--r--harness.c16
-rw-r--r--stringbench.c2
4 files changed, 17 insertions, 13 deletions
diff --git a/Android.mk b/Android.mk
index c8ae07c..08428f7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,6 +13,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_CFLAGS += -std=gnu99
+LOCAL_CFLAGS += "-D__unused=__attribute__((unused))"
include $(BUILD_EXECUTABLE)
@@ -31,6 +32,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_CFLAGS += -std=gnu99
+LOCAL_CFLAGS += "-D__unused=__attribute__((unused))"
include $(BUILD_EXECUTABLE)
diff --git a/dhry_1.c b/dhry_1.c
index 54cc1f5..4e6a6bb 100644
--- a/dhry_1.c
+++ b/dhry_1.c
@@ -114,7 +114,7 @@ int Int_Glob;
/* end of variables for time measurement */
- void main (int argc, char *argv[])
+ int main (int argc, char *argv[])
/*****/
/* main program, corresponds to procedures */
@@ -131,7 +131,7 @@ int Int_Glob;
Str_30 Str_2_Loc;
REG int Run_Index;
REG int Number_Of_Runs;
- int endit, count = 10;
+ int /*endit, */count = 10;
FILE *Ap;
char general[9][80] = {" "};
@@ -540,7 +540,7 @@ int Int_Glob;
fprintf (Ap, "%10d\n", Arr_2_Glob[8][7]);
fprintf (Ap, "Ptr_Glob-> \n");
- fprintf (Ap, " Ptr_Comp: * %x\n", (long) Ptr_Glob->Ptr_Comp);
+ fprintf (Ap, " Ptr_Comp: * %lx\n", (long) Ptr_Glob->Ptr_Comp);
fprintf (Ap, " Discr: ");
if (Ptr_Glob->Discr == 0) fprintf (Ap, "O.K. ");
@@ -566,7 +566,7 @@ int Int_Glob;
fprintf (Ap, "%s\n", Ptr_Glob->variant.var_1.Str_Comp);
fprintf (Ap, "Next_Ptr_Glob-> \n");
- fprintf (Ap, " Ptr_Comp: * %x", (long) Next_Ptr_Glob->Ptr_Comp);
+ fprintf (Ap, " Ptr_Comp: * %lx", (long) Next_Ptr_Glob->Ptr_Comp);
fprintf (Ap, " same as above\n");
fprintf (Ap, " Discr: ");
@@ -654,6 +654,8 @@ int Int_Glob;
printf("Press any key to exit\n");
printf ("\nIf this is displayed you must close the window in the normal way\n");
}
+
+ return 0;
}
diff --git a/harness.c b/harness.c
index 4af8bd0..d47abb5 100644
--- a/harness.c
+++ b/harness.c
@@ -77,7 +77,7 @@ static void empty(volatile char *against)
}
/** Stub that does nothing. Used for calibrating */
-static void xbounce(void *dest, void *src, size_t n)
+static void xbounce(void *dest __unused, void *src __unused, size_t n __unused)
{
SPOIL(0);
}
@@ -89,31 +89,31 @@ static void xmemcpy(void *dest, void *src, size_t n)
}
/** Stub that calls memset */
-static void xmemset(void *dest, void *src, size_t n)
+static void xmemset(void *dest, void *src __unused, size_t n)
{
SPOIL(memset(dest, 0, n));
}
/** Stub that calls strcpy */
-static void xstrcpy(void *dest, void *src, size_t n)
+static void xstrcpy(void *dest, void *src, size_t n __unused)
{
SPOIL(strcpy(dest, src));
}
/** Stub that calls strlen */
-static void xstrlen(void *dest, void *src, size_t n)
+static void xstrlen(void *dest, void *src __unused, size_t n __unused)
{
SPOIL(strlen(dest));
}
/** Stub that calls strcmp */
-static void xstrcmp(void *dest, void *src, size_t n)
+static void xstrcmp(void *dest, void *src, size_t n __unused)
{
SPOIL(strcmp(dest, src));
}
/** Stub that calls strchr */
-static void xstrchr(void *dest, void *src, size_t n)
+static void xstrchr(void *dest __unused, void *src, size_t n)
{
/* Put the character at the end of the string and before the null */
((char *)src)[n-1] = 32;
@@ -121,7 +121,7 @@ static void xstrchr(void *dest, void *src, size_t n)
}
/** Stub that calls memchr */
-static void xmemchr(void *dest, void *src, size_t n)
+static void xmemchr(void *dest __unused, void *src, size_t n)
{
/* Put the character at the end of the block */
((char *)src)[n-1] = 32;
@@ -139,7 +139,7 @@ static const struct test tests[] =
{ "strcmp", xstrcmp },
{ "strcpy", xstrcpy },
{ "strlen", xstrlen },
- { NULL }
+ { NULL, NULL }
};
/** Show basic usage */
diff --git a/stringbench.c b/stringbench.c
index 804d76c..7dcc9fd 100644
--- a/stringbench.c
+++ b/stringbench.c
@@ -6,7 +6,7 @@
#define START gettimeofday(&tv1, 0);
#define END(x) gettimeofday(&tv2, 0); t1 = ((double)tv1.tv_sec)+((double)tv1.tv_usec)/1000000.0; t2 = ((double)tv2.tv_sec)+((double)tv2.tv_usec)/1000000.0; printf("%s: %f seconds\n", x, t2-t1)
-int main(int argc, char **argv) {
+int main(int argc __unused, char **argv __unused) {
struct timeval tv1, tv2;
double t1, t2;
char * const s = (char * const) malloc(16);