diff options
author | Kai Kang <kai.kang@windriver.com> | 2015-08-26 09:25:25 +0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2015-08-31 20:02:23 +0200 |
commit | 3a92cd036ca878a736b7643e391c123b32e05f16 (patch) | |
tree | 318c4beec875c2a02709d69f2e763e4cdad7fe6c /meta-oe/recipes-benchmark | |
parent | 8023363d8207058c55edc420c7302443cfaaaf75 (diff) | |
download | meta-openembedded-contrib-3a92cd036ca878a736b7643e391c123b32e05f16.tar.gz |
libhugetlbfs: avoid using keyword restrict as var name
When compile with gcc 5.x, libhugetlbfs fails with:
| hugeutils.c: In function '__lh_hugetlbfs_setup_env':
| hugeutils.c:304:40: error: expected identifier or '(' before restrict'
| char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE];
| ^
Rename variable to avoid using keyword restrict as variable name to fix it.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-benchmark')
-rw-r--r-- | meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch | 34 | ||||
-rw-r--r-- | meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch new file mode 100644 index 0000000000..b77cfe10e0 --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch @@ -0,0 +1,34 @@ +Avoid using keyword restrict as variable name which causes error with gcc 5.x: + +| hugeutils.c: In function '__lh_hugetlbfs_setup_env': +| hugeutils.c:304:40: error: expected identifier or '(' before 'restrict' +| char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE]; +| ^ + +Upstream-Status: Pending + +Signed-off-by: Kai Kang <kai.kang@windriver.com> +--- +diff --git a/hugeutils.c b/hugeutils.c +index 53a7fbd..b9d7001 100644 +--- a/hugeutils.c ++++ b/hugeutils.c +@@ -301,14 +301,14 @@ void hugetlbfs_setup_env() + + env = getenv("HUGETLB_RESTRICT_EXE"); + if (env) { +- char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE]; ++ char *p, *tok, *exe, buf[MAX_EXE+1], restricted[MAX_EXE]; + int found = 0; + + exe = get_exe_name(buf, sizeof buf); + DEBUG("Found HUGETLB_RESTRICT_EXE, this exe is \"%s\"\n", exe); +- strncpy(restrict, env, sizeof restrict); +- restrict[sizeof(restrict)-1] = 0; +- for (p = restrict; (tok = strtok(p, ":")) != NULL; p = NULL) { ++ strncpy(restricted, env, sizeof restricted); ++ restricted[sizeof(restricted)-1] = 0; ++ for (p = restricted; (tok = strtok(p, ":")) != NULL; p = NULL) { + DEBUG(" ...check exe match for \"%s\"\n", tok); + if (strcmp(tok, exe) == 0) { + found = 1; diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb index ae5e46a464..b7cc4162aa 100644 --- a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +++ b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb @@ -18,6 +18,7 @@ SRC_URI = " \ file://tests-Makefile-install-static-4G-edge-testcases.patch \ file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ + file://libhugetlbfs-avoid-using-restrict-as-var-name.patch \ " S = "${WORKDIR}/git" |