OpenMP - C source files which are really c++

Am I mistaken in that some .c files must actually be compiled as c++?

In file included from openmp-llvm/runtime/src/kmp_ftn_cdecl.c:16:
openmp-llvm/runtime/src/kmp.h:210:3: warning: redefinition of typedef
'ident_t' is a C11 feature [-Wtypedef-redefinition]
} ident_t;
  ^

C11 != C++11

-eric

Am I mistaken in that some .c files must actually be compiled as c++?

Yes, I think you are mistaken, or, at least, it is not the intention that C files should be compiled as C++.
I think the issue here is related to the forward definition of ident_t in kmp_lock.h

// Forward declaration of ident and ident_t

struct ident;
typedef struct ident ident_t;

and then the real definition in kmp.h.

So, if you want to be exceptionally language-lawyerly you could argue that the typedef redefinition makes this into C++ code, but my view is that it's just buggy C code that happens to be legal in C++.

The correct fix here is therefore to work out a better way of breaking the circular dependency that this is trying to resolve, not to compile all the C code as C++.

-- Jim

James Cownie <james.h.cownie@intel.com>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)
Tel: +44 117 9071438

Am I mistaken in that some .c files must actually be compiled as c++?
Yes, I think you are mistaken, or, at least, it is not the intention that C files should be compiled as C++.
I think the issue here is related to the forward definition of ident_t in kmp_lock.h

// Forward declaration of ident and ident_t

struct ident;
typedef struct ident ident_t;

and then the real definition in kmp.h.

So, if you want to be exceptionally language-lawyerly you could argue that the typedef redefinition makes this into C++ code, but my view is that it’s just buggy C code that happens to be legal in C++.

No, typedef redefinition is still C code, but is only allowed as of C11, like the error message says.