clang warning fix for #8338

Unlike some other warnings, clang does not have a `stringop-overflow` group so it doesn't recognize the `#pragma GCC ...` directive in #8338
This commit is contained in:
Jeffrey Ryan 2022-05-27 19:48:59 -05:00
parent 9750e1fa10
commit fb3f7cebbf
1 changed files with 4 additions and 0 deletions

View File

@ -44,12 +44,16 @@ reverse_bytes(signed char size, char *address){
char * first = address; char * first = address;
char * last = first + size - 1; char * last = first + size - 1;
for(;first < last;++first, --last){ for(;first < last;++first, --last){
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow=" #pragma GCC diagnostic ignored "-Wstringop-overflow="
#endif
char x = *last; char x = *last;
*last = *first; *last = *first;
*first = x; *first = x;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
} }
} }