Re: Removing -Wno-format from kernel makefiles, 06/16

2013-07-04 Thread Alexander Bluhm
On Thu, Jul 04, 2013 at 06:39:03PM +0200, Stefan Fritsch wrote: > diff --git sys/netinet/ip_output.c sys/netinet/ip_output.c > index b59accf..43a0551 100644 > --- sys/netinet/ip_output.c > +++ sys/netinet/ip_output.c > @@ -267,7 +267,7 @@ reroute: > if (mtag != NULL) { > #ifdef DIAGNOSTIC >

Re: Removing -Wno-format from kernel makefiles, 4/16

2013-07-04 Thread Mark Kettenis
> Date: Thu, 4 Jul 2013 18:42:50 +0200 (CEST) > From: Stefan Fritsch > > On Wed, 3 Jul 2013, Mark Kettenis wrote: > > > diff --git sys/arch/i386/i386/esm.c sys/arch/i386/i386/esm.c > > > index c90b2c4..3dff69e 100644 > > > --- sys/arch/i386/i386/esm.c > > > +++ sys/arch/i386/i386/esm.c > > > @@ -

Re: Removing -Wno-format from kernel makefiles, 3/16

2013-07-04 Thread Mark Kettenis
> Date: Thu, 4 Jul 2013 18:41:30 +0200 (CEST) > From: Stefan Fritsch > > On Wed, 3 Jul 2013, Mark Kettenis wrote: > > > diff --git sys/arch/i386/i386/db_interface.c > > > sys/arch/i386/i386/db_interface.c > > > index 85c1ff5..c75fd89 100644 > > > --- sys/arch/i386/i386/db_interface.c > > > +++ s

Re: Removing -Wno-format from kernel makefiles, 07/16

2013-07-04 Thread Franco Fichtner
On Jul 4, 2013, at 6:43 PM, Stefan Fritsch wrote: > fix: %x instead of %p for int > > --- > sys/dev/pci/musycc_obsd.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git sys/dev/pci/musycc_obsd.c sys/dev/pci/musycc_obsd.c > index 25a58d8..0844136 100644 > --- sys/dev/pci

Re: Removing -Wno-format from kernel makefiles, V2

2013-07-04 Thread Stefan Fritsch
On Wednesday 03 July 2013, Stefan Fritsch wrote: > I haven't done any signedness fixes so far, only the size fixes. > But I will look over the patches again and try to fix the > signedness issues in the touched code lines, too. There are quite > a few I guess. For people prefering to review by sou

Removing -Wno-format from kernel makefiles, 08/16

2013-07-04 Thread Stefan Fritsch
%hu/%hd for uint16_t, %u/%d/%x for uint32_t despite the name, ntohl returns uint32_t also fix some %d into %u --- sys/arch/i386/i386/bios.c|4 ++-- sys/arch/i386/i386/ioapic.c |2 +- sys/arch/i386/pci/pcibios.c |4 ++-- sys/kern/vfs_cluster.c |2 +- sys/msdosfs/msdosf

Removing -Wno-format from kernel makefiles, 09/16

2013-07-04 Thread Stefan Fritsch
paddr_t is long --- sys/arch/i386/i386/machdep.c |4 ++-- sys/arch/i386/pci/pci_addr_fixup.c |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git sys/arch/i386/i386/machdep.c sys/arch/i386/i386/machdep.c index 7924386..1a26e7d 100644 --- sys/arch/i386/i386/machdep.c

Removing -Wno-format from kernel makefiles, 10/16

2013-07-04 Thread Stefan Fritsch
fix: pointer to long --- sys/arch/i386/pci/pci_addr_fixup.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git sys/arch/i386/pci/pci_addr_fixup.c sys/arch/i386/pci/pci_addr_fixup.c index 59880eb..40f7918 100644 --- sys/arch/i386/pci/pci_addr_fixup.c +++ sys/arch/i386/pci/pci

Removing -Wno-format from kernel makefiles, 07/16

2013-07-04 Thread Stefan Fritsch
fix: %x instead of %p for int --- sys/dev/pci/musycc_obsd.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git sys/dev/pci/musycc_obsd.c sys/dev/pci/musycc_obsd.c index 25a58d8..0844136 100644 --- sys/dev/pci/musycc_obsd.c +++ sys/dev/pci/musycc_obsd.c @@ -215,7 +215,7 @@ mu

Re: Removing -Wno-format from kernel makefiles, 4/16

2013-07-04 Thread Stefan Fritsch
On Wed, 3 Jul 2013, Mark Kettenis wrote: > > diff --git sys/arch/i386/i386/esm.c sys/arch/i386/i386/esm.c > > index c90b2c4..3dff69e 100644 > > --- sys/arch/i386/i386/esm.c > > +++ sys/arch/i386/i386/esm.c > > @@ -880,7 +880,7 @@ esm_make_sensors(struct esm_softc *sc, struct > > esm_devmap *devmap

Re: Removing -Wno-format from kernel makefiles, 3/16

2013-07-04 Thread Stefan Fritsch
On Wed, 3 Jul 2013, Mark Kettenis wrote: > > diff --git sys/arch/i386/i386/db_interface.c > > sys/arch/i386/i386/db_interface.c > > index 85c1ff5..c75fd89 100644 > > --- sys/arch/i386/i386/db_interface.c > > +++ sys/arch/i386/i386/db_interface.c > > @@ -197,11 +197,11 @@ db_sysregs_cmd(db_expr_t a

Removing -Wno-format from kernel makefiles, 06/16

2013-07-04 Thread Stefan Fritsch
Use %z* for size_t while there, fix a few %d into %u --- sys/arch/i386/pci/pcibios.c |2 +- sys/dev/ic/bwi.c|4 ++-- sys/dev/ic/pgt.c|6 +++--- sys/dev/ic/ti.c |4 ++-- sys/dev/pci/amdiic.c|4 ++-- sys/dev/pci/amdpm.c |2

Re: Removing -Wno-format from kernel makefiles, 4/16

2013-07-03 Thread Mark Kettenis
> Date: Wed, 3 Jul 2013 16:55:46 +0200 (CEST) > From: Stefan Fritsch > > format string fixes: long > > --- > sys/arch/i386/i386/esm.c |2 +- > sys/kern/kern_descrip.c |4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git sys/arch/i386/i386/esm.c sys/arch/i386/i386

Re: Removing -Wno-format from kernel makefiles, 3/16

2013-07-03 Thread Mark Kettenis
> Date: Wed, 3 Jul 2013 16:51:43 +0200 (CEST) > From: Stefan Fritsch > > fix: cast void * to char *, fix format args for (u)int64_t > > (tc_frequency is unsigned) > > diff --git sys/arch/i386/i386/db_disasm.c sys/arch/i386/i386/db_disasm.c > index c9446a0..e5b9f4c 100644 > --- sys/a

Re: Removing -Wno-format from kernel makefiles, 2/16

2013-07-03 Thread Stefan Fritsch
On Wed, 3 Jul 2013, Mark Kettenis wrote: > > Date: Wed, 3 Jul 2013 16:40:17 +0200 (CEST) > > From: Stefan Fritsch > > > > don't pass empty format string in subr_disk.c > > > > this is necessary to enable -Wformat or -Wno-error=format > > Don't think this one makes much sense. Better to just do

Re: Removing -Wno-format from kernel makefiles, 5/16

2013-07-03 Thread Stefan Fritsch
cast time_t to long long (time_t is signed) tv_nsec is long --- sys/dev/vmt.c |4 ++-- sys/miscfs/procfs/procfs_status.c |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git sys/dev/vmt.c sys/dev/vmt.c index 5fb5e1e..34f1aec 100644 --- sys/dev/vmt.c ++

Re: Removing -Wno-format from kernel makefiles, 4/16

2013-07-03 Thread Stefan Fritsch
format string fixes: long --- sys/arch/i386/i386/esm.c |2 +- sys/kern/kern_descrip.c |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git sys/arch/i386/i386/esm.c sys/arch/i386/i386/esm.c index c90b2c4..3dff69e 100644 --- sys/arch/i386/i386/esm.c +++ sys/arch/i386/i386/

Removing -Wno-format from kernel makefiles, 3/16

2013-07-03 Thread Stefan Fritsch
fix: cast void * to char *, fix format args for (u)int64_t (tc_frequency is unsigned) diff --git sys/arch/i386/i386/db_disasm.c sys/arch/i386/i386/db_disasm.c index c9446a0..e5b9f4c 100644 --- sys/arch/i386/i386/db_disasm.c +++ sys/arch/i386/i386/db_disasm.c @@ -1192,7 +1192,7 @@ db_d

Re: Removing -Wno-format from kernel makefiles, 2/16

2013-07-03 Thread Mark Kettenis
> Date: Wed, 3 Jul 2013 16:40:17 +0200 (CEST) > From: Stefan Fritsch > > don't pass empty format string in subr_disk.c > > this is necessary to enable -Wformat or -Wno-error=format Don't think this one makes much sense. Better to just do: log(pri, "%s", ""); and keep the rest of the code a

Re: Removing -Wno-format from kernel makefiles, 1/16

2013-07-03 Thread Mark Kettenis
> Date: Wed, 3 Jul 2013 16:35:24 +0200 (CEST) > From: Stefan Fritsch > > add support for %td for ptrdiff_t in kernel > > this also adds support in gcc 4.x kprintf I'm on the fence about the CTASSERT here. If we ever support a code model that's not ILP32 or LP64, we need a major overhaul of the

Removing -Wno-format from kernel makefiles, 2/16

2013-07-03 Thread Stefan Fritsch
don't pass empty format string in subr_disk.c this is necessary to enable -Wformat or -Wno-error=format --- sys/kern/subr_disk.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git sys/kern/subr_disk.c sys/kern/subr_disk.c index 4b500c1..2b1036a 100644 --- sys/kern/su

Removing -Wno-format from kernel makefiles, 1/16

2013-07-03 Thread Stefan Fritsch
add support for %td for ptrdiff_t in kernel this also adds support in gcc 4.x kprintf --- gnu/gcc/gcc/c-format.c |7 --- sys/kern/subr_prf.c|6 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git gnu/gcc/gcc/c-format.c gnu/gcc/gcc/c-format.c index b9eecee..1b1734b

Re: Removing -Wno-format from kernel makefiles, V2

2013-07-03 Thread Stefan Fritsch
On Wednesday 03 July 2013, Alexander Bluhm wrote: > On Wed, Jul 03, 2013 at 01:46:11PM +0200, Stefan Fritsch wrote: > > which the patches are applied does not matter. Therefore I > > thought that people could either review by patch from the above > > directory or by source file from the combined pa

Re: Removing -Wno-format from kernel makefiles, V2

2013-07-03 Thread Theo de Raadt
Please always include diffs in the emails; don't force us to go to a browser.

Re: Removing -Wno-format from kernel makefiles, V2

2013-07-03 Thread Alexander Bluhm
On Wed, Jul 03, 2013 at 01:46:11PM +0200, Stefan Fritsch wrote: > which the patches are applied does not matter. Therefore I thought that > people could either review by patch from the above directory or by source > file from the combined patch, just as they are comfortable. I would then > commi

Re: Removing -Wno-format from kernel makefiles, V2

2013-07-03 Thread Mark Kettenis
> Date: Wed, 3 Jul 2013 13:46:11 +0200 (CEST) > From: Stefan Fritsch > > Hi, > > I have updated my patchset to enable format string warnings in kernel > builds. Changes from the first version: > > - Regarding pointer differences, this now takes the approach favored by > kettenis@ and adds sup

Removing -Wno-format from kernel makefiles, V2

2013-07-03 Thread Stefan Fritsch
Hi, I have updated my patchset to enable format string warnings in kernel builds. Changes from the first version: - Regarding pointer differences, this now takes the approach favored by kettenis@ and adds support for %td in the kernel but does not add a typedef for ptrdiff_t. - It now removes

Re: Removing -Wno-format from kernel makefiles

2013-04-28 Thread Stefan Fritsch
On Sun, 28 Apr 2013, Stefan Fritsch wrote: > On Sun, 21 Apr 2013, Stefan Fritsch wrote: > > On Sunday 21 April 2013, Philip Guenther wrote: > > > Maybe this should be handled the bool bits in , > > > wrapping them in #ifdef _KERNEL ? > > > > #ifdef _KERNEL is fine with me. > > OK for the patch b

Re: Removing -Wno-format from kernel makefiles

2013-04-28 Thread Stefan Fritsch
On Sunday 28 April 2013, Mark Kettenis wrote: > Just drop the ptrdiff_t bit completely please. I > don't think it should be used in the kernel; there always is a > more appropriate kernel type to use. Does it then still make sense to use %td in printf for differences of pointers, or should we s

Re: Removing -Wno-format from kernel makefiles

2013-04-28 Thread Mark Kettenis
> Date: Sun, 28 Apr 2013 11:52:47 +0200 (CEST) > From: Stefan Fritsch > > On Sun, 21 Apr 2013, Stefan Fritsch wrote: > > On Sunday 21 April 2013, Philip Guenther wrote: > >> Maybe this should be handled the bool bits in , > >> wrapping them in #ifdef _KERNEL ? > > > > #ifdef _KERNEL is fine with

Re: Removing -Wno-format from kernel makefiles

2013-04-28 Thread Stefan Fritsch
On Sun, 21 Apr 2013, Stefan Fritsch wrote: On Sunday 21 April 2013, Philip Guenther wrote: Maybe this should be handled the bool bits in , wrapping them in #ifdef _KERNEL ? #ifdef _KERNEL is fine with me. OK for the patch below? --- a/gnu/gcc/gcc/c-format.c +++ b/gnu/gcc/gcc/c-format.c @@ -

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Stefan Fritsch
On Sunday 21 April 2013, Philip Guenther wrote: > On Sun, Apr 21, 2013 at 12:15 PM, Stefan Fritsch wrote: > > On Sunday 21 April 2013, Mark Kettenis wrote: > ... > > >> You can't put ptrdiff_t in either. > > > > Why not? POSIX only speaks about "at least the following types" > > in sys/types.h

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Philip Guenther
On Sun, Apr 21, 2013 at 12:15 PM, Stefan Fritsch wrote: > On Sunday 21 April 2013, Mark Kettenis wrote: ... >> You can't put ptrdiff_t in either. > > Why not? POSIX only speaks about "at least the following types" in > sys/types.h, so there is no reason why it may not define more types. Well, it

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Stefan Fritsch
On Sunday 21 April 2013, Mark Kettenis wrote: > > +++ b/sys/sys/types.h > > @@ -177,6 +177,11 @@ typedef__clockid_t clockid_t; > > > > typedef __size_tsize_t; > > #endif > > > > +#ifndef_PTRDIFF_T_DEFINED_ > > +#define_PTRDIFF_T_DEFINED_ > > +typedef__ptrdif

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Mark Kettenis
> Date: Sun, 21 Apr 2013 15:02:49 +0200 (CEST) > From: Stefan Fritsch > > Moved ptrdiff_t definition to types.h with proper guards. Assume > ptrdiff_t is long in subr_prf.c > > OK? No. > --- a/sys/sys/types.h > +++ b/sys/sys/types.h > @@ -177,6 +177,11 @@ typedef __clockid_t clockid_t; >

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Stefan Fritsch
Moved ptrdiff_t definition to types.h with proper guards. Assume ptrdiff_t is long in subr_prf.c OK? --- a/gnu/gcc/gcc/c-format.c +++ b/gnu/gcc/gcc/c-format.c @@ -325,6 +325,7 @@ static const format_length_info kprintf_length_specs[] = { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L },

Re: Removing -Wno-format from kernel makefiles

2013-04-21 Thread Mark Kettenis
> Date: Sat, 20 Apr 2013 13:27:34 +0200 (CEST) > From: Stefan Fritsch > > Adding ptrdiff_t to stdint.h is not strictly necessary, but I see no > reason not to do it. is and the C standard doesn't allow you to have ptrdiff_t in

Re: Removing -Wno-format from kernel makefiles

2013-04-20 Thread Theo de Raadt
> I can't see that we would add an arch where sizeof(ptrdiff_t) != > sizeof(size_t). We run on I32LP64 and ILP32, therefore, it seems better to match 't' to some other LONG print block, like 'D'. size_t is an high-level abstraction, not a base type.

Re: Removing -Wno-format from kernel makefiles

2013-04-20 Thread Stefan Fritsch
On Sun, 14 Apr 2013, Theo de Raadt wrote: Since the kernel's printf does not support %td for ptrdiff_t, I have used %ld instead. %zd would also work. Is there a preferred way? Or try to add %td support to kernel printf? The patch below seems to do the trick for gcc 4.2. I can't see that we w

Re: Removing -Wno-format from kernel makefiles

2013-04-15 Thread Theo de Raadt
> Or LL128 ... > But if such architectures come around, all kinds of things will need to be > changed. This should not prevent anyone from documenting the current best > practices. All kinds of things will need to be changed? Quite the understatement.

Re: Removing -Wno-format from kernel makefiles

2013-04-15 Thread Stefan Fritsch
On Sun, 14 Apr 2013, Theo de Raadt wrote: That wasn't clear from Miod's response. So the policy is to assume that char/short/int/long long are 8/16/32/64 bits and that intptr_t is long? We only run on C8S16I32L32P32 and C8S16I32L64P64 architectures. Short names ILP32 and I32LP64. The additio

Re: Removing -Wno-format from kernel makefiles

2013-04-14 Thread Theo de Raadt
> > That wasn't clear from Miod's response. So the policy is to assume > > that char/short/int/long long are 8/16/32/64 bits and that intptr_t > > is long? We only run on C8S16I32L32P32 and C8S16I32L64P64 architectures. Short names ILP32 and I32LP64. The addition of any other sizing would requ

Re: Removing -Wno-format from kernel makefiles

2013-04-14 Thread Stefan Fritsch
On Saturday 06 April 2013, Stefan Fritsch wrote: > That wasn't clear from Miod's response. So the policy is to assume > that char/short/int/long long are 8/16/32/64 bits and that intptr_t > is long? Should that be added to style(9), then? I assume that the lack of a response means yes. The patc

Re: Removing -Wno-format from kernel makefiles?

2013-04-06 Thread Stefan Fritsch
On Saturday 06 April 2013, Mark Kettenis wrote: > > From: Stefan Fritsch > > Date: Sat, 6 Apr 2013 13:04:04 +0200 > > > > Also, there does not seem to be a header in the kernel yet, that > > defines the standard PRI*. Should there be a new inttypes.h or, > > since we probably want to define these

Re: Removing -Wno-format from kernel makefiles?

2013-04-06 Thread Mark Kettenis
> From: Stefan Fritsch > Date: Sat, 6 Apr 2013 13:04:04 +0200 > > Also, there does not seem to be a header in the kernel yet, that > defines the standard PRI*. Should there be a new inttypes.h or, since > we probably want to define these always, do we put them into > {,_}types.h? There is no

Re: Removing -Wno-format from kernel makefiles?

2013-04-06 Thread Stefan Fritsch
On Saturday 06 April 2013, Miod Vallat wrote: > > - define a few macros for special types, e.g. bus_addr_t and > > time_t and use them > > It was decided to cast bus_*_t to long long and print them with > %lld, rather than introduce kernel-only PRIfoo macros. Is this documented somewhere? If not,

Re: Removing -Wno-format from kernel makefiles?

2013-04-06 Thread Miod Vallat
> compiling the kernel with -Wno-format is annoying for development and > hides real bugs. It seems gcc has attribute format kprintf since a few > years already. What is missing until we can remove -Wno-format? Any > pointers to prior discussions about this? It is missing the actual format fixe

Removing -Wno-format from kernel makefiles?

2013-04-06 Thread Stefan Fritsch
Hi, compiling the kernel with -Wno-format is annoying for development and hides real bugs. It seems gcc has attribute format kprintf since a few years already. What is missing until we can remove -Wno-format? Any pointers to prior discussions about this? AFAICS, things that remain to be done a