From 8c0f72667e1a4d378ecda3699d198d56e0ac9498 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 10 Oct 2021 21:56:49 +0200 Subject: [PATCH] Fix the ramaining easily fixable warnings with clang There's one remaining memalign2.c:29:9: warning: unused variable 'piece' [-Wunused-variable] because of a block of #if FreeBSD for memalign that looks unnecessary Otherwise all that is left is a few like warning: unknown warning option '-Wno-alloc-size-larger-than'; did you mean '-Wno-frame-larger-than='? [-Wunknown-warning-option] because there is no standard for compiler arguments. --- coregrind/m_gdbserver/valgrind-low-nanomips.c | 1 + drd/tests/tc12_rwl_trivial.stderr.exp | 2 +- helgrind/tests/safe-pthread.h | 1 + helgrind/tests/safe-semaphore.h | 1 + massif/tests/Makefile.am | 4 ++++ memcheck/tests/Makefile.am | 7 +++++-- none/tests/Makefile.am | 1 + none/tests/amd64/sbbmisc.c | 2 +- none/tests/x86/sbbmisc.c | 2 +- 9 files changed, 16 insertions(+), 5 deletions(-) diff --git a/coregrind/m_gdbserver/valgrind-low-nanomips.c b/coregrind/m_gdbserver/valgrind-low-nanomips.c index e8ed36400b..77a4190fe0 100644 --- a/coregrind/m_gdbserver/valgrind-low-nanomips.c +++ b/coregrind/m_gdbserver/valgrind-low-nanomips.c @@ -107,6 +107,7 @@ void set_pc (CORE_ADDR newpc) #define itype_rt(x) ((x >> 16) & 0x1f) #define rtype_funct(x) (x & 0x3f) +static inline UInt getUInt(UChar * p) __attribute__((unused)); /* Do a endian load of a 32-bit word, regardless of the endianness of the underlying host. */ static inline UInt getUInt(UChar * p) diff --git a/drd/tests/tc12_rwl_trivial.stderr.exp b/drd/tests/tc12_rwl_trivial.stderr.exp index 73163e7b23..b2d4048ab6 100644 --- a/drd/tests/tc12_rwl_trivial.stderr.exp +++ b/drd/tests/tc12_rwl_trivial.stderr.exp @@ -1,7 +1,7 @@ Reader-writer lock not locked by calling thread: rwlock 0x......... at 0x........: pthread_rwlock_unlock (drd_pthread_intercepts.c:?) - by 0x........: safe_pthread_rwlock_unlock (safe-pthread.h:58) + by 0x........: safe_pthread_rwlock_unlock (safe-pthread.h:59) by 0x........: main (tc12_rwl_trivial.c:29) rwlock 0x........ was first observed at: at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?) diff --git a/helgrind/tests/safe-pthread.h b/helgrind/tests/safe-pthread.h index 0a2c813237..788f7b89b6 100644 --- a/helgrind/tests/safe-pthread.h +++ b/helgrind/tests/safe-pthread.h @@ -28,6 +28,7 @@ static void segv_handler( int signum, siginfo_t *siginfo, void *sigcontext ) { siglongjmp( env, EPERM ); } +static int safe_pthread_rwlock_unlock( pthread_rwlock_t *rwlock ) __attribute__((unused)); /* * Wrapper for pthread_rwlock_unlock which may execute xend * unconditionally when used on a lock that is not locked. diff --git a/helgrind/tests/safe-semaphore.h b/helgrind/tests/safe-semaphore.h index 3aa0dc4e4c..c0e003bcbc 100644 --- a/helgrind/tests/safe-semaphore.h +++ b/helgrind/tests/safe-semaphore.h @@ -14,6 +14,7 @@ static void abrt_handler( int signum, siginfo_t *siginfo, void *sigcontext ) { siglongjmp( env, EINVAL ); } +static int safe_sem_post( sem_t *sem ) __attribute__((unused)); static int safe_sem_post( sem_t *sem ) { struct sigaction sa; struct sigaction oldsa; diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am index 54814fb6bf..5b3d1938f4 100644 --- a/massif/tests/Makefile.am +++ b/massif/tests/Makefile.am @@ -88,6 +88,10 @@ AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # C++ tests new_cpp_SOURCES = new-cpp.cpp overloaded_new_SOURCES = overloaded-new.cpp +# pre C++11 compilers don't have exception specs +# C++11 and later compilers may complain about not having +# exception specs +overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) -Wno-implicit-exception-spec-mismatch -Wno-missing-exception-spec # Suppress warnings for issues we are testing for alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index f6b97f53d3..4d0476e2df 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -584,7 +584,8 @@ origin6_fp_CFLAGS = $(AM_CFLAGS) -O # Don't allow GCC to inline memcpy() and strcpy(), # because then we can't intercept it -overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy -fno-builtin-strcpy +overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy -fno-builtin-strcpy \ + -Wno-fortify-source resvn_stack_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ @@ -602,6 +603,7 @@ endif str_tester_CFLAGS = $(AM_CFLAGS) -Wno-shadow -Wno-stringop-overflow \ -Wno-stringop-truncation \ + -Wno-fortify-source -Wno-suspicious-bzero \ @FLAG_W_NO_MEMSET_TRANSPOSED_ARGS@ supp_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ @@ -702,5 +704,6 @@ xml1_CFLAGS = $(AM_CFLAGS) -D_GNU_SOURCE if HAVE_ALIGNED_CXX_ALLOC check_PROGRAMS += cxx17_aligned_new cxx17_aligned_new_SOURCES = cxx17_aligned_new.cpp -cxx17_aligned_new_CXXFLAGS = -std=c++17 +# need C++ 17, and we deliberately mismatch new and delete +cxx17_aligned_new_CXXFLAGS = -std=c++17 -Wno-mismatched-new-delete endif diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 7ac07c68d5..24a81b3be9 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -303,6 +303,7 @@ fdleak_creat_LDADD = -lsocket -lnsl fdleak_socketpair_LDADD = -lsocket -lnsl endif floored_LDADD = -lm +ifunc_CFLAGS = $(AM_CFLAGS) -Wno-unused-function manythreads_LDADD = -lpthread if VGCONF_OS_IS_DARWIN nestedfns_CFLAGS = $(AM_CFLAGS) -fnested-functions diff --git a/none/tests/amd64/sbbmisc.c b/none/tests/amd64/sbbmisc.c index f82cc6ba09..82b5db0ce2 100644 --- a/none/tests/amd64/sbbmisc.c +++ b/none/tests/amd64/sbbmisc.c @@ -401,7 +401,7 @@ int main ( void ) adc_ib_al(); printf("r8 = %d %d\n", (int)out_b1, (int)out_b2); - in_w = 49999; + in_w = -15537; adc_iw_ax(); printf("r9 = %d %d\n", (int)out_w1, (int)out_w2); diff --git a/none/tests/x86/sbbmisc.c b/none/tests/x86/sbbmisc.c index f9e7f901ca..6e3822cb38 100644 --- a/none/tests/x86/sbbmisc.c +++ b/none/tests/x86/sbbmisc.c @@ -252,7 +252,7 @@ int main ( void ) adc_ib_al(); printf("r8 = %d %d\n", (int)out_b1, (int)out_b2); - in_w = 49999; + in_w = -15537; adc_iw_ax(); printf("r9 = %d %d\n", (int)out_w1, (int)out_w2); -- 2.47.2