[PATCH] iftop: fix compilation with GCC 10

Felix Fietkau nbd at nbd.name
Fri Jul 17 06:06:12 EDT 2020


On 2020-07-14 07:43, Rosen Penev wrote:
> GCC 10 defaults to fno-common, which demains unique defenitions.
> 
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  package/network/utils/iftop/Makefile          |  2 +-
>  .../utils/iftop/patches/010-gcc10.patch       | 20 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
>  create mode 100644 package/network/utils/iftop/patches/010-gcc10.patch
> 
> diff --git a/package/network/utils/iftop/Makefile b/package/network/utils/iftop/Makefile
> index 98fe15c8f5..aa467c2876 100644
> --- a/package/network/utils/iftop/Makefile
> +++ b/package/network/utils/iftop/Makefile
> @@ -8,7 +8,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=iftop
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git
> diff --git a/package/network/utils/iftop/patches/010-gcc10.patch b/package/network/utils/iftop/patches/010-gcc10.patch
> new file mode 100644
> index 0000000000..882565a039
> --- /dev/null
> +++ b/package/network/utils/iftop/patches/010-gcc10.patch
> @@ -0,0 +1,20 @@
> +--- a/ui_common.h
> ++++ b/ui_common.h
> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
> + 
> + extern options_t options;
> + 
> +-sorted_list_type screen_list;
> +-host_pair_line totals;
> +-int peaksent, peakrecv, peaktotal;
> ++static sorted_list_type screen_list;
> ++static host_pair_line totals;
> ++static int peaksent, peakrecv, peaktotal;
> + extern history_type history_totals;
> +-hash_type* screen_hash;
> +-hash_type* service_hash;
> ++static hash_type* screen_hash;
> ++static hash_type* service_hash;
Declaring these variables as static in a header file seems wrong to me.
Shouldn't this be declared as a global variable in one of the .c files
and extern here?

- Felix



More information about the openwrt-devel mailing list