zephyr/include/misc
Leandro Pereira 1209245bac util: Ensure ARRAY_SIZE() will only take arrays
This code is inspired by a similar feature found in ccan[1],
that enforces that the parameter passed to ARRAY_SIZE() is
always an array and not a generic pointer.  This is a slightly modified
version that will work if the macro is expanded outside of a function
body.

The check is performed by comparing if typeof(array) and
typeof(&array[0]) are of a different type.  Due to the way arrays
decays to pointers in C, if one passes a pointer, the types won't be
compatible and a compile time assertion will fail.

No bugs have been found with this change, but since there's no runtime
or size overheads, there's no reason to not enable it.

[1] https://github.com/rustyrussell/ccan/blob/master/ccan/array_size/\
    array_size.h

Change-Id: I6c321714d0024298e593176be43b2d0b5362cc0d
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:16 +02:00
..
debug kernel/arch: consolidate tTCS and TNANO definitions 2016-11-12 07:04:52 -05:00
__assert.h
byteorder.h misc: fix off-by-one error in sys_memcpy_swap's assert 2016-10-15 04:14:43 -04:00
dlist.h dlist: fix SYS_DLIST_FOR_EACH_SAFE when operating on empty list 2016-11-18 00:47:25 +00:00
event_logger.h kernel: logger: move to unified kernel APIs 2016-11-09 23:01:42 +00:00
kernel_event_logger.h kernel: Minor optimization to kernel event logger timestamping 2016-11-18 23:17:51 +00:00
nano_work.h include: remove old kernel defintions 2016-11-07 11:32:57 -08:00
printk.h
reboot.h
ring_buffer.h doc: Fix up API descriptions for ring buffers 2016-11-18 02:31:34 +00:00
shell.h console: shell: Support multiple modules 2016-11-02 00:23:18 +00:00
slist.h slist: add static initialization macro 2016-10-01 01:36:38 +00:00
stack.h kernel/arch: consolidate tTCS and TNANO definitions 2016-11-12 07:04:52 -05:00
sys_log.h logging: add exeternal hook to sys_log 2016-11-27 23:07:35 -05:00
util.h util: Ensure ARRAY_SIZE() will only take arrays 2016-12-02 12:41:16 +02:00