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 | |
parent | 8023363d8207058c55edc420c7302443cfaaaf75 (diff) | |
download | meta-openembedded-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>
-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 000000000..b77cfe10e --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | Avoid using keyword restrict as variable name which causes error with gcc 5.x: | ||
2 | |||
3 | | hugeutils.c: In function '__lh_hugetlbfs_setup_env': | ||
4 | | hugeutils.c:304:40: error: expected identifier or '(' before 'restrict' | ||
5 | | char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE]; | ||
6 | | ^ | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
11 | --- | ||
12 | diff --git a/hugeutils.c b/hugeutils.c | ||
13 | index 53a7fbd..b9d7001 100644 | ||
14 | --- a/hugeutils.c | ||
15 | +++ b/hugeutils.c | ||
16 | @@ -301,14 +301,14 @@ void hugetlbfs_setup_env() | ||
17 | |||
18 | env = getenv("HUGETLB_RESTRICT_EXE"); | ||
19 | if (env) { | ||
20 | - char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE]; | ||
21 | + char *p, *tok, *exe, buf[MAX_EXE+1], restricted[MAX_EXE]; | ||
22 | int found = 0; | ||
23 | |||
24 | exe = get_exe_name(buf, sizeof buf); | ||
25 | DEBUG("Found HUGETLB_RESTRICT_EXE, this exe is \"%s\"\n", exe); | ||
26 | - strncpy(restrict, env, sizeof restrict); | ||
27 | - restrict[sizeof(restrict)-1] = 0; | ||
28 | - for (p = restrict; (tok = strtok(p, ":")) != NULL; p = NULL) { | ||
29 | + strncpy(restricted, env, sizeof restricted); | ||
30 | + restricted[sizeof(restricted)-1] = 0; | ||
31 | + for (p = restricted; (tok = strtok(p, ":")) != NULL; p = NULL) { | ||
32 | DEBUG(" ...check exe match for \"%s\"\n", tok); | ||
33 | if (strcmp(tok, exe) == 0) { | ||
34 | found = 1; | ||
diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb index ae5e46a46..b7cc4162a 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 = " \ | |||
18 | file://tests-Makefile-install-static-4G-edge-testcases.patch \ | 18 | file://tests-Makefile-install-static-4G-edge-testcases.patch \ |
19 | file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ | 19 | file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ |
20 | file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ | 20 | file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ |
21 | file://libhugetlbfs-avoid-using-restrict-as-var-name.patch \ | ||
21 | " | 22 | " |
22 | 23 | ||
23 | S = "${WORKDIR}/git" | 24 | S = "${WORKDIR}/git" |