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.
Eric Christopher
2015-May-07 06:39 UTC
[LLVMdev] OpenMP - C source files which are really c++
C11 != C++11 -eric On Wed, May 6, 2015 at 11:38 PM C Bergström <cbergstrom at pathscale.com> wrote:> 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. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150507/b0834bff/attachment.html>
Cownie, James H
2015-May-07 14:06 UTC
[LLVMdev] [Openmp-dev] OpenMP - C source files which are really c++
> 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.
Justin Bogner
2015-May-07 15:21 UTC
[LLVMdev] OpenMP - C source files which are really c++
On Thursday, May 7, 2015, Cownie, James H <james.h.cownie at intel.com> wrote:> > 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. 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 <javascript:;>> > SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes) > Tel: +44 117 9071438 > > -----Original Message----- > From: openmp-dev-bounces at cs.uiuc.edu <javascript:;> [mailto: > openmp-dev-bounces at cs.uiuc.edu <javascript:;>] On Behalf Of C Bergström > Sent: Thursday, May 7, 2015 7:35 AM > Cc: openmp-dev at dcs-maillist2.engr.illinois.edu <javascript:;>; 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 <javascript:;> > 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. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <javascript:;> http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150507/b65fe857/attachment.html>