Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

improve `-ffile-prefix-map` detection

Open timblechmann opened this issue 3 years ago • 3 comments

Description

the current implementation has two problems:

  • clang-cl does not know -ffile-prefix-map, but it identifies as "Clang", so the compiler will warn about an unknown compiler option
  • xcode's clang however does not identify as "Clang", but as "AppleClang". so -ffile-prefix-map is not passed although it is supported by the compiler

timblechmann avatar Sep 09 '22 07:09 timblechmann

Codecov Report

Merging #2517 (2848c2c) into devel (32eae0e) will increase coverage by 0.03%. The diff coverage is n/a.

:exclamation: Current head 2848c2c differs from pull request most recent head 752743b. Consider uploading reports for the commit 752743b to get more accurate results

@@            Coverage Diff             @@
##            devel    #2517      +/-   ##
==========================================
+ Coverage   91.54%   91.56%   +0.03%     
==========================================
  Files         183      183              
  Lines        7561     7560       -1     
==========================================
+ Hits         6921     6922       +1     
+ Misses        640      638       -2     

codecov[bot] avatar Sep 09 '22 08:09 codecov[bot]

I think it's a bug with CMake if they identify two different compilers, clang and clang-cl, as the same.

https://gitlab.kitware.com/cmake/cmake/-/issues/22668

jbadwaik avatar Sep 09 '22 10:09 jbadwaik

This will need some fixes to the path normalization code in approval tests.

horenmar avatar Sep 17 '22 09:09 horenmar

This will need some fixes to the path normalization code in approval tests.

do you have any pointers for the entry points to do these fixes?

timblechmann avatar Sep 27 '22 00:09 timblechmann

@timblechmann Approval tests run the SelfTest binary and compare the output to a known good one. The implementation is in tools/scripts/approvalTests.py, and the problematic part is in normalizePath function, which looks for the absolute path to the binary in the text output, and if it finds it, it removes prefix.

-ffile-prefix-map also removes the prefix, but uses a slightly different prefix than the approval test normalization. This leads me to an idea; we could instead change the mapping used by -ffile-prefix-map to ${CATCH_DIR}/=, so that the resulting path is the same as what the approval tests want.

horenmar avatar Sep 28 '22 21:09 horenmar