[all-commits] [llvm/llvm-project] 36df92: [libcxx] Only add -GR- option to MSVC or clang-cl ...

David Spickett via All-commits all-commits at lists.llvm.org
Thu Jul 6 07:47:19 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 36df92dcd9195e002f91390b3dca1a8b66dedfe2
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2023-07-06 (Thu, 06 Jul 2023)

  Changed paths:
    M libcxx/CMakeLists.txt

  Log Message:
  [libcxx] Only add -GR- option to MSVC or clang-cl builds

Previously we added both `-GR-` and `-fno-rtti` if RTTI was disabled.
When building with clang 16.x, that caused this error in part of the build:
clang-16: error: argument unused during compilation: '-G R-' [-Werror,-Wunused-command-line-argument]
I think the strange message is because clang is seeing `R-` as the argument
to `-G`, which is a valid clang option.

`-GR-` is an alternate syntax for the `/GR-` option for MSVC
(the dash means disable RTTI):

This error is sort of fixed by cd18efb61d759405956dbd30e4b5f2720d8e1783
but not intentionally. Also, we'd have to wait for 17.x to benefit from that.

The proper fix here is to only add `-GR-` if we are building with MSVC
or the MSVC-like clang-cl, and add `-fno-rtti` if not.

Reviewed By: #libc, simon_tatham, michaelplatings, ldionne

Differential Revision: https://reviews.llvm.org/D154582

More information about the All-commits mailing list