Patch 8.2.3770
Problem:    New compiler warnings from clang-12 and clang-13.
Solution:   Adjust CI and suppress some warnings. (Ozaki Kiichi, closes #9314)
Files:      .github/workflows/ci.yml, ci/config.mk.clang-12.sed,
            src/os_unix.c, src/spellfile.c


*** ../vim-8.2.3769/.github/workflows/ci.yml    2021-10-12 12:02:45.359105514 
+0100
--- .github/workflows/ci.yml    2021-12-09 21:03:53.088865942 +0000
***************
*** 75,90 ****
              libtool-bin \
              libsodium-dev
  
!       - name: Install clang-11
          if: matrix.compiler == 'clang'
          run: |
            wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key 
add -
            . /etc/lsb-release
!           sudo add-apt-repository -y "deb 
http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-11 
main"
!           sudo apt-get install -y clang-11 llvm-11
!           sudo update-alternatives --install /usr/bin/clang clang 
/usr/bin/clang-11 100
!           sudo update-alternatives --set clang /usr/bin/clang-11
!           sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov 
/usr/bin/llvm-cov-11 100
  
        - name: Set up environment
          run: |
--- 75,90 ----
              libtool-bin \
              libsodium-dev
  
!       - name: Install clang-13
          if: matrix.compiler == 'clang'
          run: |
            wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key 
add -
            . /etc/lsb-release
!           sudo add-apt-repository -y "deb 
http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-13 
main"
!           sudo apt-get install -y clang-13 llvm-13
!           sudo update-alternatives --install /usr/bin/clang clang 
/usr/bin/clang-13 100
!           sudo update-alternatives --set clang /usr/bin/clang-13
!           sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov 
/usr/bin/llvm-cov-13 100
  
        - name: Set up environment
          run: |
***************
*** 188,193 ****
--- 188,197 ----
            # Append various warning flags to CFLAGS.
            sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
            sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
+           if [[ ${CC} = clang ]]; then
+             # Suppress some warnings produced by clang 12 and later.
+             sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
+           fi
  
        - name: Build
          if: (!contains(matrix.extra, 'unittests'))
***************
*** 296,301 ****
--- 300,309 ----
            sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
            # On macOS, the entity of gcc is clang.
            sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
+           # Suppress some warnings produced by clang 12 and later.
+           if clang --version | grep -qs 'Apple clang version 
\(1[3-9]\|[2-9]\)\.'; then
+             sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
+           fi
  
        - name: Build
          env:
*** ../vim-8.2.3769/ci/config.mk.clang-12.sed   2021-12-09 21:06:42.932398907 
+0000
--- ci/config.mk.clang-12.sed   2021-12-09 20:58:03.405874508 +0000
***************
*** 0 ****
--- 1,3 ----
+ # Clang 12 (or Apple clang 13) and later makes a warning 
'-Wcompound-token-split-by-macro' enable by default.
+ /^PERL_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/
+ /^RUBY_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/
*** ../vim-8.2.3769/src/os_unix.c       2021-12-08 21:00:20.985535798 +0000
--- src/os_unix.c       2021-12-09 20:58:03.405874508 +0000
***************
*** 3376,3382 ****
  }
  
  #ifdef USE_GCOV_FLUSH
! extern void __gcov_flush();
  #endif
  
      void
--- 3376,3390 ----
  }
  
  #ifdef USE_GCOV_FLUSH
! # if (defined(__GNUC__) \
!           && ((__GNUC__ == 11 && __GNUC_MINOR__ >= 1) || (__GNUC__ >= 12))) \
!       || (defined(__clang__) && (__clang_major__ >= 12))
! extern void __gcov_dump(void);
! extern void __gcov_reset(void);
! #  define __gcov_flush() do { __gcov_dump(); __gcov_reset(); } while (0)
! # else
! extern void __gcov_flush(void);
! # endif
  #endif
  
      void
*** ../vim-8.2.3769/src/spellfile.c     2021-12-05 22:19:22.836153466 +0000
--- src/spellfile.c     2021-12-09 20:58:03.405874508 +0000
***************
*** 6576,6582 ****
      char_u    *p;
      int               len;
      int               totlen;
!     size_t    x = 1;  // collect return value of fwrite()
  
      if (fd != NULL)
        put_bytes(fd, (long_u)gap->ga_len, 2);      // <prefcondcnt>
--- 6576,6582 ----
      char_u    *p;
      int               len;
      int               totlen;
!     size_t    x UNUSED = 1;  // collect return value of fwrite()
  
      if (fd != NULL)
        put_bytes(fd, (long_u)gap->ga_len, 2);      // <prefcondcnt>
*** ../vim-8.2.3769/src/version.c       2021-12-09 20:54:10.430603951 +0000
--- src/version.c       2021-12-09 21:04:28.412767847 +0000
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     3770,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
23. You can't call your mother... she doesn't have VOIP

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211209210843.B13461C0B28%40moolenaar.net.

Raspunde prin e-mail lui