From c0fc58a08962a04e083e3050c9172b18f62eab60 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Fri, 4 Sep 2020 13:30:10 -0700 Subject: [PATCH] =?UTF-8?q?[GCDAProfiling]=20Suppress=20-Wprio-ctor-dtor?= =?UTF-8?q?=20for=20GCC>=3D9=20and=20remove=20unuse=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …d write_string/length_of_string The `__attribute__((destructor(100)))` diagnostic does not have a warning option in GCC 8 (before r264853) and thus cannot be suppressed. -- ported from llvm/llvm-project fix: https://github.com/llvm/llvm-project/commit/1cfde143e82aeb47cffba436ba7b5302d8e14193 https://bugs.llvm.org/show_bug.cgi?id=47399 (Fixes problem behind https://github.com/rust-lang/rust/pull/76224) --- compiler-rt/lib/profile/GCDAProfiling.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index 57d8dec423cc0..82369357e9861 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c @@ -210,22 +210,6 @@ static void write_64bit_value(uint64_t i) { write_32bit_value(hi); } -static uint32_t length_of_string(const char *s) { - return (strlen(s) / 4) + 1; -} - -// Remove when we support libgcov 9 current_working_directory. -#if !defined(_MSC_VER) && defined(__clang__) -__attribute__((unused)) -#endif -static void -write_string(const char *s) { - uint32_t len = length_of_string(s); - write_32bit_value(len); - write_bytes(s, strlen(s)); - write_bytes("\0\0\0\0", 4 - (strlen(s) % 4)); -} - static uint32_t read_32bit_value() { uint32_t val; @@ -632,6 +616,9 @@ void llvm_writeout_files(void) { // __attribute__((destructor)) and destructors whose priorities are greater than // 100 run before this function and can thus be tracked. The priority is // compatible with GCC 7 onwards. +#if __GNUC__ >= 9 +#pragma GCC diagnostic ignored "-Wprio-ctor-dtor" +#endif __attribute__((destructor(100))) #endif static void llvm_writeout_and_clear(void) {