diff options
author | Martin Liska <mliska@suse.cz> | 2021-11-05 16:50:06 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-11-08 12:52:16 +0100 |
commit | 7553bd35c876efaf8ab0b6661a6102822b99e6e3 (patch) | |
tree | 24540afaa70a5102bee04aadc4a03f4865cdcd81 /gcc/system.h | |
parent | 409767d774c59ee4c3eefca5015ba00539fddc08 (diff) | |
download | gcc-7553bd35c876efaf8ab0b6661a6102822b99e6e3.zip gcc-7553bd35c876efaf8ab0b6661a6102822b99e6e3.tar.gz gcc-7553bd35c876efaf8ab0b6661a6102822b99e6e3.tar.bz2 |
gcov-profile: Fix -fcompare-debug with -fprofile-generate [PR100520]
PR gcov-profile/100520
gcc/ChangeLog:
* coverage.c (coverage_compute_profile_id): Strip .gk when
compare debug is used.
* system.h (endswith): New function.
gcc/testsuite/ChangeLog:
* gcc.dg/pr100520.c: New test.
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h index adde3e2..4ac656c 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -1305,4 +1305,17 @@ startswith (const char *str, const char *prefix) return strncmp (str, prefix, strlen (prefix)) == 0; } +/* Return true if STR string ends with SUFFIX. */ + +static inline bool +endswith (const char *str, const char *suffix) +{ + size_t str_len = strlen (str); + size_t suffix_len = strlen (suffix); + if (str_len < suffix_len) + return false; + + return memcmp (str + str_len - suffix_len, suffix, suffix_len) == 0; +} + #endif /* ! GCC_SYSTEM_H */ |