[LLVMdev] [Openmp-dev] OpenMP - C source files which are really c++

Cownie, James H james.h.cownie at intel.com
Thu May 7 07:06:46 PDT 2015


> 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 at intel.com>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)
Tel: +44 117 9071438

-----Original Message-----
From: openmp-dev-bounces at cs.uiuc.edu [mailto:openmp-dev-bounces at cs.uiuc.edu] On Behalf Of C Bergström
Sent: Thursday, May 7, 2015 7:35 AM
Cc: openmp-dev at dcs-maillist2.engr.illinois.edu; cfe-dev; LLVM Developers Mailing List
Subject: [Openmp-dev] 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;
  ^
----------
I previously sent a patch that fixes this and it was completely rejected.

IMHO - This must be fixed
1) C files should be renamed .cxx, .cpp or something correct
or
2) Make .c files be treated as c++ lang in cmake
or
3) Stop using c++(11) inside c files

Please let me know if I'm mistaken. I've only looked at the warnings
and now recent errors as a result.
_______________________________________________
Openmp-dev mailing list
Openmp-dev at dcs-maillist2.engr.illinois.edu
http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-dev mailing list