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/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch | |
| 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>
Diffstat (limited to 'meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch')
| -rw-r--r-- | meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch | 34 |
1 files changed, 34 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 @@ | |||
| 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; | ||
