bug.h: add BUILD_BUG_DECL, usable at file scope

This adds BUILD_BUG_DECL, primarily to check sizes of file-scoped
arrays etc:

  const char const *names[] = { "bart", "lisa", "homer", "marge" };
  int a[] = {1,2,3,4}, b[] = {1,2,3,5}, c[] = {1,2}
  long d[] = {1,2};
  BUILD_BUG_DECL(Luke, sizeof(a) != sizeof(d));			// ok, but iffy usage
  BUILD_BUG_DECL(Han, sizeof(a) != sizeof(b));			// good
  BUILD_BUG_DECL(Obi, ARRAY_SIZE(a) != ARRAY_SIZE(b));		// better
  BUILD_BUG_DECL(Yoda, ARRAY_SIZE(a) != ARRAY_SIZE(names));	// good, on different types
  BUILD_BUG_DECL(Darth, sizeof(a) != sizeof(c));		// compile err

example 1 expands as:
    static __attribute__ ((__section__(".init.data"))) struct {
       int BUILD_BUG_DECL_Luke[1 - 2*!!(sizeof(a) != sizeof(b))];
    } BUILD_BUG_DECL_Luke[0]  __attribute__((unused));

The name parameter distinguishes multiple uses in the same scope, but
is otherwise arbitrary.  You can reuse the name of one of the checked
vars, or pick something easy to find on the rare occaision when the
assertion breaks the build.

example 5 yields:
    error: size of array ‘BUILD_BUG_DECL_Darth’ is negative

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
bug.h: add test/demo module

add drivers/misc/build-asserts.c to test BUILD_BUG_DECL.

BUILD_BUG_DECL adds "storage" to __initdata, test access to it at
module init time.  Multiple BUILD_BUG_DECL items have same address, so
they are reserving no storage, as shown below.  Although the var
should not be used, its questionable whether all defns should share
the same location; it is in the init section, and is released once
initialized.

root@voyage:~# modprobe build-asserts
doing build_asserts, parsing ARGS:
build_asserts.deref_at_init: BBD_joe addr: c8a380b4
build_asserts.deref_at_init: BBD_mike addr: c8a380b4
build_asserts.deref_at_init: &BBD_mike: c8a380b4
build_asserts.deref_at_init: &spot: c8a380b4
build_asserts.deref_at_init: mike old 0, new 33, spot 0

To test access during runtime, cbint modparam is supplied, and the
setter reads one of the BUILD_BUG_DECLs.  This code gets a section
warning, and on a CONFIG_DEBUG_SECTION_MISMATCH=y build, gets a proper
report.  If actually invoked, it gets a paging error, Oops:

root@voyage:~# echo 1 > /sys/module/build_asserts/parameters/cbint
build_asserts.cbint_set: err: 0 val:1
BUG: unable to handle kernel paging request at c8a380b4
IP: [<c8a36143>] cbint_set+0x36/0x60 [build_asserts]
*pde = 06c76067 *pte = 00000000
Oops: 0000 [#1] PREEMPT
Modules linked in: build_asserts acx_mac80211(O) scx200_gpio scx200_hrt pc8736x_gpio nsc_gpio pc87360 hwmon_vid scx200_acb arc4 rtl8180 mac80211 eeprom_93cx6 cfg80211 scx200 ohci_hcd pata_sc1200

Pid: 1302, comm: bash Tainted: G           O 3.4.0-rc2-ske+ #30
EIP: 0060:[<c8a36143>] EFLAGS: 00010246 CPU: 0
EIP is at cbint_set+0x36/0x60 [build_asserts]
EAX: 0000002c EBX: c679e000 ECX: c7454000 EDX: 00000003
ESI: 00000000 EDI: ffffffff EBP: c7455f18 ESP: c7455f00
 DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068
CR0: 8005003b CR2: c8a380b4 CR3: 06763000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process bash (pid: 1302, ti=c7454000 task=c6532f80 task.ti=c7454000)
Stack:
 c8a362f2 c8a36484 00000000 c679e000 c32c41b0 c679e000 c7455f2c c012fa26
 c32c41b0 c8a36540 c012f9f5 c7455f44 c012f8a0 00000002 c0448b28 ffffffed
 00000002 c7455f70 c0202358 00000002 099f2408 c0448b28 c8a36540 c6fcb694
Call Trace:
 [<c012fa26>] param_attr_store+0x31/0x4b
 [<c012f9f5>] ? __kernel_param_lock+0x14/0x14
 [<c012f8a0>] module_attr_store+0x28/0x2e
 [<c0202358>] sysfs_write_file+0xc0/0xeb
 [<c01bd037>] vfs_write+0x8f/0xd5
 [<c0202298>] ? sysfs_poll+0x7c/0x7c
 [<c01bd1f5>] sys_write+0x42/0x63
 [<c043f22c>] syscall_call+0x7/0xb
Code: 26 00 89 c3 e8 d9 9c 6f f7 89 c6 89 5c 24 0c 89 44 24 08 c7 44 24 04 84 64 a3 c8 c7 04 24 f2 62 a3 c8 e8 68 e8 9f f7 85 f6 75 21 <a1> b4 80 a3 c8 c7 44 24 04 84 64 a3 c8 c7 04 24 16 63 a3 c8 89
EIP: [<c8a36143>] cbint_set+0x36/0x60 [build_asserts] SS:ESP 0068:c7455f00
CR2: 00000000c8a380b4
---[ end trace 79ba4640a44abffb ]---

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
b43: use BUILD_BUG_DECL
brcm80211: use BUILD_BUG_DECL

also noticed lots of open-coded ARRAY_SIZE, not done.
rt2x00: use BUILD_BUG_DECL
iwlwifi: use BUILD_BUG_DECL
rtl818x: use BUILD_BUG_DECL
zd1211rw: use BUILD_BUG_DECL
marvell: use BUILD_BUG_DECL - likely bogus
ethernet: use BUILD_BUG_DECL - split later
wireless: use BUILD_BUG_DECL - split later
drivers/net: use BUILD_BUG_DECL - split later
drivers/*: add BUILD_BUG_DECL, except drivers/net, done previously

This set adds \n\t\t after name.
A few comments are out of place, due to spatch script.