This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Fix mismatched struct vs class tags.


On 2016-11-30 11:23, John Baldwin wrote:
One other clangism is that clang warns about compiling a .c file in C++. It wants an explicit '-x c++' to force the language mode. However, simply adding this to CXX_FLAGS doesn't work as it is included in both compiling and linking (and for the link it causes clang to try to parse all the object
files as C++ source leading to bizarre errors).

I think you could add it in its own variable:

FORCE_LANG_FLAG = -x c++

and add that to INTERNAL_CFLAGS.

I assume a massive .c -> .cc
(or .cxx, etc.) rename is not in the roadmap (it would presumably be very
disruptive to pending patchsets)?

I think it will have to be done at some point... it will be a bit weird and counter intuitive for newcomers to see .c files containing C++. That, and analysis tools that select the language based on the extension. For example, I use Eclipse CDT for my development, and it assumes C code for .c files by default. I can go change some obscure setting to force it to consider it as C++, but it would be nicer for everybody if we didn't have to do that. Actually, I just checked and it's the same with vim and emacs. If we want to do it right, we would have to rename .h into .hpp or .hh as well. And it would be as painful to do it in 5 years as it would be to do it now, so I don't see why we would wait...

About the merging of pending patches: if I try to apply a patch including a change to a file that was renamed with "git am", it fails. But if with "git rebase", git seems to handle it correctly. So there's hope.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]