From: Rong Tao <32674962+Rtoax@users.noreply.github.com> Date: Sat, 8 Jan 2022 19:36:00 +0000 (+0800) Subject: reallocarray: eliminate compilation warnings (#3798) X-Git-Tag: v0.24.0~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96aaf1598a9907b4e67d9f45637985662099f899;p=platform%2Fupstream%2Fbcc.git reallocarray: eliminate compilation warnings (#3798) there are compile warnings below for klockstat. ```bash CC klockstat.o klockstat.c: In function ‘print_stats’: klockstat.c:396:12: warning: implicit declaration of function ‘reallocarray’; did you mean ‘realloc’? [-Wimplicit-function-declaration] stats = reallocarray(stats, stats_sz, sizeof(void *)); ^~~~~~~~~~~~ realloc klockstat.c:396:10: warning: assignment to ‘struct stack_stat **’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] stats = reallocarray(stats, stats_sz, sizeof(void *)); ^ BINARY klockstat ``` Defining _GNU_SOURCE fixed the problem. --- diff --git a/libbpf-tools/klockstat.c b/libbpf-tools/klockstat.c index f16b760e..55b4fcf5 100644 --- a/libbpf-tools/klockstat.c +++ b/libbpf-tools/klockstat.c @@ -14,6 +14,9 @@ #include #include #include +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif #include #include #include