Context: head -r312942

Generating:

/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o

involves. . .

/usr/src/sys/dev/mlx5/diagnostics.h shows:

struct mlx5_core_diagnostics_entry {
        const char *const desc;
        u16     counter_id;
};

Note the const between * and desc: the pointer
field is declared to be constant.

/usr/src/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
shows:

static void
mlx5e_create_diagnostics(struct mlx5e_priv *priv)
{
        struct mlx5_core_diagnostics_entry entry;
. . .
        for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) {
                entry = mlx5_core_pci_diagnostics_table[x];
. . .
        }
          
        /* create general diagnostics */
        for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) {
                entry = mlx5_core_general_diagnostics_table[x];
 . .
        }
}

which involves assignments to constant pointers: the
desc value is supposed to be constant as things are
declared.

A clang 3.9.1 based build did not complain about this:

# Meta data file 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o.meta
CMD cc -target x86_64-unknown-freebsd12.0 
--sysroot=/usr/obj/amd64_clang/amd64.amd64/usr/src/tmp 
-B/usr/obj/amd64_clang/amd64.amd64/usr/src/tmp/usr/bin  -O2 -pipe  
-fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc  
-I/usr/src/sys/modules/mlx5en/../../ofed/include 
-I/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include 
-DHAVE_KERNEL_OPTION_HEADERS -include 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h -I. 
-I/usr/src/sys -fno-common -g -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer 
-I/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  -mcmodel=kernel 
-mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables 
-ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ 
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wn
 o-error-tautological-compare -Wno-error-empty-body 
-Wno-error-parentheses-equality -Wno-error-unused-function 
-Wno-error-pointer-sign -Wno-error-shift-negative-value  -mno-aes -mno-avx  
-std=iso9899:1999 -Wno-cast-qual -Wno-pointer-arith  -c 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c -o 
mlx5_en_ethtool.o
CMD ctfconvert -L VERSION -g mlx5_en_ethtool.o
CWD 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en
TARGET mlx5_en_ethtool.o
-- command output --


but amd64-xtoolchain-gcc's amd64-gcc got:
(I had CFLAGS.gcc += -v for this.)

# Meta data file 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o.meta
CMD /usr/local/bin/x86_64-unknown-freebsd12.0-gcc -isystem 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include 
-L/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib 
-B/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib 
--sysroot=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp 
-B/usr/local/x86_64-freebsd/bin/  -O2 -pipe  -fno-strict-aliasing -D_KERNEL 
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/mlx5en/../../ofed/include 
-I/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include 
-DHAVE_KERNEL_OPTION_HEADERS -include 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h 
-I. -I/usr/src/sys -fno-common -g -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer 
-I/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG  
-mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  
-fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector 
-gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmiss
 ing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign 
-fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option 
-Wno-unknown-pragmas -Wno-error=address 
-Wno-error=aggressive-loop-optimizations -Wno-error=array-bounds 
-Wno-error=attributes -Wno-error=cast-qual -Wno-error=enum-compare 
-Wno-error=inline -Wno-error=maybe-uninitialized -Wno-error=overflow 
-Wno-error=sequence-point -Wno-error=strict-overflow 
-Wno-error=unused-but-set-variable -Wno-error=misleading-indentation 
-Wno-error=nonnull-compare -Wno-error=shift-overflow 
-Wno-error=tautological-compare  -v -finline-limit=8000 -fms-extensions --param 
inline-unit-growth=100 --param large-function-growth=1000  -std=iso9899:1999 
-Wno-cast-qual -Wno-pointer-arith  -c 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c -o 
mlx5_en_ethtool.o
CMD ctfconvert -L VERSION -g mlx5_en_ethtool.o
CWD 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en
TARGET mlx5_en_ethtool.o
-- command output --
Using built-in specs.
COLLECT_GCC=/usr/local/bin/x86_64-unknown-freebsd12.0-gcc
Target: x86_64-unknown-freebsd12.0
Configured with: 
/usr/obj/portswork/usr/ports/devel/amd64-gcc/work/gcc-6.3.0/configure 
--target=x86_64-unknown-freebsd12.0 --disable-nls --enable-languages=c,c++ 
--without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports 
Collection for amd64' --with-system-zlib 
--with-gcc-include-dir=/usr/include/c++/v1/ 
--with-as=/usr/local/bin/x86_64-freebsd-as 
--with-ld=/usr/local/bin/x86_64-freebsd-ld --prefix=/usr/local 
--localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/ 
--build=x86_64-unknown-freebsd12.0
Thread model: posix
gcc version 6.3.0 (FreeBSD Ports Collection for amd64) 
COLLECT_GCC_OPTIONS='-isystem' 
'/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include' 
'-L/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' 
'/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' 
'/usr/local/x86_64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-D' 
'_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-I' 
'/usr/src/sys/modules/mlx5en/../../ofed/include' '-I' 
'/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include' '-D' 
'HAVE_KERNEL_OPTION_HEADERS' '-include' 
'/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h' 
'-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-fno-omit-frame-pointer' 
'-mno-omit-leaf-frame-pointer' '-I' 
'/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG' 
'-mcmodel=kernel' '-mno-red-zone' '-mno-mmx' '-mno-sse' '-msoft-float' 
'-fno-asynchronous-unwind-tables' '-ffreestanding' '-fwrapv' 
'-fstack-protector' '-gdwarf-2' '-Wall' '-Wredundant-decls' '-Wnested-externs' 
'-Wstrict-prototype
 s' '-Wmissing-prototypes' '-Winline' '-Wundef' '-Wno-pointer-sign' 
