Re: [PATCH v4] Fixes for compiling with clang
On 2016-12-01 19:13, Peter Foley wrote: > On Tue, Nov 29, 2016 at 6:22 AM, Michal Marekwrote: >> Dne 28.11.2016 v 07:44 Peter Foley napsal(a): >> This adds new -Wno-* options also for the gcc case, is there a reason >> for this? Also, the -Wno-missing-field-initializers option is not >> available in some old gccs, so we would need a HOSTCC equivalent of >> cc-disable-warning. >> >> Michal > > It appeared that the conditional was simply reversed, as > -fno-delete-null-pointer-checks is only supported by gcc, and > explicitly not supported by clang. > (see > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Makefile?id=61163efae02040f66a95c8ed17f4407951ba58fa) > It could be that the fno-delete-null-pointer-checks option was simply > misplaced, and the Wno-options should still be guarded by if(clang), > would that be a better approach? I think so. The -Wno-* options had not been present before clang support was added. It really looks like the -fno-delete-null-pointer-checks should not be there. Added Behan to CC. Michal
Re: [PATCH v4] Fixes for compiling with clang
On 2016-12-01 19:13, Peter Foley wrote: > On Tue, Nov 29, 2016 at 6:22 AM, Michal Marek wrote: >> Dne 28.11.2016 v 07:44 Peter Foley napsal(a): >> This adds new -Wno-* options also for the gcc case, is there a reason >> for this? Also, the -Wno-missing-field-initializers option is not >> available in some old gccs, so we would need a HOSTCC equivalent of >> cc-disable-warning. >> >> Michal > > It appeared that the conditional was simply reversed, as > -fno-delete-null-pointer-checks is only supported by gcc, and > explicitly not supported by clang. > (see > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Makefile?id=61163efae02040f66a95c8ed17f4407951ba58fa) > It could be that the fno-delete-null-pointer-checks option was simply > misplaced, and the Wno-options should still be guarded by if(clang), > would that be a better approach? I think so. The -Wno-* options had not been present before clang support was added. It really looks like the -fno-delete-null-pointer-checks should not be there. Added Behan to CC. Michal
Re: [PATCH v4] Fixes for compiling with clang
On Tue, Nov 29, 2016 at 6:22 AM, Michal Marekwrote: > Dne 28.11.2016 v 07:44 Peter Foley napsal(a): > This adds new -Wno-* options also for the gcc case, is there a reason > for this? Also, the -Wno-missing-field-initializers option is not > available in some old gccs, so we would need a HOSTCC equivalent of > cc-disable-warning. > > Michal It appeared that the conditional was simply reversed, as -fno-delete-null-pointer-checks is only supported by gcc, and explicitly not supported by clang. (see https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Makefile?id=61163efae02040f66a95c8ed17f4407951ba58fa) It could be that the fno-delete-null-pointer-checks option was simply misplaced, and the Wno-options should still be guarded by if(clang), would that be a better approach? Thanks, Peter
Re: [PATCH v4] Fixes for compiling with clang
On Tue, Nov 29, 2016 at 6:22 AM, Michal Marek wrote: > Dne 28.11.2016 v 07:44 Peter Foley napsal(a): > This adds new -Wno-* options also for the gcc case, is there a reason > for this? Also, the -Wno-missing-field-initializers option is not > available in some old gccs, so we would need a HOSTCC equivalent of > cc-disable-warning. > > Michal It appeared that the conditional was simply reversed, as -fno-delete-null-pointer-checks is only supported by gcc, and explicitly not supported by clang. (see https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Makefile?id=61163efae02040f66a95c8ed17f4407951ba58fa) It could be that the fno-delete-null-pointer-checks option was simply misplaced, and the Wno-options should still be guarded by if(clang), would that be a better approach? Thanks, Peter
Re: [PATCH v4] Fixes for compiling with clang
Dne 28.11.2016 v 07:44 Peter Foley napsal(a): > Fix reversed conditional checking if HOSTCC is clang. > Suppress warnings about unsupported optimization options. > Suppress warnings about unused functions, as they are generated for > every module and are therefore far too spammy. > Disable clang's integrated assembler which is incompatible with kernel > asm constructs. > > Changes from v1: > * Move the $(cc-name) conditional below the definition of $(CC) > Changes from v2: > * Actually commit the changes in v2. > Changes from v3: > * HOSTCC is not guaranteed to be the same as CC, adjust accordingly. > > Signed-off-by: Peter Foley> --- > Makefile | 12 > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/Makefile b/Makefile > index 694111b43cf8..9c4803a74117 100644 > --- a/Makefile > +++ b/Makefile > @@ -301,12 +301,12 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo > $$BASH; \ > > HOSTCC = gcc > HOSTCXX = g++ > -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 > -fomit-frame-pointer -std=gnu89 > +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 > -fomit-frame-pointer -std=gnu89 \ > + -Wno-unused-value -Wno-unused-parameter > -Wno-missing-field-initializers > HOSTCXXFLAGS = -O2 This adds new -Wno-* options also for the gcc case, is there a reason for this? Also, the -Wno-missing-field-initializers option is not available in some old gccs, so we would need a HOSTCC equivalent of cc-disable-warning. Michal
Re: [PATCH v4] Fixes for compiling with clang
Dne 28.11.2016 v 07:44 Peter Foley napsal(a): > Fix reversed conditional checking if HOSTCC is clang. > Suppress warnings about unsupported optimization options. > Suppress warnings about unused functions, as they are generated for > every module and are therefore far too spammy. > Disable clang's integrated assembler which is incompatible with kernel > asm constructs. > > Changes from v1: > * Move the $(cc-name) conditional below the definition of $(CC) > Changes from v2: > * Actually commit the changes in v2. > Changes from v3: > * HOSTCC is not guaranteed to be the same as CC, adjust accordingly. > > Signed-off-by: Peter Foley > --- > Makefile | 12 > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/Makefile b/Makefile > index 694111b43cf8..9c4803a74117 100644 > --- a/Makefile > +++ b/Makefile > @@ -301,12 +301,12 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo > $$BASH; \ > > HOSTCC = gcc > HOSTCXX = g++ > -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 > -fomit-frame-pointer -std=gnu89 > +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 > -fomit-frame-pointer -std=gnu89 \ > + -Wno-unused-value -Wno-unused-parameter > -Wno-missing-field-initializers > HOSTCXXFLAGS = -O2 This adds new -Wno-* options also for the gcc case, is there a reason for this? Also, the -Wno-missing-field-initializers option is not available in some old gccs, so we would need a HOSTCC equivalent of cc-disable-warning. Michal