pragma once and symbolic links

  • Thread starter Thread starter ilya klyuchnikov
  • Start date Start date
I

ilya klyuchnikov

Guest
Hello, I am working on VS native toolchain support for buck build tool (A fast build tool) at facebook.

MSDN encourages developers to use `#pragma once` directive (once). However, VS handles `#pragma once` very differently from gcc and clang when working with symbolic links.

Suppose that I have a directory with a `foo.h` and a symlink `bar.h` to `foo.h`:

> dir
<SYMLINK> bar.h [foo.h]
foo.h



Foo.h uses pragma once directive. Suppose now main.c:

#include "foo.h"
#include "bar.h"

Clang and gcc will include the content of foo.h once (they understand symlinks). However, VS cl.exe includes both the original file and the symlinked file. Is it the intended behavior with symlinks?

(Having cl.exe behaving differently from clang and gcc in such a basic case is really painful for big cross-platform projects.)

Continue reading...
 
Back
Top