'-fformat-extensions' '-Wmissing-include-dirs' '-fdiagnostics-show-option' 
'-Wno-unknown-pragmas' '-Wno-error=address' 
'-Wno-error=aggressive-loop-optimizations' '-Wno-error=array-bounds' 
'-Wno-error=attributes' '-Wno-error=cast-qual' '-Wno-error=enum-compare' 
'-Wno-error=inline' '-Wno-error=maybe-uninitialized' '-Wno-error=overflow' 
'-Wno-error=sequence-point' '-Wno-error=strict-overflow' 
'-Wno-error=unused-but-set-variable' '-Wno-error=misleading-indentation' 
'-Wno-error=nonnull-compare' '-Wno-error=shift-overflow' 
'-Wno-error=tautological-compare' '-v' '-finline-limit=8000' '-fms-extensions' 
'--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' 
'-std=c99' '-Wno-cast-qual' '-Wno-pointer-arith' '-c' '-o' 'mlx5_en_ethtool.o' 
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-freebsd12.0/6.3.0/cc1 -quiet -nostdinc 
-v -I /usr/src/sys/modules/mlx5en/../../ofed/include -I 
/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include -I . -I 
/usr/src/sys -I /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG 
-isysroot /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp -D _KERNEL -D 
KLD_MODULE -D HAVE_KERNEL_OPTION_HEADERS -isystem 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include -include 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c -quiet 
-dumpbase mlx5_en_ethtool.c -mno-omit-leaf-frame-pointer -mcmodel=kernel 
-mno-red-zone -mno-mmx -mno-sse -msoft-float -mtune=generic -march=x86-64 
-auxbase-strip mlx5_en_ethtool.o -g -gdwarf-2 -O2 -Wall -Wredundant-decls 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Winline -Wundef 
-Wno-pointer-sign -Wmissing-include-dirs -Wno-unknown-pragmas -Wno-
 error=address -Wno-error=aggressive-loop-optimizations -Wno-error=array-bounds 
-Wno-error=attributes -Wno-error=cast-qual -Wno-error=enum-compare 
-Wno-error=inline -Wno-error=maybe-uninitialized -Wno-error=overflow 
-Wno-error=sequence-point -Wno-error=strict-overflow 
-Wno-error=unused-but-set-variable -Wno-error=misleading-indentation 
-Wno-error=nonnull-compare -Wno-error=shift-overflow 
-Wno-error=tautological-compare -Wno-cast-qual -Wno-pointer-arith -std=c99 
-version -fno-strict-aliasing -fno-common -fno-omit-frame-pointer 
-fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector 
-fformat-extensions -fdiagnostics-show-option -finline-limit=8000 
-fms-extensions --param inline-unit-growth=100 --param 
large-function-growth=1000 -o - |
 /usr/local/bin/x86_64-freebsd-as -v -I 
/usr/src/sys/modules/mlx5en/../../ofed/include -I 
/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include -I . -I 
/usr/src/sys -I /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG 
-o mlx5_en_ethtool.o
GNU assembler version 2.27 (x86_64-freebsd) using BFD version (GNU Binutils) 
2.27
GNU C99 (FreeBSD Ports Collection for amd64) version 6.3.0 
(x86_64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.1 
(tags/RELEASE_391/final 289601), GMP version 5.1.3, MPFR version 3.1.5, MPC 
version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
#include "..." search starts here:
#include <...> search starts here:
 /usr/src/sys/modules/mlx5en/../../ofed/include
 /usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include
 .
 /usr/src/sys
 /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG
 /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include
End of search list.
GNU C99 (FreeBSD Ports Collection for amd64) version 6.3.0 
(x86_64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.1 
(tags/RELEASE_391/final 289601), GMP version 5.1.3, MPFR version 3.1.5, MPC 
version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c39bf6f6d020224fff5a44bbb0af2fd5
In file included from /usr/src/sys/sys/refcount.h:36:0,
                 from 
/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include/linux/kmod.h:36,
                 from 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/en.h:31,
                 from 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c:28:
/usr/src/sys/dev/mlx5/device.h:530:29: warning: comparison between 'enum 
<anonymous>' and 'enum <anonymous>' [-Wenum-compare]
 CTASSERT(MLX5_CMD_MBOX_SIZE <= MLX5_ADAPTER_PAGE_SIZE);
                             ^
/usr/src/sys/sys/systm.h:105:36: note: in definition of macro 'CTASSERT'
 #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed")
                                    ^
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c: In 
function 'mlx5e_create_diagnostics':
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c:665:9: 
error: assignment of read-only variable 'entry'
   entry = mlx5_core_pci_diagnostics_table[x];
         ^
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c:675:9: 
error: assignment of read-only variable 'entry'
   entry = mlx5_core_general_diagnostics_table[x];
         ^
*** Error code 1



===
Mark Millard
markmi at dsl-only.net

_______________________________________________
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to