Reputation: 99408
For example, in this code
int main(int argc, char *argv[])
{
#pragma omp parallel
printf("Hello, world.\n");
return 0;
}
Does preprocessor of gcc modify the C code by replacing the OpenMP directive with some other code?
What is the code like after preprocessing and right before being assembled?
Thanks and regards!
Upvotes: 3
Views: 618
Reputation: 1757
You can do a web search and find papers discussing this topic. I hate to give links because they constantly change, but in this case it is the easiest way to answer your question. Here are two that you can look at:
The Thing from another World (or: How do OpenMP Compilers Work? Part 1), by Michael Klemm
How OpenMP is Compiled, by Barbara Chapman
Hopefully this will answer your question.
Upvotes: 2
Reputation: 54270
I don't know first hand, but it's very unlikely that GCC (or any compiler) will preprocess the code when it encounters those pragmas. Most likely, GCC will just flag that block internally and then generate the appropriate native code. There is no intermediate C++ code.
Upvotes: 1