[PATCH] D62115: fix a issue that clang is incompatible with gcc with -H option.

Kan Shengchen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 04:35:29 PDT 2019


skan added a comment.

In D62115#1511407 <https://reviews.llvm.org/D62115#1511407>, @kimgr wrote:

> Also, consider `././Inputs/empty.h`.


Firstly, on linux
write the `clang_H_opt.c` file as

  #include "../Index/Inputs/empty.h"
  #include "Inputs/empty.h"
  #include "./Inputs/empty.h"
  #include "././Inputs/empty.h"

Then compile it with command `gcc -H -fsyntax-only clang_H_opt.c 2>&1`, 
output:

  . ../Index/Inputs/empty.h
  . Inputs/empty.h
  . ./Inputs/empty.h
  . ././Inputs/empty.h

compile it with command `clang -H -fsyntax-only clang_H_opt.c 2>&1` will get the same result . So i think there is no need to simplify the existing pathname in `#include` directive.

Secondly, on Win2019
write the `clang_H_opt.c` file as

  #include "..\Index\Inputs\empty.h"
  #include "Inputs/empty.h"
  #include ".\Inputs/empty.h"
  #include ".\.\Inputs/empty.h"

compile it with clang,
output:

  . ..\\Index\\Inputs\\empty.h
  . Inputs\\empty.h
  . .\\Inputs\\empty.h
  . .\\.\\Inputs\\empty.h
  . .\\.\\Inputs\\empty.h

i think the output is appropriate.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62115/new/

https://reviews.llvm.org/D62115





More information about the cfe-commits mailing list