[cfe-dev] Duplicated header between Clang and MSVC - why?

Gaier, Bjoern via cfe-dev cfe-dev at lists.llvm.org
Sun Oct 6 23:41:17 PDT 2019


Thank you David and Reid!

The background for this question is, that I we have a tool that creates C code – then it runs Clang-Cl as an external tool to create object files. The user however will not have a full C/C++ development environment so we planed on only “shipping” the needed header files. For some tests I used all Visual Studio headers and everything compiled fine – I simply added all paths with -I

So if I have a ‘duplicated’ header, would it be better to use the Clang header? Or should I include both header in the search path?

Kind greetings and thank you again
Björn

From: Reid Kleckner <rnk at google.com>
Sent: 03 October 2019 23:27
To: David Blaikie <dblaikie at gmail.com>
Cc: Gaier, Bjoern <Bjoern.Gaier at horiba.com>; cfe-dev at lists.llvm.org
Subject: Re: [cfe-dev] Duplicated header between Clang and MSVC - why?

On Tue, Oct 1, 2019 at 11:58 PM Gaier, Bjoern via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
Hello Clang-Experts,

I’m using Clang-CL in Visual Studio – everything is working fine! Hooray!

Glad to hear it! :)

Now I wonder… If I run Clang-CL, should I use the most up to date MSVC header or the Clang one?

If you use clang-cl, it should automatically use some combination of both sets of headers. You can see in vadefs.h, for example, `#include_next` is used like so:
#include_next <vadefs.h>
So both clang and MSVC's vadefs.h header is used.

Why are these files duplicated anyway?

What David said is correct. The headers that clang ships tend to define things that are tightly coupled to the compiler. See the way clang implements the intel intrinsics, for example, by looking at the mmintrin.h header.
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191007/48ea03d3/attachment.html>


More information about the cfe-dev mailing list