Skip to content

Commit 1cfde14

Browse files
committed
[GCDAProfiling] Suppress -Wprio-ctor-dtor for GCC>=9 and remove unused 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.
1 parent 737a450 commit 1cfde14

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

compiler-rt/lib/profile/GCDAProfiling.c

+3-16
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,6 @@ static void write_64bit_value(uint64_t i) {
210210
write_32bit_value(hi);
211211
}
212212

213-
static uint32_t length_of_string(const char *s) {
214-
return (strlen(s) / 4) + 1;
215-
}
216-
217-
// Remove when we support libgcov 9 current_working_directory.
218-
#if !defined(_MSC_VER) && defined(__clang__)
219-
__attribute__((unused))
220-
#endif
221-
static void
222-
write_string(const char *s) {
223-
uint32_t len = length_of_string(s);
224-
write_32bit_value(len);
225-
write_bytes(s, strlen(s));
226-
write_bytes("\0\0\0\0", 4 - (strlen(s) % 4));
227-
}
228-
229213
static uint32_t read_32bit_value() {
230214
uint32_t val;
231215

@@ -632,6 +616,9 @@ void llvm_writeout_files(void) {
632616
// __attribute__((destructor)) and destructors whose priorities are greater than
633617
// 100 run before this function and can thus be tracked. The priority is
634618
// compatible with GCC 7 onwards.
619+
#if __GNUC__ >= 9
620+
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
621+
#endif
635622
__attribute__((destructor(100)))
636623
#endif
637624
static void llvm_writeout_and_clear(void) {

0 commit comments

Comments
 (0)