[libc-commits] [PATCH] D142921: [libc] Fix reusing/redefining `FPBits` symbols.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jan 31 21:32:19 PST 2023


sivachandra added a comment.

I think the best understanding of the problem comes from these two links:

clang allows it: https://godbolt.org/z/z5rWhzKET
gcc complains: https://godbolt.org/z/T6dvxTWKv

GCC's error message is actually very suggestive. IIUC, it is saying that we are changing the meaning of the type named `S` within the scope of the `U` (it is easy to see the problem is `U` were the global namespace). I think the older version of the code linked to in the bug had this problem: https://github.com/llvm/llvm-project/blob/d883a4ad02d867e7037bd4ec342016c402484148/libc/src/__support/FPUtil/except_value_utils.h

IMHO, it is very subtle. The problem code redefined the type names within the namespace `__llvm_libc::fputil`. But, I think the current code does not have any such instances - the renames are happening in the namespace `__llvm_libc`. So, my guess is that that is why we are not seeing similar errors with GCC anymore. Considering that we do have a GCC bot, do we really want to "fix"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142921



More information about the libc-commits mailing list