[all-commits] [llvm/llvm-project] 53d2f4: [CUDA][HIP] warn incompatible redeclare (#77359)

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Mon Jun 10 07:08:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 53d2f4d967838468423715178a8344739d7a63c9
      https://github.com/llvm/llvm-project/commit/53d2f4d967838468423715178a8344739d7a63c9
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2024-06-10 (Mon, 10 Jun 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaCUDA.cpp
    A clang/test/SemaCUDA/function-redclare.cu
    M llvm/docs/CompileCudaWithLLVM.rst

  Log Message:
  -----------
  [CUDA][HIP] warn incompatible redeclare (#77359)

nvcc warns about the following code:

`void f();
__device__ void f() {}`

but clang does not since clang allows device function to overload host
function.

Users want clang to emit similar warning to help code to be compatible
with nvcc.

Since this may cause regression with existing code, the warning is off
by default and can be enabled by -Wnvcc-compat.

It won't cause warning in system headers, even with -Wnvcc-compat.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list