Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dxc downstream change to StringRef.h causes clang warning #7098

Open
nico opened this issue Jan 29, 2025 · 3 comments
Open

dxc downstream change to StringRef.h causes clang warning #7098

nico opened this issue Jan 29, 2025 · 3 comments
Labels
bug Bug, regression, crash
Milestone

Comments

@nico
Copy link

nico commented Jan 29, 2025

Description

When compiling this line https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/llvm/ADT/StringRef.h#L577 in Chromium with a libc++ that has llvm/llvm-project#118167, we get the following compiler diagnostic:

FAILED: 15371519-e5ab-417b-87d7-def1293a582d "./obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj" CXX obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj
err: exit=1
"C:/b/s/w/ir/cipd_bin_packages/cpython3/bin/python3.exe" ../../build/toolchain/clang_code_coverage_wrapper.py --target-os=win --files-to-instrument=../../.code-coverage/files_to_instrument.txt ..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c ../../third_party/dawn/third_party/dxc/lib/Support/Locale.cpp /Foobj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj /nologo /showIncludes:user /winsysroot../../third_party/depot_tools/win_toolchain/vs_files/7393122652 -DLLVM_ASSERTIONS_NO_STRINGS -DLLVM_ASSERTIONS_TRAP -DDCHECK_ALWAYS_ON=1 -DUSE_AURA=1 "-DCR_CLANG_REVISION=\"llvmorg-20-init-17108-g29ed6000-3\"" -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_INSTRUMENTED_WITH_ASAN=0 -DCR_LIBCXX_REVISION=40d7dfa609a8f4936740ffd2b0b0469e732feda5 -DTMP_REBUILD_HACK -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=2 -DWIN32 -D_SECURE_ATL -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DNTDDI_VERSION=NTDDI_WIN10_NI -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_CRT_NONSTDC_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/dawn/third_party/dxc/include -I../../third_party/dawn/third_party/dxc/tools/clang/include -I../../third_party/dawn/third_party/dxc/tools/clang/tools -Igen/third_party/dawn/third_party/gn/dxc/include -I../../third_party/dawn/third_party/dxc/include/llvm/llvm_assert -fno-delete-null-pointer-checks /clang:-fwrapv -fno-ident -fcolor-diagnostics -fmerge-all-constants /Zc:sizedDealloc- -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version=1934 -m64 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern /O2 /clang:-O2 /Oy- /Zc:inline /Gw /clang:-fno-math-errno -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation=true -mllvm -limited-coverage-experimental=true /guard:cf /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang span-ctor-from-string-literal -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang raw-span-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -add-plugin -Xclang raw-ptr-plugin -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ptr-to-stack-allocated -Xclang -plugin-arg-raw-ptr-plugin -Xclang disable-check-raw-ptr-to-stack-allocated-error -Xclang -plugin-arg-raw-ptr-plugin -Xclang raw-ptr-exclude-path=../../third_party/dawn/ -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ptr-fields -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-span-fields -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ref-fields -DUNSAFE_BUFFERS_BUILD -Xclang -add-plugin -Xclang unsafe-buffers -Xclang -plugin-arg-unsafe-buffers -Xclang ../../build/config/unsafe_buffers_paths.txt /W3 /wd4800 /wd4267 -Wno-unused-variable -Wno-c++11-narrowing -Wno-unused-but-set-variable -Wno-misleading-indentation -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wno-cast-function-type -Wno-thread-safety-reference-return -Wno-nontrivial-memcall /WX /std:c++20 -Wno-trigraphs /TP /GR- -I../../third_party/libc++/src/include -Wno-invalid-offsetof -Wenum-compare-conditional -Wno-c++11-narrowing-const-reference -Wno-missing-template-arg-list-after-template-kw -Wno-dangling-assignment-gsl /EHsc /Zc:__cplusplus /Zc:sizedDealloc- -Wno-error -Wno-unknown-pragmas -Wno-shadow -Wno-deprecated-declarations -Wno-deprecated-enum-float-conversion -Wno-extra-semi -Wno-reorder-ctor -Wno-implicit-fallthrough -Wno-header-hygiene -Wno-unused-const-variable -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unreachable-code-return -Wno-unreachable-code-break -Wno-unused-function -Wno-unused-local-typedef -Wno-string-conversion -Wno-macro-redefined -Wno-unreachable-code -Wno-switch -Wno-constant-logical-operand -Wno-microsoft-exception-spec -Wno-inconsistent-missing-override -Wno-enum-compare-conditional -Wno-rtti -Wno-microsoft-extra-qualification -Wno-range-loop-bind-reference -Wno-pessimizing-move -Wno-unused-lambda-capture -Wno-bool-conversion -Wno-enum-compare -Wno-deprecated-copy -Wno-unused-variable -Wno-microsoft-template -Wno-unused-private-field -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -Wno-ambiguous-reversed-operator /Fd"obj/third_party/dawn/third_party/gn/dxc/Support_cc.pdb"
build step: cxx "./obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj"
siso_rule: clang-coverage/cxx
stderr:
In file included from ../../third_party/dawn/third_party/dxc/lib/Support/Locale.cpp:2:
In file included from ../../third_party/dawn/third_party/dxc/include\llvm/Support/Locale.h:5:
../../third_party/dawn/third_party/dxc/include\llvm/ADT/StringRef.h(579,10): error: 'is_nothrow_constructible' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization]
  579 |   struct is_nothrow_constructible <std::string, llvm::StringRef>
      |          ^
../../third_party/libc++/src/include\__type_traits/is_nothrow_constructible.h(24,29): note: marked 'no_specializations' here
   24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_constructible
      |                             ^

Steps to Reproduce

Build with a recent libc++.

@nico nico added bug Bug, regression, crash needs-triage Awaiting triage labels Jan 29, 2025
@damyanp damyanp removed the needs-triage Awaiting triage label Jan 29, 2025
@damyanp damyanp moved this to Triaged in HLSL Triage Jan 29, 2025
@damyanp damyanp added this to the Backlog milestone Jan 29, 2025
@damyanp
Copy link
Member

damyanp commented Jan 29, 2025

I expect that we'll hit this when we pick up the release of clang/libc++ that includes this libc++ change.

In the meantime, we'd happily accept PRs addressing this. Presumably there's been a change in upstream lvm-project that fixes StringRef.h.

@nico
Copy link
Author

nico commented Jan 30, 2025

The diag is in a // HLSL Change Starts section, so upstream doesn't have this problem.

@nico
Copy link
Author

nico commented Jan 30, 2025

Added a while ago in #425 by @marcelolr and reviewed by @tex3d. Y'all probably know better if this is still needed and if there's a standard compliant way of doing it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash
Projects
Status: Triaged
Development

No branches or pull requests

2 participants