]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Suppress clang warning on tst-unique4
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 25 Mar 2022 14:21:33 +0000 (11:21 -0300)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 22 Dec 2024 09:24:16 +0000 (17:24 +0800)
clang warns that the instantiation of the variable is required,
but no definition is available.  They are implemented on
tst-unique4lib.so.

Checked on x86_64-linux-gnu.
Reviewed-by: Sam James <sam@gentoo.org>
elf/tst-unique4.cc
elf/tst-unique4lib.cc

index 575c70d3a126759fffa25aa68cf7329d1c8bee13..46a42f15c28f92e59dc0dd81018d01ecb7e3e757 100644 (file)
@@ -2,7 +2,12 @@
 #include "tst-unique4.h"
 
 #include <cstdio>
+#include <libc-diag.h>
 
+/* clang warns that the instantiation of the variable is required, but no
+   definition is available.  They are implemented on tst-unique4lib.so.  */
+DIAG_PUSH_NEEDS_COMMENT_CLANG;
+DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wundefined-var-template");
 static int a[24] =
   {
     S<1>::i, S<2>::i, S<3>::i, S<4>::i, S<5>::i, S<6>::i, S<7>::i, S<8>::i,
@@ -10,6 +15,7 @@ static int a[24] =
     S<16>::i, S<17>::i, S<18>::i, S<19>::i, S<20>::i, S<21>::i, S<22>::i,
     S<23>::i, S<24>::i
   };
+DIAG_POP_NEEDS_COMMENT_CLANG;
 
 int
 main (void)
index 17a7cdf5677b14481e2029ecd9738ebcd463e3b9..2829e75ceecccc4d45c33b6da7c1df3d18cbde70 100644 (file)
@@ -2,7 +2,7 @@
 #include "tst-unique4.h"
 
 template<int N>
-int S<N>::i = N;
+int S<N>::i __attribute__ ((used)) = N;
 template<int N>
 const int S<N>::j __attribute__ ((used)) = -1;