* Missing #include <config.h>
@ 2005-09-13 13:56 Jörn Engel
2005-09-13 14:08 ` Russell King
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Jörn Engel @ 2005-09-13 13:56 UTC (permalink / raw)
To: linux-kernel
After spending some hours last night and this morning hunting a bug,
I've found that a different include order made a difference. Some
files don't work correctly, unless config.h is included before.
Here is a very stupid bug checker for the problem class:
$ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
$ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
$ diff -u g1 g2 | grep ^- > g3
Result is quite a long list for 2.6.13. include/config/* are false
positives, ok. But what should we do about the rest?
-include/acpi/acpi_bus.h
-include/acpi/acpi_drivers.h
-include/acpi/actypes.h
-include/acpi/amlcode.h
-include/asm-alpha/bug.h
-include/asm-alpha/core_polaris.h
-include/asm-alpha/ioctls.h
-include/asm-alpha/pci.h
-include/asm-alpha/processor.h
-include/asm-alpha/rwsem.h
-include/asm-alpha/semaphore.h
-include/asm-alpha/topology.h
-include/asm-arm/arch-clps711x/debug-macro.S
-include/asm-arm/arch-clps711x/time.h
-include/asm-arm/arch-ebsa285/debug-macro.S
-include/asm-arm/arch-epxa10db/excalibur.h
-include/asm-arm/arch-epxa10db/hardware.h
-include/asm-arm/arch-epxa10db/pld_conf00.h
-include/asm-arm/arch-h720x/boards.h
-include/asm-arm/arch-h720x/dma.h
-include/asm-arm/arch-h720x/entry-macro.S
-include/asm-arm/arch-h720x/hardware.h
-include/asm-arm/arch-h720x/irqs.h
-include/asm-arm/arch-imx/hardware.h
-include/asm-arm/arch-integrator/hardware.h
-include/asm-arm/arch-integrator/platform.h
-include/asm-arm/arch-iop3xx/debug-macro.S
-include/asm-arm/arch-iop3xx/entry-macro.S
-include/asm-arm/arch-iop3xx/iop321.h
-include/asm-arm/arch-iop3xx/iop331-irqs.h
-include/asm-arm/arch-iop3xx/iop331.h
-include/asm-arm/arch-iop3xx/irqs.h
-include/asm-arm/arch-iop3xx/system.h
-include/asm-arm/arch-ixp2000/io.h
-include/asm-arm/arch-ixp2000/platform.h
-include/asm-arm/arch-ixp4xx/entry-macro.S
-include/asm-arm/arch-ixp4xx/hardware.h
-include/asm-arm/arch-ixp4xx/io.h
-include/asm-arm/arch-ixp4xx/irqs.h
-include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
-include/asm-arm/arch-l7200/time.h
-include/asm-arm/arch-lh7a40x/entry-macro.S
-include/asm-arm/arch-lh7a40x/memory.h
-include/asm-arm/arch-omap/board-innovator.h
-include/asm-arm/arch-omap/cpu.h
-include/asm-arm/arch-omap/debug-macro.S
-include/asm-arm/arch-omap/fpga.h
-include/asm-arm/arch-omap/memory.h
-include/asm-arm/arch-omap/mux.h
-include/asm-arm/arch-omap/omap16xx.h
-include/asm-arm/arch-omap/omap730.h
-include/asm-arm/arch-omap/param.h
-include/asm-arm/arch-omap/pm.h
-include/asm-arm/arch-omap/tc.h
-include/asm-arm/arch-omap/tps65010.h
-include/asm-arm/arch-pxa/dma.h
-include/asm-arm/arch-pxa/entry-macro.S
-include/asm-arm/arch-pxa/memory.h
-include/asm-arm/arch-s3c2410/debug-macro.S
-include/asm-arm/arch-s3c2410/hardware.h
-include/asm-arm/arch-s3c2410/memory.h
-include/asm-arm/arch-s3c2410/regs-clock.h
-include/asm-arm/arch-s3c2410/regs-dsc.h
-include/asm-arm/arch-versatile/platform.h
-include/asm-arm/arch-versatile/system.h
-include/asm-arm/bitops.h
-include/asm-arm/hardware/pci_v3.h
-include/asm-arm/ide.h
-include/asm-arm/ioctls.h
-include/asm-arm/mach/irq.h
-include/asm-arm/mach/time.h
-include/asm-arm/numnodes.h
-include/asm-arm/setup.h
-include/asm-arm/spinlock.h
-include/asm-arm26/ioctls.h
-include/asm-cris/arch-v10/pgtable.h
-include/asm-cris/arch-v10/processor.h
-include/asm-cris/arch-v10/sv_addr.agh
-include/asm-cris/arch-v10/sv_addr_ag.h
-include/asm-cris/arch-v32/atomic.h
-include/asm-cris/arch-v32/hwregs/asm/intr_vect.h
-include/asm-cris/arch-v32/hwregs/intr_vect.h
-include/asm-cris/arch-v32/juliette.h
-include/asm-cris/arch-v32/spinlock.h
-include/asm-cris/dma-mapping.h
-include/asm-cris/dma.h
-include/asm-cris/io.h
-include/asm-cris/ioctls.h
-include/asm-cris/system.h
-include/asm-frv/cacheflush.h
-include/asm-frv/cpu-irqs.h
-include/asm-frv/ioctls.h
-include/asm-frv/mb-regs.h
-include/asm-frv/mb86943a.h
-include/asm-frv/mem-layout.h
-include/asm-frv/mmu.h
-include/asm-frv/setup.h
-include/asm-frv/thread_info.h
-include/asm-frv/topology.h
-include/asm-frv/uaccess.h
-include/asm-generic/percpu.h
-include/asm-generic/rtc.h
-include/asm-h8300/ioctls.h
-include/asm-h8300/irq.h
-include/asm-h8300/ptrace.h
-include/asm-h8300/timex.h
-include/asm-i386/acpi.h
-include/asm-i386/cacheflush.h
-include/asm-i386/cpu.h
-include/asm-i386/ioctls.h
-include/asm-i386/kprobes.h
-include/asm-i386/linkage.h
-include/asm-i386/mach-default/do_timer.h
-include/asm-i386/mach-default/entry_arch.h
-include/asm-i386/mach-default/irq_vectors_limits.h
-include/asm-i386/mach-default/mach_apic.h
-include/asm-i386/mach-default/pci-functions.h
-include/asm-i386/mach-es7000/mach_apic.h
-include/asm-i386/mach-es7000/mach_wakecpu.h
-include/asm-i386/mach-summit/mach_mpparse.h
-include/asm-i386/mach-visws/cobalt.h
-include/asm-i386/mach-visws/do_timer.h
-include/asm-i386/mach-visws/entry_arch.h
-include/asm-i386/mach-visws/mach_apic.h
-include/asm-i386/mach-voyager/do_timer.h
-include/asm-i386/mach-voyager/setup_arch_post.h
-include/asm-i386/mmzone.h
-include/asm-i386/module.h
-include/asm-i386/mpspec.h
-include/asm-i386/msi.h
-include/asm-i386/numaq.h
-include/asm-i386/ptrace.h
-include/asm-i386/sparsemem.h
-include/asm-i386/srat.h
-include/asm-i386/suspend.h
-include/asm-i386/timer.h
-include/asm-i386/topology.h
-include/asm-i386/voyager.h
-include/asm-ia64/acpi.h
-include/asm-ia64/bug.h
-include/asm-ia64/cpu.h
-include/asm-ia64/cyclone.h
-include/asm-ia64/hw_irq.h
-include/asm-ia64/ioctls.h
-include/asm-ia64/iosapic.h
-include/asm-ia64/irq.h
-include/asm-ia64/kprobes.h
-include/asm-ia64/mmu_context.h
-include/asm-ia64/mmzone.h
-include/asm-ia64/numnodes.h
-include/asm-ia64/pci.h
-include/asm-ia64/sal.h
-include/asm-ia64/sn/shub_mmr.h
-include/asm-ia64/sn/sn2/sn_hwperf.h
-include/asm-ia64/sn/tioca.h
-include/asm-ia64/spinlock.h
-include/asm-ia64/topology.h
-include/asm-m32r/ioctls.h
-include/asm-m32r/m32102.h
-include/asm-m32r/mmzone.h
-include/asm-m32r/s1d13806.h
-include/asm-m32r/thread_info.h
-include/asm-m68k/amigayle.h
-include/asm-m68k/amipcmcia.h
-include/asm-m68k/bvme6000hw.h
-include/asm-m68k/ioctls.h
-include/asm-m68k/mvme16xhw.h
-include/asm-m68knommu/anchor.h
-include/asm-m68knommu/atomic.h
-include/asm-m68knommu/cacheflush.h
-include/asm-m68knommu/checksum.h
-include/asm-m68knommu/dbg.h
-include/asm-m68knommu/delay.h
-include/asm-m68knommu/m5249sim.h
-include/asm-m68knommu/m5307sim.h
-include/asm-m68knommu/pci.h
-include/asm-m68knommu/ptrace.h
-include/asm-m68knommu/string.h
-include/asm-m68knommu/thread_info.h
-include/asm-m68knommu/ucontext.h
-include/asm-mips/arc/hinv.h
-include/asm-mips/bug.h
-include/asm-mips/ddb5xxx/ddb5074.h
-include/asm-mips/ddb5xxx/ddb5476.h
-include/asm-mips/galileo-boards/gt96100.h
-include/asm-mips/gt64120.h
-include/asm-mips/gt64240.h
-include/asm-mips/ioctls.h
-include/asm-mips/ip32/mace.h
-include/asm-mips/jazz.h
-include/asm-mips/lasat/lasat.h
-include/asm-mips/mach-au1x00/au1000_usbdev.h
-include/asm-mips/mach-au1x00/au1100_mmc.h
-include/asm-mips/mach-au1x00/au1xxx_psc.h
-include/asm-mips/mach-pb1x00/pb1000.h
-include/asm-mips/mips-boards/bonito64.h
-include/asm-mips/mips-boards/malta.h
-include/asm-mips/mmzone.h
-include/asm-mips/pci/bridge.h
-include/asm-mips/sgi/mc.h
-include/asm-mips/sibyte/sb1250_dma.h
-include/asm-mips/sibyte/sb1250_mc.h
-include/asm-mips/sibyte/sb1250_regs.h
-include/asm-mips/sibyte/sb1250_scd.h
-include/asm-mips/sni.h
-include/asm-mips/titan_dep.h
-include/asm-mips/tx4927/smsc_fdc37m81x.h
-include/asm-mips/tx4927/tx4927.h
-include/asm-parisc/assembly.h
-include/asm-parisc/bug.h
-include/asm-parisc/ioctls.h
-include/asm-parisc/led.h
-include/asm-parisc/mmzone.h
-include/asm-parisc/pdcpat.h
-include/asm-parisc/rt_sigframe.h
-include/asm-parisc/spinlock.h
-include/asm-parisc/superio.h
-include/asm-ppc/atomic.h
-include/asm-ppc/bug.h
-include/asm-ppc/cpm2.h
-include/asm-ppc/gg2.h
-include/asm-ppc/gt64260_defs.h
-include/asm-ppc/hawk_defs.h
-include/asm-ppc/highmem.h
-include/asm-ppc/ibm_ocp.h
-include/asm-ppc/ioctls.h
-include/asm-ppc/kexec.h
-include/asm-ppc/macio.h
-include/asm-ppc/mpc52xx.h
-include/asm-ppc/mpc8260_pci9.h
-include/asm-ppc/mv64x60_defs.h
-include/asm-ppc/pci.h
-include/asm-ppc/perfmon.h
-include/asm-ppc/pnp.h
-include/asm-ppc/ppc_sys.h
-include/asm-ppc/ppcboot.h
-include/asm-ppc/ptrace.h
-include/asm-ppc/reg.h
-include/asm-ppc/reg_booke.h
-include/asm-ppc/residual.h
-include/asm-ppc/spinlock.h
-include/asm-ppc/termios.h
-include/asm-ppc/uninorth.h
-include/asm-ppc64/bug.h
-include/asm-ppc64/iSeries/HvLpConfig.h
-include/asm-ppc64/ioctls.h
-include/asm-ppc64/iommu.h
-include/asm-ppc64/kprobes.h
-include/asm-ppc64/pSeries_reconfig.h
-include/asm-ppc64/pci.h
-include/asm-ppc64/ptrace.h
-include/asm-ppc64/rtas.h
-include/asm-ppc64/sparsemem.h
-include/asm-ppc64/termios.h
-include/asm-s390/bug.h
-include/asm-s390/ioctls.h
-include/asm-s390/pci.h
-include/asm-s390/percpu.h
-include/asm-s390/spinlock.h
-include/asm-sh/cpu-sh3/cache.h
-include/asm-sh/cpu-sh3/cacheflush.h
-include/asm-sh/cpu-sh3/freq.h
-include/asm-sh/cpu-sh3/timer.h
-include/asm-sh/cpu-sh4/cacheflush.h
-include/asm-sh/cpu-sh4/freq.h
-include/asm-sh/cpu-sh4/timer.h
-include/asm-sh/dreamcast/pci.h
-include/asm-sh/harp/harp.h
-include/asm-sh/ioctls.h
-include/asm-sh/kgdb.h
-include/asm-sh/mc146818rtc.h
-include/asm-sh/microdev/io.h
-include/asm-sh/mmu.h
-include/asm-sh/mmu_context.h
-include/asm-sh/module.h
-include/asm-sh/mpc1211/m1543c.h
-include/asm-sh/overdrive/gt64111.h
-include/asm-sh/param.h
-include/asm-sh/pci.h
-include/asm-sh/pgalloc.h
-include/asm-sh/processor.h
-include/asm-sh/rts7751r2d/rts7751r2d.h
-include/asm-sh/se/se.h
-include/asm-sh/se/smc37c93x.h
-include/asm-sh/sigcontext.h
-include/asm-sh/snapgear/io.h
-include/asm-sh/spinlock.h
-include/asm-sh/timex.h
-include/asm-sh/uaccess.h
-include/asm-sh/ubc.h
-include/asm-sh64/dma.h
-include/asm-sh64/io.h
-include/asm-sh64/ioctls.h
-include/asm-sh64/keyboard.h
-include/asm-sh64/pci.h
-include/asm-sh64/pgalloc.h
-include/asm-sh64/processor.h
-include/asm-sh64/registers.h
-include/asm-sh64/types.h
-include/asm-sparc/bug.h
-include/asm-sparc/highmem.h
-include/asm-sparc/ioctls.h
-include/asm-sparc/pci.h
-include/asm-sparc/pcic.h
-include/asm-sparc/spinlock.h
-include/asm-sparc64/asi.h
-include/asm-sparc64/bug.h
-include/asm-sparc64/ioctls.h
-include/asm-sparc64/pci.h
-include/asm-sparc64/percpu.h
-include/asm-sparc64/ptrace.h
-include/asm-sparc64/thread_info.h
-include/asm-sparc64/upa.h
-include/asm-um/pgtable-3level.h
-include/asm-um/pgtable.h
-include/asm-um/processor-ppc.h
-include/asm-v850/anna.h
-include/asm-v850/as85ep1.h
-include/asm-v850/bug.h
-include/asm-v850/cacheflush.h
-include/asm-v850/dma.h
-include/asm-v850/entry.h
-include/asm-v850/ioctls.h
-include/asm-v850/ma.h
-include/asm-v850/me2.h
-include/asm-v850/pci.h
-include/asm-v850/rte_cb.h
-include/asm-v850/rte_ma1_cb.h
-include/asm-v850/rte_me2_cb.h
-include/asm-v850/rte_nb85e_cb.h
-include/asm-v850/teg.h
-include/asm-v850/v850e2_cache.h
-include/asm-v850/v850e_uarta.h
-include/asm-v850/v850e_uartb.h
-include/asm-x86_64/acpi.h
-include/asm-x86_64/bug.h
-include/asm-x86_64/hpet.h
-include/asm-x86_64/ioctls.h
-include/asm-x86_64/irq.h
-include/asm-x86_64/mce.h
-include/asm-x86_64/mpspec.h
-include/asm-x86_64/nmi.h
-include/asm-x86_64/percpu.h
-include/asm-x86_64/proto.h
-include/asm-x86_64/sparsemem.h
-include/asm-x86_64/suspend.h
-include/asm-xtensa/bitops.h
-include/asm-xtensa/bug.h
-include/asm-xtensa/fixmap.h
-include/asm-xtensa/ioctls.h
-include/asm-xtensa/pgtable.h
-include/asm-xtensa/ptrace.h
-include/asm-xtensa/timex.h
-include/asm-xtensa/xtensa/config-linux_be/core.h
-include/asm-xtensa/xtensa/config-linux_be/system.h
-include/asm-xtensa/xtensa/config-linux_be/tie.h
-include/asm-xtensa/xtensa/hal.h
-include/linux/ac97_codec.h
-include/linux/amifdreg.h
-include/linux/arcdevice.h
-include/linux/atalk.h
-include/linux/audit.h
-include/linux/b1lli.h
-include/linux/bio.h
-include/linux/bootmem.h
-include/linux/capability.h
-include/linux/cciss_ioctl.h
-include/linux/cdrom.h
-include/linux/com20020.h
-include/linux/compat_ioctl.h
-include/linux/config.h
-include/linux/cpu.h
-include/linux/cpumask.h
-include/linux/cpuset.h
-include/linux/crash_dump.h
-include/linux/cycx_x25.h
-include/linux/debugfs.h
-include/linux/devpts_fs.h
-include/linux/dio.h
-include/linux/divert.h
-include/linux/dm-ioctl.h
-include/linux/dmi.h
-include/linux/efi.h
-include/linux/eisa.h
-include/linux/elf-fdpic.h
-include/linux/eventpoll.h
-include/linux/ext3_fs.h
-include/linux/ext3_fs_i.h
-include/linux/ext3_fs_sb.h
-include/linux/ext3_jbd.h
-include/linux/fb.h
-include/linux/fdreg.h
-include/linux/flat.h
-include/linux/fsnotify.h
-include/linux/gameport.h
-include/linux/harrier_defs.h
-include/linux/hdreg.h
-include/linux/hiddev.h
-include/linux/hugetlb.h
-include/linux/i2c.h
-include/linux/i2o-dev.h
-include/linux/i2o.h
-include/linux/if_wanpipe_common.h
-include/linux/input.h
-include/linux/ioctl32.h
-include/linux/ipmi.h
-include/linux/jbd.h
-include/linux/jffs2_fs_sb.h
-include/linux/kernel.h
-include/linux/kexec.h
-include/linux/key.h
-include/linux/kmalloc_sizes.h
-include/linux/kobject.h
-include/linux/kobject_uevent.h
-include/linux/libata.h
-include/linux/mca.h
-include/linux/mii.h
-include/linux/mtd/cfi_endian.h
-include/linux/mtio.h
-include/linux/mv643xx.h
-include/linux/netfilter_bridge/ebt_stp.h
-include/linux/netfilter_ipv4/ip_conntrack_protocol.h
-include/linux/netpoll.h
-include/linux/nfs_fs_sb.h
-include/linux/nfs_xdr.h
-include/linux/nfsd/const.h
-include/linux/nfsd_idmap.h
-include/linux/page-flags.h
-include/linux/pagemap.h
-include/linux/parport_pc.h
-include/linux/pci-acpi.h
-include/linux/percpu.h
-include/linux/pkt_cls.h
-include/linux/pktcdvd.h
-include/linux/pnp.h
-include/linux/pnpbios.h
-include/linux/ps2esdi.h
-include/linux/qic117.h
-include/linux/raw.h
-include/linux/reboot_fixups.h
-include/linux/reiserfs_acl.h
-include/linux/reiserfs_fs.h
-include/linux/reiserfs_fs_sb.h
-include/linux/rslib.h
-include/linux/sdla.h
-include/linux/sdla_asy.h
-include/linux/sdla_chdlc.h
-include/linux/sdla_fr.h
-include/linux/sdla_ppp.h
-include/linux/sdla_x25.h
-include/linux/sdlapci.h
-include/linux/security.h
-include/linux/sem.h
-include/linux/shm.h
-include/linux/sysctl.h
-include/linux/sysfs.h
-include/linux/topology.h
-include/linux/usb_ch9.h
-include/linux/usb_gadget.h
-include/linux/usb_gadgetfs.h
-include/linux/usbdevice_fs.h
-include/linux/vermagic.h
-include/linux/via.h
-include/linux/wanrouter.h
-include/linux/watchdog.h
-include/linux/zorro.h
-include/media/audiochip.h
-include/media/saa7146.h
-include/media/tuner.h
-include/net/act_api.h
-include/net/bluetooth/bluetooth.h
-include/net/bluetooth/hci_core.h
-include/net/dn_fib.h
-include/net/ieee80211.h
-include/net/if_inet6.h
-include/net/ipx.h
-include/net/irda/irlan_event.h
-include/net/llc.h
-include/net/ndisc.h
-include/net/neighbour.h
-include/net/pkt_cls.h
-include/net/pkt_sched.h
-include/net/sctp/constants.h
-include/net/sctp/structs.h
-include/net/tc_act/tc_gact.h
-include/net/xfrm.h
-include/pcmcia/cisreg.h
-include/pcmcia/cistpl.h
-include/pcmcia/cs.h
-include/pcmcia/ds.h
-include/rxrpc/rxrpc.h
-include/scsi/scsi_host.h
-include/sound/ac97_codec.h
-include/sound/ad1816a.h
-include/sound/control.h
-include/sound/core.h
-include/sound/cs4231.h
-include/sound/cs46xx.h
-include/sound/emux_synth.h
-include/sound/gus.h
-include/sound/hdsp.h
-include/sound/hdspm.h
-include/sound/hwdep.h
-include/sound/info.h
-include/sound/initval.h
-include/sound/minors.h
-include/sound/mixer_oss.h
-include/sound/opl3.h
-include/sound/pcm.h
-include/sound/rawmidi.h
-include/sound/sb.h
-include/sound/seq_kernel.h
-include/sound/snd_wavefront.h
-include/sound/uda1341.h
-include/sound/version.h
-include/sound/vx_core.h
-include/sound/ymfpci.h
-include/video/aty128.h
-include/video/cvisionppc.h
-include/video/epson1355.h
-include/video/kyro.h
-include/video/mach64.h
-include/video/neomagic.h
-include/video/newport.h
-include/video/permedia2.h
-include/video/radeon.h
-include/video/s1d13xxxfb.h
-include/video/sgivw.h
-include/video/tdfx.h
Jörn
--
The story so far:
In the beginning the Universe was created. This has made a lot
of people very angry and been widely regarded as a bad move.
-- Douglas Adams?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 13:56 Missing #include <config.h> Jörn Engel
@ 2005-09-13 14:08 ` Russell King
2005-09-13 14:12 ` Christoph Hellwig
2005-09-13 14:50 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Russell King
2005-09-13 14:12 ` Missing #include <config.h> Josh Boyer
2005-09-13 17:55 ` Geert Uytterhoeven
2 siblings, 2 replies; 21+ messages in thread
From: Russell King @ 2005-09-13 14:08 UTC (permalink / raw)
To: Jörn Engel; +Cc: linux-kernel
On Tue, Sep 13, 2005 at 02:56:23PM +0100, Jörn Engel wrote:
> After spending some hours last night and this morning hunting a bug,
> I've found that a different include order made a difference. Some
> files don't work correctly, unless config.h is included before.
I'm still of the opinion that we should add
-imacros include/linux/config.h
to the gcc command line and stop bothering with trying to get
linux/config.h included into the right files and not in others.
(which then means we can eliminate linux/config.h from all files.)
>From what you can see below, missing includes of it can remain
for months, and it can cause bugs which are rather non-obvious.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 13:56 Missing #include <config.h> Jörn Engel
2005-09-13 14:08 ` Russell King
@ 2005-09-13 14:12 ` Josh Boyer
2005-09-13 14:28 ` Russell King
2005-09-13 16:22 ` Doug Maxey
2005-09-13 17:55 ` Geert Uytterhoeven
2 siblings, 2 replies; 21+ messages in thread
From: Josh Boyer @ 2005-09-13 14:12 UTC (permalink / raw)
To: Jörn Engel; +Cc: linux-kernel
On Tue, 2005-09-13 at 14:56 +0100, Jörn Engel wrote:
> After spending some hours last night and this morning hunting a bug,
> I've found that a different include order made a difference. Some
> files don't work correctly, unless config.h is included before.
>
> Here is a very stupid bug checker for the problem class:
> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
> $ diff -u g1 g2 | grep ^- > g3
Your checker doesn't quite test for nested includes. E.g. if foo.h
includes bar.h, and bar.h includes config.h, then foo.h doesn't need to
include config.h explicitly.
For a more concrete example, take include/asm-i386/kprobes.h from your
list. That includes linux/types.h, which includes linux/config.h.
Making a tool that takes that into account could be interesting.
josh
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 14:08 ` Russell King
@ 2005-09-13 14:12 ` Christoph Hellwig
2005-09-13 17:57 ` Geert Uytterhoeven
2005-09-13 14:50 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Russell King
1 sibling, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2005-09-13 14:12 UTC (permalink / raw)
To: J?rn Engel, linux-kernel
On Tue, Sep 13, 2005 at 03:08:26PM +0100, Russell King wrote:
> On Tue, Sep 13, 2005 at 02:56:23PM +0100, J?rn Engel wrote:
> > After spending some hours last night and this morning hunting a bug,
> > I've found that a different include order made a difference. Some
> > files don't work correctly, unless config.h is included before.
>
> I'm still of the opinion that we should add
>
> -imacros include/linux/config.h
>
> to the gcc command line and stop bothering with trying to get
> linux/config.h included into the right files and not in others.
> (which then means we can eliminate linux/config.h from all files.)
Yes, absolutely. That would help fixing lots of mess.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 14:12 ` Missing #include <config.h> Josh Boyer
@ 2005-09-13 14:28 ` Russell King
2005-09-13 14:40 ` Josh Boyer
2005-09-13 16:22 ` Doug Maxey
1 sibling, 1 reply; 21+ messages in thread
From: Russell King @ 2005-09-13 14:28 UTC (permalink / raw)
To: Josh Boyer; +Cc: Jörn Engel, linux-kernel
On Tue, Sep 13, 2005 at 09:12:33AM -0500, Josh Boyer wrote:
> On Tue, 2005-09-13 at 14:56 +0100, Jörn Engel wrote:
> > After spending some hours last night and this morning hunting a bug,
> > I've found that a different include order made a difference. Some
> > files don't work correctly, unless config.h is included before.
> >
> > Here is a very stupid bug checker for the problem class:
> > $ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
> > $ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
> > $ diff -u g1 g2 | grep ^- > g3
>
> Your checker doesn't quite test for nested includes. E.g. if foo.h
> includes bar.h, and bar.h includes config.h, then foo.h doesn't need to
> include config.h explicitly.
Unfortunately, we don't operate like that. If a file makes use of
CONFIG_xxx then it must include <linux/config.h>.
We have "make configcheck" to help us find <linux/config.h> screwups.
Unfortunately, it seems from the output that no one runs it anymore.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 14:28 ` Russell King
@ 2005-09-13 14:40 ` Josh Boyer
0 siblings, 0 replies; 21+ messages in thread
From: Josh Boyer @ 2005-09-13 14:40 UTC (permalink / raw)
To: Russell King; +Cc: Jörn Engel, linux-kernel
On Tue, 2005-09-13 at 15:28 +0100, Russell King wrote:
> On Tue, Sep 13, 2005 at 09:12:33AM -0500, Josh Boyer wrote:
> > On Tue, 2005-09-13 at 14:56 +0100, Jörn Engel wrote:
> > > After spending some hours last night and this morning hunting a bug,
> > > I've found that a different include order made a difference. Some
> > > files don't work correctly, unless config.h is included before.
> > >
> > > Here is a very stupid bug checker for the problem class:
> > > $ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
> > > $ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
> > > $ diff -u g1 g2 | grep ^- > g3
> >
> > Your checker doesn't quite test for nested includes. E.g. if foo.h
> > includes bar.h, and bar.h includes config.h, then foo.h doesn't need to
> > include config.h explicitly.
>
> Unfortunately, we don't operate like that. If a file makes use of
> CONFIG_xxx then it must include <linux/config.h>.
Well, that rule makes things easier then, so Jörn's list would be pretty
complete.
Your proposal of using -imacros is even better though.
josh
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-13 14:08 ` Russell King
2005-09-13 14:12 ` Christoph Hellwig
@ 2005-09-13 14:50 ` Russell King
2005-09-13 16:59 ` Joern Engel
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
1 sibling, 2 replies; 21+ messages in thread
From: Russell King @ 2005-09-13 14:50 UTC (permalink / raw)
To: Jörn Engel, linux-kernel
On Tue, Sep 13, 2005 at 03:08:26PM +0100, Russell King wrote:
> On Tue, Sep 13, 2005 at 02:56:23PM +0100, Jörn Engel wrote:
> > After spending some hours last night and this morning hunting a bug,
> > I've found that a different include order made a difference. Some
> > files don't work correctly, unless config.h is included before.
>
> I'm still of the opinion that we should add
>
> -imacros include/linux/config.h
>
> to the gcc command line and stop bothering with trying to get
> linux/config.h included into the right files and not in others.
> (which then means we can eliminate linux/config.h from all files.)
>
> From what you can see below, missing includes of it can remain
> for months, and it can cause bugs which are rather non-obvious.
Well, fixing all the ARM related config.h include mess, the patch
comes out at 53K with this diffstat summary:
150 files changed, 142 insertions(+), 91 deletions(-)
I really think we should stop being crazy and apply something like
the patch below instead. Afterwards, we may optionally want to re-
educate people to not include linux/config.h after all.
======
Subject: [KBUILD] Permanently fix kernel configuration include mess.
Include autoconf.h into every kernel compilation via the gcc
command line using -imacros. This ensures that we have the
kernel configuration included from the start, rather than
relying on each file having #include <linux/config.h> as
appropriate. History has shown that this is something which
is difficult to get right.
Since we now include the kernel configuration automatically,
make configcheck becomes meaningless, so remove it.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -346,7 +346,8 @@ AFLAGS_KERNEL =
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude \
- $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
+ -imacros include/linux/autoconf.h
CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
@@ -1247,11 +1248,6 @@ tags: FORCE
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
-configcheck:
- find * $(RCS_FIND_IGNORE) \
- -name '*.[hcS]' -type f -print | sort \
- | xargs $(PERL) -w scripts/checkconfig.pl
-
includecheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 14:12 ` Missing #include <config.h> Josh Boyer
2005-09-13 14:28 ` Russell King
@ 2005-09-13 16:22 ` Doug Maxey
1 sibling, 0 replies; 21+ messages in thread
From: Doug Maxey @ 2005-09-13 16:22 UTC (permalink / raw)
To: Josh Boyer; +Cc: Jörn Engel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
On Tue, 13 Sep 2005 09:12:33 CDT, Josh Boyer wrote:
>On Tue, 2005-09-13 at 14:56 +0100, Jörn Engel wrote:
>> After spending some hours last night and this morning hunting a bug,
>> I've found that a different include order made a difference. Some
>> files don't work correctly, unless config.h is included before.
>>
>> Here is a very stupid bug checker for the problem class:
>> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
>> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
>> $ diff -u g1 g2 | grep ^- > g3
>
>Your checker doesn't quite test for nested includes. E.g. if foo.h
>includes bar.h, and bar.h includes config.h, then foo.h doesn't need to
>include config.h explicitly.
>
>For a more concrete example, take include/asm-i386/kprobes.h from your
>list. That includes linux/types.h, which includes linux/config.h.
>
>Making a tool that takes that into account could be interesting.
>
>josh
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
>
Going Way Back - there was a perl script floating around last century
named 'inctree' that did what he was looking for...
++doug
[-- Attachment #2: inctree --]
[-- Type: text/plain , Size: 5088 bytes --]
#!/usr/local/bin/perl
# $Id: inctree,v 1.1.1.1 2001/11/16 17:16:36 dwm Exp $
# $Header: /cvs/local/share/inctree,v 1.1.1.1 2001/11/16 17:16:36 dwm Exp $
# $Log: inctree,v $
# Revision 1.1.1.1 2001/11/16 17:16:36 dwm
# after rome burned.
#
# Revision 1.1 2001/11/16 17:16:36 dwm
# .
#
# Revision 1.10 1998-06-11 09:35:42-05 dwm
# *** empty log message ***
#
# Revision 1.9 1998-06-11 09:32:20-05 dwm
# *** empty log message ***
#
# Revision 1.8 1996-06-20 11:09:00-05 dwm
# *** empty log message ***
#
# Revision 1.7 1996-06-20 11:06:47-05 dwm
# sucks on AIX build tree.
#
# Revision 1.6 1996-06-20 08:39:46-05 dwm
# *** empty log message ***
#
# Revision 1.5 1996-06-20 08:34:11-05 dwm
# fix for using other compiler.
#
# Revision 1.4 1995-06-07 20:15:35-0500 dwm
# now we exclude the -c, -f*, and -M* compiler flags.
#
# Revision 1.3 1994-06-08 22:46:37-0500 dwm
# added support for C++
#
# Revision 1.2 1993/07/16 04:06:56 dwm
# Zthe -? neeeded a \.
#
# Revision 1.1 1993/07/16 03:51:35 dwm
# Initial revision
#
require 5.004;
# 'inctree' created 93/07/09 11:40 to validate/print the #includes
# for files.
# from the camel book, p274
#################################
############ GLOBALS ############
#################################
( $prog = $0 ) =~ s#.*/##o ; $0 = join(' ', $prog, @ARGV) ;
$CPP = $ENV{'CPP'} || 'gcc -E' ;
$shiftwidth = 4 ;
#################################
########## SUBROUTINES ##########
#################################
sub usage
{
print STDERR @_ if @_ ;
print STDERR <<"EOU" ;
usage: $prog [-d] [-D...] [-I...] [-l] [-m/pattern/] file...
$prog runs the C preprocessor (default $CPP) on the specified files,
passing along any -D or -I switches, then processes the output of
cpp into a tree of who included what. Files included more than
once are marked DUPLICATE.
flags:
-C... preprocessor definition (default $CPP_name).
-D... defines for the preprocessor.
-I... dirs to search for the #include files.
-d prints debugging info.
-h|-? print this message.
-l prints the line numbers of the include statements.
-m/../ outputs any lines including the pattern specified.
-s\d sets shiftwidth (default $shiftwidth).
EOU
exit 1 ;
}
#################################
############ MAIN ############
#################################
# require 'getopts.pl' ;
# &Getopts('dD:I:lm:') || &usage ;
while ( $ARGV[0] =~ /^-/ )
{
$_ = shift ;
if (/^-C(.*)/)
{
$opt_cpp = ( $1 ? $1 : shift ) ;
}
elsif (/^-([DU])(.*)/)
{
$defines .= " -$1" . ($2 ? $2 : shift );
}
elsif (/^-I(.*)/)
{
$includes .= " -I" . ($1 ? $1 : shift );
}
elsif (/^-m(.*)/)
{
push(@pats, $1 ? $1 : shift );
}
elsif ( /^-d/ )
{
$debug++ ;
}
elsif ( /^-l/ )
{
$lines++ ;
}
elsif (/^-s(.*)/)
{
$shiftwidth = ( $1 ? $1 : shift ) ;
}
elsif (/^-h|^-\?/)
{
&usage ;
}
# other compiler flags
elsif (/^-g(.*)|^-O(.*)|^-traditional|^-c|^-f(.*)|^-M(.*)/)
{
next ;
}
elsif (/^-v$/ )
{
$verbose = $_ ;
}
else
{
push (@ccopts, $_);
#&usage("Unrecognized switch $_\n") ;
}
}
print STDERR "$defines\n" if $debug ;
print STDERR "$includes\n" if $debug ;
# build a subroutine to scan for patterns
if ( @pats )
{
$sub = "sub pats ()\n{\n" ;
foreach $pat ( @pats )
{
$sub .= " print '>>>>>>> ',\$_ if m$pat;\n" ;
}
$sub .= "}\n" ;
print STDERR $sub if $debug ;
eval $sub ;
die $@ if $@ ;
++$pats ;
}
# process each file.
foreach $file (@ARGV)
{
if (length $opt_cpp)
{
$CPP_name = $opt_cpp;
}
elsif ($file =~ /.C$|.cc$/) {
$CPP_name = "g++ -E" ;
}
else {
$CPP_name = $CPP ;
}
$ccopts = join (" ", @ccopts);
$pipecmd = "$CPP_name $verbose $ccopts $defines $includes $file|" ;
open(CPP,$pipecmd)
|| die "Can't run $pipecmd: $!\n" ;
$line = 2 ;
while (<CPP>)
{
++$line ;
pats () if $pats ; # avoid expensive call if we can.
next unless /^#/ ;
next unless /^# \d/ ;
(undef, $newline, $filename) = split ;
$filename =~ s/\"//g ;
# now figure out if it's push, pop, or neither.
if ($stack[$#stack] eq $filename)
{
$line = $newline - 1 ;
next ;
}
if ($stack[$#stack - 1] eq $filename) # Leaving file.
{
$indent -= $shiftwidth ;
$line = pop(@lines) - 1 ;
pop(@stack) ;
}
else # New file.
{
printf "%6d ", $line -2 if $lines ;
push(@lines, $line) ;
$line = $newline ;
print "\t" x ($indent / 8), ' ' x ($indent % 8),
$filename ;
print " DUPLICATE" if $seen{$filename}++ ;
print "\n" ;
$indent += $shiftwidth ;
push(@stack, $filename) ;
}
}
close CPP ;
$indent = 0 ;
%seen = () ;
print "\n\n" ;
$line = 0 ;
}
exit 0
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-13 14:50 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Russell King
@ 2005-09-13 16:59 ` Joern Engel
2005-09-13 18:04 ` Russell King
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
1 sibling, 1 reply; 21+ messages in thread
From: Joern Engel @ 2005-09-13 16:59 UTC (permalink / raw)
To: Russell King; +Cc: linux-kernel
On Tue, 13 September 2005 15:50:12 +0100, Russell King wrote:
>
> Subject: [KBUILD] Permanently fix kernel configuration include mess.
>
> Include autoconf.h into every kernel compilation via the gcc
> command line using -imacros. This ensures that we have the
> kernel configuration included from the start, rather than
> relying on each file having #include <linux/config.h> as
> appropriate. History has shown that this is something which
> is difficult to get right.
>
> Since we now include the kernel configuration automatically,
> make configcheck becomes meaningless, so remove it.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
If it helps:
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -346,7 +346,8 @@ AFLAGS_KERNEL =
> # Use LINUXINCLUDE when you must reference the include/ directory.
> # Needed to be compatible with the O= option
> LINUXINCLUDE := -Iinclude \
> - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> + -imacros include/linux/autoconf.h
>
> CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
>
> @@ -1247,11 +1248,6 @@ tags: FORCE
> # Scripts to check various things for consistency
> # ---------------------------------------------------------------------------
>
> -configcheck:
> - find * $(RCS_FIND_IGNORE) \
> - -name '*.[hcS]' -type f -print | sort \
> - | xargs $(PERL) -w scripts/checkconfig.pl
> -
> includecheck:
> find * $(RCS_FIND_IGNORE) \
> -name '*.[hcS]' -type f -print | sort \
Jörn
--
Schrödinger's cat is <BLINK>not</BLINK> dead.
-- Illiad
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 13:56 Missing #include <config.h> Jörn Engel
2005-09-13 14:08 ` Russell King
2005-09-13 14:12 ` Missing #include <config.h> Josh Boyer
@ 2005-09-13 17:55 ` Geert Uytterhoeven
2 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2005-09-13 17:55 UTC (permalink / raw)
To: Jörn Engel; +Cc: Linux Kernel Development
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=UTF-8, Size: 1137 bytes --]
On Tue, 13 Sep 2005, [iso-8859-1] Jörn Engel wrote:
> After spending some hours last night and this morning hunting a bug,
> I've found that a different include order made a difference. Some
> files don't work correctly, unless config.h is included before.
>
> Here is a very stupid bug checker for the problem class:
> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u > g1
> $ rgrep CONFIG include/ | cut -d: -f1 | sort -u | xargs grep "config.h" | cut -d: -f1 | sort -u > g2
> $ diff -u g1 g2 | grep ^- > g3
>
> Result is quite a long list for 2.6.13. include/config/* are false
> positives, ok. But what should we do about the rest?
> -include/asm-m68k/amigayle.h
> -include/asm-m68k/amipcmcia.h
> -include/asm-m68k/bvme6000hw.h
> -include/asm-m68k/ioctls.h
> -include/asm-m68k/mvme16xhw.h
These are false positives as well.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 14:12 ` Christoph Hellwig
@ 2005-09-13 17:57 ` Geert Uytterhoeven
2005-09-13 18:02 ` Russell King
0 siblings, 1 reply; 21+ messages in thread
From: Geert Uytterhoeven @ 2005-09-13 17:57 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: J?rn Engel, Linux Kernel Development
On Tue, 13 Sep 2005, Christoph Hellwig wrote:
> On Tue, Sep 13, 2005 at 03:08:26PM +0100, Russell King wrote:
> > On Tue, Sep 13, 2005 at 02:56:23PM +0100, J?rn Engel wrote:
> > > After spending some hours last night and this morning hunting a bug,
> > > I've found that a different include order made a difference. Some
> > > files don't work correctly, unless config.h is included before.
> >
> > I'm still of the opinion that we should add
> >
> > -imacros include/linux/config.h
> >
> > to the gcc command line and stop bothering with trying to get
> > linux/config.h included into the right files and not in others.
> > (which then means we can eliminate linux/config.h from all files.)
>
> Yes, absolutely. That would help fixing lots of mess.
What about dependencies? Would it cause a recompile of everything if config.h
is changed?
[...]
Ah, I guess not, since config.h is filtered out of the deps anyway and replaced
by a smarter dependency on the correct CONFIG_*, right?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Missing #include <config.h>
2005-09-13 17:57 ` Geert Uytterhoeven
@ 2005-09-13 18:02 ` Russell King
0 siblings, 0 replies; 21+ messages in thread
From: Russell King @ 2005-09-13 18:02 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Christoph Hellwig, J?rn Engel, Linux Kernel Development
On Tue, Sep 13, 2005 at 07:57:30PM +0200, Geert Uytterhoeven wrote:
> On Tue, 13 Sep 2005, Christoph Hellwig wrote:
> > On Tue, Sep 13, 2005 at 03:08:26PM +0100, Russell King wrote:
> > > On Tue, Sep 13, 2005 at 02:56:23PM +0100, J?rn Engel wrote:
> > > > After spending some hours last night and this morning hunting a bug,
> > > > I've found that a different include order made a difference. Some
> > > > files don't work correctly, unless config.h is included before.
> > >
> > > I'm still of the opinion that we should add
> > >
> > > -imacros include/linux/config.h
> > >
> > > to the gcc command line and stop bothering with trying to get
> > > linux/config.h included into the right files and not in others.
> > > (which then means we can eliminate linux/config.h from all files.)
> >
> > Yes, absolutely. That would help fixing lots of mess.
>
> What about dependencies? Would it cause a recompile of everything if config.h
> is changed?
-imacros include/linux/autoconf.h doesn't leak into the dependencies so
it's fine.
> Ah, I guess not, since config.h is filtered out of the deps anyway and
> replaced by a smarter dependency on the correct CONFIG_*, right?
According to my .*.cmd files, apparantly so.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-13 16:59 ` Joern Engel
@ 2005-09-13 18:04 ` Russell King
2005-09-13 19:10 ` [PATCH] Permanently fix kernel configuration include mess Brian Gerst
0 siblings, 1 reply; 21+ messages in thread
From: Russell King @ 2005-09-13 18:04 UTC (permalink / raw)
To: Joern Engel, Andrew Morton; +Cc: linux-kernel
On Tue, Sep 13, 2005 at 05:59:54PM +0100, Joern Engel wrote:
> On Tue, 13 September 2005 15:50:12 +0100, Russell King wrote:
> >
> > Subject: [KBUILD] Permanently fix kernel configuration include mess.
> >
> > Include autoconf.h into every kernel compilation via the gcc
> > command line using -imacros. This ensures that we have the
> > kernel configuration included from the start, rather than
> > relying on each file having #include <linux/config.h> as
> > appropriate. History has shown that this is something which
> > is difficult to get right.
> >
> > Since we now include the kernel configuration automatically,
> > make configcheck becomes meaningless, so remove it.
> >
> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>
> If it helps:
> Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Might help more if I copied (or sent this to) akpm. 8)
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -346,7 +346,8 @@ AFLAGS_KERNEL =
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude \
- $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
+ -imacros include/linux/autoconf.h
CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
@@ -1247,11 +1248,6 @@ tags: FORCE
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
-configcheck:
- find * $(RCS_FIND_IGNORE) \
- -name '*.[hcS]' -type f -print | sort \
- | xargs $(PERL) -w scripts/checkconfig.pl
-
includecheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess
2005-09-13 18:04 ` Russell King
@ 2005-09-13 19:10 ` Brian Gerst
2005-09-13 19:33 ` Josh Boyer
0 siblings, 1 reply; 21+ messages in thread
From: Brian Gerst @ 2005-09-13 19:10 UTC (permalink / raw)
To: Russell King; +Cc: Joern Engel, Andrew Morton, linux-kernel
Russell King wrote:
> On Tue, Sep 13, 2005 at 05:59:54PM +0100, Joern Engel wrote:
>
>>On Tue, 13 September 2005 15:50:12 +0100, Russell King wrote:
>>
>>>Subject: [KBUILD] Permanently fix kernel configuration include mess.
>>>
>>>Include autoconf.h into every kernel compilation via the gcc
>>>command line using -imacros. This ensures that we have the
>>>kernel configuration included from the start, rather than
>>>relying on each file having #include <linux/config.h> as
>>>appropriate. History has shown that this is something which
>>>is difficult to get right.
>>>
>>>Since we now include the kernel configuration automatically,
>>>make configcheck becomes meaningless, so remove it.
>>>
>>>Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>>
>>If it helps:
>>Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
>
>
> Might help more if I copied (or sent this to) akpm. 8)
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -346,7 +346,8 @@ AFLAGS_KERNEL =
> # Use LINUXINCLUDE when you must reference the include/ directory.
> # Needed to be compatible with the O= option
> LINUXINCLUDE := -Iinclude \
> - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> + -imacros include/linux/autoconf.h
>
> CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
>
> @@ -1247,11 +1248,6 @@ tags: FORCE
> # Scripts to check various things for consistency
> # ---------------------------------------------------------------------------
>
> -configcheck:
> - find * $(RCS_FIND_IGNORE) \
> - -name '*.[hcS]' -type f -print | sort \
> - | xargs $(PERL) -w scripts/checkconfig.pl
> -
> includecheck:
> find * $(RCS_FIND_IGNORE) \
> -name '*.[hcS]' -type f -print | sort \
>
>
The patch should also remove the checkconfig.pl script.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess
2005-09-13 19:10 ` [PATCH] Permanently fix kernel configuration include mess Brian Gerst
@ 2005-09-13 19:33 ` Josh Boyer
2005-09-13 20:10 ` Alexey Dobriyan
0 siblings, 1 reply; 21+ messages in thread
From: Josh Boyer @ 2005-09-13 19:33 UTC (permalink / raw)
To: Brian Gerst; +Cc: Russell King, Joern Engel, Andrew Morton, linux-kernel
On Tue, 2005-09-13 at 15:10 -0400, Brian Gerst wrote:
> Russell King wrote:
> > On Tue, Sep 13, 2005 at 05:59:54PM +0100, Joern Engel wrote:
> >
> >>On Tue, 13 September 2005 15:50:12 +0100, Russell King wrote:
> >>
> >>>Subject: [KBUILD] Permanently fix kernel configuration include mess.
> >>>
> >>>Include autoconf.h into every kernel compilation via the gcc
> >>>command line using -imacros. This ensures that we have the
> >>>kernel configuration included from the start, rather than
> >>>relying on each file having #include <linux/config.h> as
> >>>appropriate. History has shown that this is something which
> >>>is difficult to get right.
> >>>
> >>>Since we now include the kernel configuration automatically,
> >>>make configcheck becomes meaningless, so remove it.
> >>>
> >>>Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> >>
> >>If it helps:
> >>Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
> >
> >
> > Might help more if I copied (or sent this to) akpm. 8)
> >
> > diff --git a/Makefile b/Makefile
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -346,7 +346,8 @@ AFLAGS_KERNEL =
> > # Use LINUXINCLUDE when you must reference the include/ directory.
> > # Needed to be compatible with the O= option
> > LINUXINCLUDE := -Iinclude \
> > - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> > + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> > + -imacros include/linux/autoconf.h
> >
> > CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
> >
> > @@ -1247,11 +1248,6 @@ tags: FORCE
> > # Scripts to check various things for consistency
> > # ---------------------------------------------------------------------------
> >
> > -configcheck:
> > - find * $(RCS_FIND_IGNORE) \
> > - -name '*.[hcS]' -type f -print | sort \
> > - | xargs $(PERL) -w scripts/checkconfig.pl
> > -
> > includecheck:
> > find * $(RCS_FIND_IGNORE) \
> > -name '*.[hcS]' -type f -print | sort \
> >
> >
>
> The patch should also remove the checkconfig.pl script.
That could probably be done in a later cleanup patch that removes all
"#include <linux/config.h>" statements as well. Sounds like a job for
the kernel janitors project.
josh
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess
2005-09-13 19:33 ` Josh Boyer
@ 2005-09-13 20:10 ` Alexey Dobriyan
0 siblings, 0 replies; 21+ messages in thread
From: Alexey Dobriyan @ 2005-09-13 20:10 UTC (permalink / raw)
To: Josh Boyer
Cc: Brian Gerst, Russell King, Joern Engel, Andrew Morton,
linux-kernel
On Tue, Sep 13, 2005 at 02:33:04PM -0500, Josh Boyer wrote:
> That could probably be done in a later cleanup patch that removes all
> "#include <linux/config.h>" statements as well. Sounds like a job for
> the kernel janitors project.
Only after -imacros will hit mainline. For now, it's a "cleanup "make
checkconfig" output".
BTW, somebody who'll send a final patch, please, ensure that "make C=1"
doesn't blow up. Grepping for "macros" on sparse codebase show nothing.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-13 14:50 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Russell King
2005-09-13 16:59 ` Joern Engel
@ 2005-09-14 8:39 ` Andrew Morton
2005-09-14 8:48 ` Russell King
` (3 more replies)
1 sibling, 4 replies; 21+ messages in thread
From: Andrew Morton @ 2005-09-14 8:39 UTC (permalink / raw)
To: Russell King; +Cc: joern, linux-kernel
Russell King <rmk+lkml@arm.linux.org.uk> wrote:
>
> LINUXINCLUDE := -Iinclude \
> - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> + -imacros include/linux/autoconf.h
This means that over time the kernel will fail to compile correctly without
`-imacros include/linux/autoconf.h'.
That's OK for the kernel, but not for out-of-tree stuff. Those drivers
will need to add the new gcc commandline option too.
Not that I'm saying it's a terrible thing. It's just a thing.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
@ 2005-09-14 8:48 ` Russell King
2005-09-14 13:48 ` Sergey Vlasov
` (2 subsequent siblings)
3 siblings, 0 replies; 21+ messages in thread
From: Russell King @ 2005-09-14 8:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: joern, linux-kernel
On Wed, Sep 14, 2005 at 01:39:44AM -0700, Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> >
> > LINUXINCLUDE := -Iinclude \
> > - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> > + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> > + -imacros include/linux/autoconf.h
>
> This means that over time the kernel will fail to compile correctly without
> `-imacros include/linux/autoconf.h'.
>
> That's OK for the kernel, but not for out-of-tree stuff. Those drivers
> will need to add the new gcc commandline option too.
>
> Not that I'm saying it's a terrible thing. It's just a thing.
Well I don't really understand all the kbuild complexities, so I just
did a "what works for me in the setups I have" patch. Maybe someone
who properly understands the kbuild complexity should have a look.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
2005-09-14 8:48 ` Russell King
@ 2005-09-14 13:48 ` Sergey Vlasov
2005-09-14 14:02 ` Christoph Hellwig
2005-09-14 17:04 ` Sam Ravnborg
3 siblings, 0 replies; 21+ messages in thread
From: Sergey Vlasov @ 2005-09-14 13:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: Russell King, joern, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
On Wed, 14 Sep 2005 01:39:44 -0700 Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> >
> > LINUXINCLUDE := -Iinclude \
> > - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> > + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> > + -imacros include/linux/autoconf.h
>
> This means that over time the kernel will fail to compile correctly without
> `-imacros include/linux/autoconf.h'.
>
> That's OK for the kernel, but not for out-of-tree stuff. Those drivers
> will need to add the new gcc commandline option too.
You mean out-of-tree drivers which don't use the kernel makefiles when
compiling for 2.6? Are there such beasts, and do we care about them?
(For 2.4 such crap was almost everywhere; for 2.6 the situation seems
to be better.)
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
2005-09-14 8:48 ` Russell King
2005-09-14 13:48 ` Sergey Vlasov
@ 2005-09-14 14:02 ` Christoph Hellwig
2005-09-14 17:04 ` Sam Ravnborg
3 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2005-09-14 14:02 UTC (permalink / raw)
To: Andrew Morton; +Cc: Russell King, joern, linux-kernel
On Wed, Sep 14, 2005 at 01:39:44AM -0700, Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> >
> > LINUXINCLUDE := -Iinclude \
> > - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> > + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> > + -imacros include/linux/autoconf.h
>
> This means that over time the kernel will fail to compile correctly without
> `-imacros include/linux/autoconf.h'.
>
> That's OK for the kernel, but not for out-of-tree stuff. Those drivers
> will need to add the new gcc commandline option too.
The only supported way to compile out of tree drivers for 2.6.x is
to use the kbuild framework, which will automatically add it.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>)
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
` (2 preceding siblings ...)
2005-09-14 14:02 ` Christoph Hellwig
@ 2005-09-14 17:04 ` Sam Ravnborg
3 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2005-09-14 17:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: Russell King, joern, linux-kernel
On Wed, Sep 14, 2005 at 01:39:44AM -0700, Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> >
> > LINUXINCLUDE := -Iinclude \
> > - $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
> > + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
> > + -imacros include/linux/autoconf.h
>
> This means that over time the kernel will fail to compile correctly without
> `-imacros include/linux/autoconf.h'.
>
> That's OK for the kernel, but not for out-of-tree stuff. Those drivers
> will need to add the new gcc commandline option too.
Out-of-tree stuff are broken if they do not use kbuild.
And for 2.6 many out-of-tree modules has started doing this - especially
when they realised how easy it was (modulos backward compatibility
stuff).
Sam
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2005-09-14 17:02 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-13 13:56 Missing #include <config.h> Jörn Engel
2005-09-13 14:08 ` Russell King
2005-09-13 14:12 ` Christoph Hellwig
2005-09-13 17:57 ` Geert Uytterhoeven
2005-09-13 18:02 ` Russell King
2005-09-13 14:50 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Russell King
2005-09-13 16:59 ` Joern Engel
2005-09-13 18:04 ` Russell King
2005-09-13 19:10 ` [PATCH] Permanently fix kernel configuration include mess Brian Gerst
2005-09-13 19:33 ` Josh Boyer
2005-09-13 20:10 ` Alexey Dobriyan
2005-09-14 8:39 ` [PATCH] Permanently fix kernel configuration include mess (was: Missing #include <config.h>) Andrew Morton
2005-09-14 8:48 ` Russell King
2005-09-14 13:48 ` Sergey Vlasov
2005-09-14 14:02 ` Christoph Hellwig
2005-09-14 17:04 ` Sam Ravnborg
2005-09-13 14:12 ` Missing #include <config.h> Josh Boyer
2005-09-13 14:28 ` Russell King
2005-09-13 14:40 ` Josh Boyer
2005-09-13 16:22 ` Doug Maxey
2005-09-13 17:55 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox