- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to compile an Android Kernel and got an error, which seems to be a fault of Intel ICC compiler semantics.
#define for_each_cpu_worker_pool(pool, cpu) \ for ((pool) = &per_cpu(cpu_worker_pools, cpu)[0]; \ (pool) < &per_cpu(cpu_worker_pools, cpu)[NR_STD_WORKER_POOLS]; \ (pool)++)
Where in a code file we have this piece then:
for_each_cpu_worker_pool(pool, cpu) { WARN_ON_ONCE(cpu != smp_processor_id()); mutex_lock(&pool->manager_mutex); spin_lock_irq(&pool->lock);
Which normally should be then replaced like this (plain and simple):
for ((pool) = &per_cpu(cpu_worker_pools, cpu)[0]; (pool) < &per_cpu(cpu_worker_pools, cpu)[NR_STD_WORKER_POOLS]; (pool)++) { WARN_ON_ONCE(cpu != smp_processor_id()); mutex_lock(&pool->manager_mutex); spin_lock_irq(&pool->lock); ...
But instead command line is throwing out this error:
workqueue.c(4989): error: expected a ")" for_each_cpu_worker_pool(pool, cpu) { ^
Can I use some workaround to fix this?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also the Compiler would also fail for a normal C file meant to be used on a Linux host (not necessarily for Android)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That article refers several times to intel c++ cross compiler for Android, mentioning that it is based on clang. Not mentioned is availability of cygwin as well as Linux hosted versions. Nor does it mention in any detail the name of the intel tool which provides it.
Sorry about the way Android spell checker mangles inde .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was indeed puzzled when reading indie instead of inde :)
I recognize that I may be missing vital information:
I don't use INDE by the way (I got Intel Parallel Studio XE from which I just want to use the compiler binaries). I am using a makefile for the compilation of a Kernel in command line. I modified it to use the intel toolchain using a wrapper script, which replaces gcc arguments with intel ones (e.g. stack preserving) or just discards them.
I use /opt/intel/bin/icc as HOST_CC and CC and xild as LD environment variables. Also I followed the instructions of an Intel whitepaper to modify some code lines regarding asm goto instructions or using the always_inline attribute for the kernel sync_core() function.
After some while, it tries to compile a c file named workqueue.c which contains the code snipped as shown in post 1 (the define statement) and it fails with above mentioned errors.
So am I in the wrong forum section or did I miss to include important information?
Also bear with me as I am not very familiar with the whole Intel software suites
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bump
Again - I am using a makefile in conjunction with icc - no INDE, no Parallel Studio, etc.). This seems to be a problem if the compiler executable not recognizing that it has to replace this "for_each_xxx" statement with the for loop, which is defined at the top of the source file.
Any hints at all?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you generate the preprocessed source, and check if everything looks as expected there? From the error message, it appears that there's a syntax error within the {} block following the for_... macro expansion
Use the -E command-line switch to icc/icpc and redirect stdout to a text file. (You need to be in the same directory as the comiplation is running, and use the same command line, except add -E > out.txt -- also if the command line uses -o switch for output, remove that switch from the command line.)
--Melanie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Melanie is correct, I was unable to reproduce the problem with the limited amount of information you provided.
I tried this which compiles fine with icpc version 16.0:
sptxl15-95> cat bug.cpp
#include <vector>
int* pool;
int cpu;
std::vector<int> per_cpu(int,int);
int cpu_worker_pools;
#define NR_STD_WORKER_POOLS 4
#define for_each_cpu_worker_pool(pool, cpu) \
for ((pool) = &per_cpu(cpu_worker_pools, cpu)[0]; \
(pool) < &per_cpu(cpu_worker_pools, cpu)[NR_STD_WORKER_POOLS]; \
(pool)++)
void foo() {
int* pool;
for_each_cpu_worker_pool(pool, cpu)
{
}
}
sptxl15-96> icpc -c bug.cpp
sptxl15-97>
There must be something more going on. You'll need to look at the preprocessed file to figure it out...
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Melanie and Judy,
many thanks for looking into this.
As soon as I am able to reproduce the error, I will let you know. Also I will attach the c-sourcefile in question.
By the way: I'm using icc version 15.0.3
Thanks again!
Alessandro

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page