Skip to content

[libraries] System.Native fails to build with clang-13 #60326

Closed
@lambdageek

Description

@lambdageek

Repro:

  1. Install clang-13 and libicu-dev (I have 67.1-7 on Debian testing)
  2. Compile the native library code.

Expected result: Build succeeds

Actual result: build fails with

/home/aleksey/working/dotnet-runtime/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.c(47,13): error G57817EDC: identifier '__c2' is reserved because it starts with '__' [-Werror,-Wreserved-identifier] [/home/aleksey/working/dotnet-runtime/src/libraries/Native/build-native.proj]
              U16_NEXT(lpSrc, srcIdx, cwSrcLength, srcCodepoint);
              ^
  /usr/include/unicode/utf16.h:311:18: note: expanded from macro 'U16_NEXT'
          uint16_t __c2; \
                   ^

This is happening because -Weverything includes the new -Wreserved-identifier warning (more here)

add_compile_options(-Weverything)


At least ICU and openssl are affected.


There are also warnings about -Wunused-but-set-variable (also new in clang-13) and -Wcast-function-type (doesn't seem new also new in clang-13, though not in the release notes llvm/llvm-project@217f0f7)

/home/aleksey/working/dotnet-runtime/src/libraries/Native/Unix/System.Native/pal_signal.c(629,10): error G6B6BB85B: variable 'installed' set but not used [-Werror,-Wunused-but-set-variable] [/home/aleksey/working/dotnet-runtime/src/libraries/Native/build-native.proj]
      bool installed;
           ^

and

/home/aleksey/working/dotnet-runtime/src/libraries/Native/Unix/System.Native/pal_process.c(374,92): error G8B626BD7: cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type [-Werror,-Wcast-function-type] [/home/aleksey/working/dotnet-runtime/src/libraries/Native/build-native.proj]
                  void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;
                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions